home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_2.iso
/
files
/
692a.lha
/
EdPlayer_v2.1
/
cteled.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-18
|
3KB
|
91 lines
/* C version of TellEd, version 2.1, by Ed Mackey */
/* This is a program demonstrating how to call EdPlayer withOUT the
use of ARexx. Do NOT use this method on ANY other program besides
EdPlayer. For information on creating true AREXX messages, please
see your ARexx manual. */
/* This is for the Aztec Manx C compiler */
/* and is dedicated to all those MegaBall fans
who gave me the money to buy it... */
#include <functions.h>
#include <exec/types.h>
#include <exec/ports.h>
#include "edplayer.h"
main(argc,argv)
int argc;
UBYTE *argv[];
{
long mypri,lp,retval; /* Init some variables */
char *daa;
char *dbb;
struct MsgPort *myport, *mynewport;
struct Message *mymsg;
struct EdMessage sndmsg, *EdPmsg;
retval = 21; /* Error if something goes wrong */
if (argc != 2) {
printf("Usage: %s \"<Edplayer command>\"\n",argv[0]);
} else {
sndmsg.result = 0l; /* Always init results to 0 */
sndmsg.result2 = 0l;
(char *)sndmsg.EdCommand = (char *)argv[1]; /* load up command */
printf("Telling EdPlayer to %s.\n",argv[1]);
mypri = 0;
mynewport = CreatePort(NULL,mypri); /* Make a replyport */
sndmsg.MainMess.mn_Length = 44;
sndmsg.MainMess.mn_ReplyPort = (struct MsgPort *)mynewport;
Forbid(); /* MULTITASKING = OFF, so EdP doesn't trick us */
myport = FindPort((char *)"EDPLAYER");
if (myport == NULL) {
Permit(); /* MULTITASKING = ON */
printf("Could not find EdPlayer in system. Please run it.\n");
} else {
PutMsg(myport,(struct Message *)&sndmsg); /* SEND THE MSG! */
Permit(); /* MULTITASKING = ON */
mymsg = WaitPort(mynewport); /* Wait for it..... */
mymsg = GetMsg(mynewport); /* Get the returned message */
EdPmsg = (struct EdMessage *)mymsg;
retval = EdPmsg->result;
printf("Returned %d: ",retval); /* Tell user the number */
switch (retval) { /* Tell user what the # means... */
case 0 : printf("All OK.\n"); break;
case 3 : printf("There is no main panel in EdPlayer Junior.\n"); break;
case 4 : printf("Can't give result. Use ARexx (AskEd) not cteled.\n"); break;
case 5 : printf("Incorrect password for PP-encrypted file.\n"); break;
case 6 : printf("No program.\n"); break;
case 7 : printf("Illegal JUMP.\n"); break;
case 8 : printf("Music STOPped, can't continue.\n"); break;
case 9 : printf("Nothing to PLAY!\n"); break;
case 10 : printf("Syntax error.\n"); break;
case 11 : printf("Can't allocate serial port for MIDI.\n"); break;
case 12 : printf("File not found.\n"); break;
case 13 : printf("Can't find LIBS:powerpacker.library.\n"); break;
case 14 : printf("Disk error.\n"); break;
case 15 : printf("Out of CHIP memory.\n"); break;
case 16 : printf("Unknown module type, or corrupted module!\n"); break;
case 17 : printf("Can't find LIBS:rexxsyslib.library.\n"); break;
case 21 : printf("EdPlayer is exiting, command ignored.\n"); break;
default : printf("Unknown error! Please upgrade to a newer version of cteled.\n");
};
DeletePort(mynewport); /* Kill the replyport */
}
}
exit(retval); /* Tell AmigaDOS all about it, too */
}