home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / progtool / c / xacclib / xacc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  2.4 KB  |  99 lines

  1. /* XACC.H - Routinen zur Behandlung des XACC-Protokolls
  2.             nach der Spezifikation vom 28. November 1992,
  3.             erweitert um Mag!X 2.0 (ap_version == 0x399)
  4.  
  5.     (c) 1993 Harald Sommerfeldt @ KI
  6.     E-Mail:  Harald_Sommerfeldt@ki.maus.de
  7. */
  8.  
  9. /* XACC - Definitionen */
  10. #define ACC_ID        0x400
  11. #define ACC_OPEN    0x401
  12. #define ACC_CLOSE    0x402
  13. #define ACC_ACC    0x403
  14. #define ACC_EXIT    0x404
  15. #define ACC_ACK    0x500
  16. #define ACC_TEXT    0x501
  17. #define ACC_KEY    0x502
  18. #define ACC_META    0x503
  19. #define ACC_IMG    0x504
  20.  
  21.  
  22. #define MAX_XACC 20                    /* Anzahl der unterstüzten XACC-Partner */
  23.  
  24. extern struct xaccs {                /* Strukturen, um sich die XACC-Partner zu merken */
  25.     int    id;                            /* ap_id */
  26.     unsigned groups;                    /* XACC-Group-Wort */
  27.     const char *name;                    /* XACC-Name */
  28. } xaccs[MAX_XACC];
  29.  
  30.  
  31. /* bereitgestellte XACC - Routinen */
  32. int    xacc_init( int menu_id, const char *name, int sizeofname, unsigned groups );
  33. void    xacc_exit( void );
  34. void    *xacc_malloc( long amount );
  35. int    xacc_message( const int *msgbuf );
  36. int    xacc_send( int dest_id, int last_or_keycode, int message, void *addr, long length );
  37. int    xacc_decode( const int *msgbuf, int *plast_or_keycode, void **paddr, long *plength );
  38. int    xacc_ack( int dest_id, int ok );
  39.  
  40. /* interne XACC - Routinen, werden normalerweise nicht benötigt */
  41. int    xacc_id( int dest_id, int message );
  42. int    xacc_remid( int id, const int *msgbuf );
  43. int    xacc_killid( int id );
  44.  
  45.  
  46. /* ein minimales XACC-Programm sieht nun in etwa so aus:
  47.  
  48. #include <aes.h>
  49. #include "xacc.h"
  50.  
  51. int    quit;
  52.  
  53. main()
  54. {
  55.     const char name[] = "mein Programm";
  56.     int    event, msgbuf[8];
  57.  
  58.     appl_init();
  59.     xacc_init( -1, name, sizeof( name ), 0x0000 );
  60.     for ( quit = FALSE; !quit ; ) {
  61.         event = evnt_multi( MU_MESAG, ..., msgbuf, ... );
  62.         if ( event & MU_MESAG ) {
  63.             if ( !xacc_message( msgbuf ) ) switch ( msgbuf[0] ) {
  64.                 ...
  65.             }
  66.         }
  67.     }
  68.     xacc_exit();
  69.     appl_exit();
  70.     return 0;
  71. }
  72. */
  73.  
  74. /* und ein minimales XACC-Accessory in etwa so:
  75.  
  76. #include <aes.h>
  77. #include "xacc.h"
  78.  
  79. void main( void )
  80. {
  81.     const char name[] = "mein Accessory";
  82.     int    menu_id, event, msgbuf[8];
  83.  
  84.     menu_id = menu_register( appl_init(), "  mein ACC" );
  85.     xacc_init( menu_id, name, sizeof( name ), 0x0000 );
  86.     for (;;) {
  87.         event = evnt_multi( MU_MESAG, ..., msgbuf, ... );
  88.         if ( event & MU_MESAG ) {
  89.             if ( !xacc_message( msgbuf ) ) switch ( msgbuf[0] ) {
  90.                 case AC_OPEN:
  91.                     ...
  92.                     break;
  93.                 ...
  94.             }
  95.         }
  96.     }
  97. }
  98. */
  99.