home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / commod / sdark14s.lha / blankers / ARexx.dark.c < prev    next >
C/C++ Source or Header  |  1993-01-30  |  2KB  |  82 lines

  1.  /* Fichier star.dark.c                */
  2. /* Module appele par le programme principal    */
  3. /* pour effectuer un effet defini..appele par    */
  4. /* loadseg                    */
  5.  
  6. #include    <exec/types.h>
  7.  
  8. #include <rexx/storage.h>
  9. #include <rexx/errors.h>
  10.  
  11. #include    "/includes/struct.h"
  12. #include    "/includes/tom_gadget.h"
  13.  
  14. char    *p_text_info="   ' ARexx handler'\n\nWith this module, you can send an ARexx cmd\nto a programm to make a blanking effect!\n\nArexxPort is the name of the Port!\n\nStart is the Arexx cmd send at the begining of the blank\nStop is the cmd send at the end (can be null)\n\nPar T.Landspurg";
  15. #define    TAILLE_BUF    100
  16. char    buffer_deb[TAILLE_BUF]="";
  17. char    buffer_end[TAILLE_BUF]="";
  18.  
  19. struct tom_gadget my_gadg[]={
  20.     {"Arexx_Port",STRING,120,20,144,14,0,20,0,0,"                     "},
  21.     {"Cmd",    STRING,120,40,144,14,0,TAILLE_BUF,0,0,buffer_deb},
  22.     {"EndCmd",STRING,120,60,144,14,0,TAILLE_BUF,0,0,buffer_end},
  23.     {0,        END_LISTE,  0,  0,   0, 0, 0,0,0,0,0}
  24. };
  25.  
  26.  
  27. send_msg(buf)
  28. char *buf;
  29. {
  30.     struct    RexxMsg    rx_message;
  31.     struct    MsgPort *rexx_port = NULL;
  32.     struct    MsgPort *reply_port = NULL;
  33.     int    code_ret;
  34.  
  35.    if(mystrlen(buf)!=0){
  36.     code_ret=0;
  37.     Forbid();
  38.     if( (rexx_port=FindPort (my_gadg[0].p_data)) ==NULL){
  39.         Permit();
  40.         code_ret=-1;
  41.     }else if((reply_port=(struct MsgPort *)CreatePort ("Reply port", 0L))==NULL){
  42.         Permit();
  43.         code_ret=-1;
  44.     }else{
  45.         rx_message.rm_Args[0]=buf;
  46.         rx_message.rm_Args[1]=NULL;
  47.         rx_message.rm_Args[2]=NULL;
  48.         rx_message.rm_Action=RXCOMM;
  49.         rx_message.rm_Node.mn_ReplyPort=reply_port;
  50.         rx_message.rm_Node.mn_Node.ln_Type=NT_MESSAGE;
  51.  
  52.         PutMsg(rexx_port,&rx_message);
  53.         Permit();
  54.         WaitPort(reply_port);
  55.         DeletePort(reply_port);
  56.         if(rx_message.rm_Result1!=RC_OK)code_ret=-1;
  57.     }
  58.     return(code_ret);
  59.    }
  60. }
  61.  
  62. /********************************************************** dark ***/
  63.  
  64. void    __saveds    dark()
  65. {
  66.     send_msg(my_gadg[1].p_data);
  67.     wait_end();
  68.     send_msg(my_gadg[2].p_data);
  69. }
  70.  
  71. void    proc_init()
  72. {
  73. }
  74. void    proc_save()
  75. {
  76. }
  77.  
  78. void    proc_end()
  79. {
  80. }
  81.  
  82.