home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / M / MUBBS / MUBBS Module Source V.5.cpt / Module Source / Example1 Module code / Example1 Module Main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-11  |  1.9 KB  |  56 lines  |  [TEXT/KAHL]

  1. /*
  2.  *  Example1 Module Main.c
  3.  *
  4.  *    This program source code and it's compiled version is
  5.  *  Copyright (c) 1991 N. Hawthorn.
  6.  *  This program source code and it's compiled version IS NOT IN THE
  7.  *  PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NH" file for details
  8.  *  regarding use of this program source code and it's compiled version.
  9.  *
  10.  *  This module's name is "Example1", it's type is "MOD1", it's ID is 129
  11.  *  because we know the menu module's ID is 128. Normally a resource mover
  12.  *  would assign a new number to it, that's why we name our modules !
  13.  *
  14.  *  This is where it all starts...
  15.  *
  16.  */
  17.  
  18. #define INMAIN
  19.  
  20. #include <SetUpA4.h>
  21. #include "MUBBS Module.h"
  22.  
  23. pascal void main (mode1,G1,P1) /* called from the main routines, and what mode to be in */
  24. int mode1;
  25. struct GS *G1; /* we point to the "global" struct in the Main Module here */
  26. Ptr P1; /* we ignore this pointer, we do not use it at all */
  27. {
  28. Handle temph;
  29. float version = 0.5; /* what version of MUBBS you are compatable with IE: .5 and above */
  30. RememberA0(); SetUpA4(); /* This sets up the A4 register to access our globals */
  31. asm { _RecoverHandle }; asm {move.l a0,temph}; HLock(temph); /* locks our module, do this ! */
  32.  
  33. G=G1; /* This MUST be the first thing you do in main only, it sets up the struct globals */
  34. mode[u]=mode1; /* set up our mode so that you can read it anywhere */
  35.  
  36. switch (mode[u]) { /* any un-handled modes return error from this module */
  37.     case 2:
  38.         tests();
  39.         G->moduleresult=0;
  40.         break;
  41.     case 98:
  42.         versionck(version); /* just return after this call, don't modify anything */
  43.         break;        
  44.     case 0:
  45.         strcpy (G->programmer,"N Hawthorn"); /* show the programmer's name up to 20 chars*/
  46.         G->moduleresult=0; /* this was also a init call if we need close call put 99 here */
  47.         break;
  48.     default:
  49.         G->moduleresult=1; /* return bad code */
  50.     };
  51.  
  52. HUnlock(temph); /* unlocks this module, do this ! */
  53. RestoreA4(); /* call this when you are all done */
  54. }
  55.  
  56.