home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / audio / MultiPlayer132sr.lha / Guido / guido.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-25  |  12.7 KB  |  490 lines

  1. /* guido.h - Public header file for Guido - Copyright 1992 Bryan Ford */
  2. #ifndef GUIDO_H
  3. #define GUIDO_H
  4.  
  5. #ifndef EXEC_LIBRARIES_H
  6. #include <exec/libraries.h>
  7. #endif
  8.  
  9.  
  10. /* By default, this header file uses the linked Guido library.
  11.    To use the Amiga runtime guido.library, #define the symbol G_RUNLIB before
  12.    including this header file. */
  13.  
  14.  
  15. /* You can get some useful stuff out of GuidoBase whenever you have it open. */
  16. /* If you are using the link library, you must open all these libraries yourself. */
  17. struct GuidoBase
  18.   {
  19.     struct Library Node;
  20.     short Private[3];
  21.  
  22.     /* These will always be valid whenever guido.library is open. */
  23.     struct ExecBase *SysBase;
  24.     struct DosLibrary *DOSBase;
  25.     struct GfxBase *GfxBase;
  26.     struct IntuitionBase *IntuitionBase;
  27.     struct GadToolsBase *GadToolsBase;
  28.     struct AslBase *AslBase;
  29.     struct DiskfontBase *DiskfontBase;
  30.   };
  31.  
  32.  
  33.  
  34. /* Some special provisions to support both link and runtime libraries on the Amiga */
  35. #ifdef AMIGA
  36. #  ifdef __SASC
  37. #    define G_FAR __far
  38. #    define G_STD __stdargs
  39. #    ifndef G_RUNLIB
  40. #      define G_ASM __asm
  41. #      define G_REG(r) register __ ## r
  42. #    endif
  43. #  endif
  44. #  ifdef MANX
  45. #    define G_FAR _far
  46. #  endif
  47. #endif
  48.  
  49.  
  50. /* As a default, all these things are meaningless and should
  51.  * cause generation of simple prototypes for the various functions
  52.  * as through they were normal C-callable link library functions.
  53.  */
  54. #ifndef G_FAR
  55. #  define G_FAR
  56. #endif
  57. #ifndef G_ASM
  58. #  define G_ASM
  59. #endif
  60. #ifndef G_STD
  61. #  define G_STD
  62. #endif
  63. #ifndef G_REG
  64. #  define G_REG(r)
  65. #endif
  66.  
  67.  
  68. /* Use this to reference an external GuidoSpec (a symbol defined by GComp). */
  69. typedef char G_FAR GuidoSpec[];
  70.  
  71.  
  72. /* This is what all Guido callback functions receive as their first argument. */
  73. /* This may look like part of an IntuiMessage, but that is not necessarily what it is... */
  74. struct GuidoMessage
  75.   {
  76.     long Class;
  77.     short Code;
  78.     short Qualifier;
  79.     void *Address;
  80.     short MouseX, MouseY;
  81.     long Seconds, Micros;
  82.     struct Window *Window;
  83.   };
  84.  
  85.  
  86. /* All Guido callback functions should look something like this: */
  87. typedef void GuidoCallback(struct GuidoMessage *gmsg,long userdata);
  88.  
  89.  
  90. /* Function prototypes */
  91.  
  92. /* Guido Requesters */
  93. /* These functions use the ASL requesters. */
  94. /* You must have AslBase initialized before calling these functions. */
  95. /* All requesters are fully asynchronous (detached as a separate process). */
  96. void * G_ASM
  97.   GCreateRequester(
  98.     G_REG(a2) void *reqspec);
  99.  
  100. int G_ASM
  101.   GOpenRequester(
  102.     G_REG(a0) void *greq,
  103.     G_REG(a2) void *reqspec,
  104.     G_REG(a3) void *userstruct);
  105.  
  106. int G_ASM
  107.   GCheckRequester(
  108.     G_REG(a0) void *greq,
  109.     G_REG(a1) void **retdataptr);
  110.  
  111. void G_ASM
  112.   GGetRequesterLocation(
  113.     G_REG(a0) void *greq,
  114.     G_REG(a1) short *location);
  115.  
  116. //int G_ASM
  117. //  GCloseRequester(
  118. //    G_REG(a0) void *greq);
  119.  
  120. int G_ASM
  121.   GDeleteRequester(
  122.     G_REG(a0) void *greq);
  123.  
  124.  
  125. /* Simple window manipulation */
  126. struct Window * G_ASM
  127.   GOpenWindow(
  128.     G_REG(a2) void *winspec,
  129.     G_REG(a3) void *userstruct);
  130.  
  131. void    G_ASM
  132.   GCloseWindow(
  133.     G_REG(a0) struct Window *gwin);
  134.  
  135.  
  136. /* Gadget manipulation */
  137. struct Gadget * G_ASM
  138.   GCreateGadgets(
  139.     G_REG(a2) void *gadspec,
  140.     G_REG(a3) void *userstruct,
  141.     G_REG(a0) struct Screen *gadscreen,
  142.     G_REG(a1) struct TextAttr *defattr,
  143.     G_REG(d0) short leftofs,
  144.     G_REG(d1) short topofs,
  145.     G_REG(a4) short *whreturn);
  146.  
  147. void    G_ASM
  148.   GDeleteGadgets(
  149.     G_REG(a0) struct Gadget *gadlist);
  150.  
  151.  
  152. /* General gadget functions */
  153. void G_ASM
  154.   GDisableGadget(
  155.     G_REG(a1) struct Window *gwin,
  156.     G_REG(a0) struct Gadget *ggad);
  157.  
  158. void G_ASM
  159.   GEnableGadget(
  160.     G_REG(a1) struct Window *gwin,
  161.     G_REG(a0) struct Gadget *ggad);
  162.  
  163. void G_ASM
  164.   GEnDisGadget(
  165.     G_REG(a1) struct Window *gwin,
  166.     G_REG(d0) long enable,
  167.     G_REG(a0) struct Gadget *ggad);
  168.  
  169. void G_ASM
  170.   GActivateGadget(
  171.     G_REG(a1) struct Window *gwin,
  172.     G_REG(a0) struct Gadget *ggad);
  173.  
  174.  
  175. /* Replacements for system event-handling functions */
  176. /* (You only need to worry about these if you don't use GCheckPanel() for event handling.) */
  177. struct IntuiMessage *G_ASM
  178.   GGetIMsg(
  179.     G_REG(a0) struct Window *gwin);
  180.  
  181. void    G_ASM
  182.   GReplyIMsg(
  183.     G_REG(a1) struct IntuiMessage *imsg);
  184.  
  185. void    G_ASM
  186.   GBeginRefresh(
  187.     G_REG(a0) struct Window *gwin);
  188.  
  189. void    G_ASM
  190.   GEndRefresh(
  191.     G_REG(a0) struct Window *gwin);
  192.  
  193. void    G_ASM
  194.   GRefreshWindow(
  195.     G_REG(a0) struct Window *gwin);
  196.  
  197.  
  198. /* Control panel (window+gadgets+windowevents) manipulation */
  199. /* If you use these calls, you probably won't have to use any of the above window/gadget calls. */
  200. /* You can also use GOpenPanel and GClosePanel without using GCheckPanel if you are so inclined. */
  201. struct Window * G_ASM
  202.   GOpenPanel(
  203.     G_REG(a2) void *wingadspec,
  204.     G_REG(a3) void *userstruct,
  205.     G_REG(a0) struct TextAttr *defattr);
  206.  
  207. void    G_ASM
  208.   GClosePanel(
  209.     G_REG(a0) struct Window *panelwin);
  210.  
  211. long G_ASM
  212.   GCheckPanel(
  213.     G_REG(a0) struct Window *panelwin,
  214.     G_REG(a1) GuidoCallback *callback,
  215.     G_REG(d0) long data);
  216.  
  217.  
  218. /* Cycle gadgets */
  219. //long G_ASM
  220. //  GGetCycleActive(
  221. //    G_REG(a0) struct Gadget *gad);
  222.  
  223. void    G_ASM
  224.   GSetCycleActive(
  225.     G_REG(a1) struct Window *win,
  226.     G_REG(a0) struct Gadget *gad,
  227.     G_REG(d0) int active);
  228.  
  229. void    G_ASM
  230.   GSetCycleOptions(
  231.     G_REG(a1) struct Window *win,
  232.     G_REG(a0) struct Gadget *gad,
  233.     G_REG(a2) char **options,
  234.     G_REG(d0) int active);
  235.  
  236.  
  237. /* Checkbox gadgets */
  238. long G_ASM
  239.   GGetCheckboxChecked(
  240.     G_REG(a0) struct Gadget *gad);
  241.  
  242. void    G_ASM
  243.   GSetCheckboxChecked(
  244.     G_REG(a1) struct Window *win,
  245.     G_REG(a0) struct Gadget *gad,
  246.     G_REG(d0) int checked);
  247.  
  248.  
  249. /* Mutual-exclude (radio) gadgets */
  250. //long G_ASM
  251. //  GGetMXActive(
  252. //    G_REG(a0) struct Gadget *gad);
  253.  
  254. //long G_ASM
  255. //  GGetRadioActive(
  256. //    G_REG(a0) struct Gadget *gad);
  257.  
  258. void    G_ASM
  259.   GSetMXActive(
  260.     G_REG(a1) struct Window *win,
  261.     G_REG(a0) struct Gadget *gad,
  262.     G_REG(d0) int active);
  263.  
  264. void    G_ASM
  265.   GSetRadioActive(
  266.     G_REG(a1) struct Window *win,
  267.     G_REG(a0) struct Gadget *gad,
  268.     G_REG(d0) int active);
  269.  
  270.  
  271. /* Text gadgets */
  272. /* (Text gadgets are read-only noninteractive objects like titles and such.) */
  273. void    G_ASM
  274.   GSetText(
  275.     G_REG(a1) struct Window *win,
  276.     G_REG(a0) struct Gadget *gad,
  277.     G_REG(a2) char *text);
  278.  
  279.  
  280. /* String gadgets */
  281. /* (These are the actual interactive text-entry gadgets.) */
  282. char *  G_ASM
  283.   GGetString(
  284.     G_REG(a0) struct Gadget *gad);
  285.  
  286. void    G_ASM
  287.   GSetString(
  288.     G_REG(a1) struct Window *win,
  289.     G_REG(a0) struct Gadget *gad,
  290.     G_REG(a2) char *string);
  291.  
  292.  
  293. /* Number gadgets */
  294. /* (Noninteractive display-only objects) */
  295. void    G_ASM
  296.   GSetNumber(
  297.     G_REG(a1) struct Window *win,
  298.     G_REG(a0) struct Gadget *gad,
  299.     G_REG(d0) long number);
  300.  
  301.  
  302. /* Integer gadgets */
  303. /* (Interactive, editable numbers) */
  304. long G_ASM
  305.   GGetInteger(
  306.     G_REG(a0) struct Gadget *gad);
  307.  
  308. void    G_ASM
  309.   GSetInteger(
  310.     G_REG(a1) struct Window *win,
  311.     G_REG(a0) struct Gadget *gad,
  312.     G_REG(d0) long integer);
  313.  
  314.  
  315. /* ListView gadgets */
  316. //int G_ASM
  317. //  GGetListViewTop(
  318. //    G_REG(a0) struct Gadget *gad);
  319.  
  320. //int G_ASM
  321. //  GGetListViewActive(
  322. //    G_REG(a0) struct Gadget *gad);
  323.  
  324. void G_ASM
  325.   GSetListViewActive(
  326.     G_REG(a1) struct Window *win,
  327.     G_REG(a0) struct Gadget *gad,
  328.     G_REG(d0) int topitem,
  329.     G_REG(d1) int actitem);
  330.  
  331. void G_ASM
  332.   GAttachListView(
  333.     G_REG(a1) struct Window *win,
  334.     G_REG(a0) struct Gadget *gad,
  335.     G_REG(a2) struct List *list,
  336.     G_REG(d0) int topitem,
  337.     G_REG(d1) int actitem);
  338.  
  339. void G_ASM
  340.   GDetachListView(
  341.     G_REG(a1) struct Window *win,
  342.     G_REG(a0) struct Gadget *gad);
  343.  
  344.  
  345. /* Slider gadgets */
  346. //int G_ASM
  347. //  GGetSliderLevel(
  348. //    G_REG(a0) struct Gadget *gad);
  349.  
  350. void    G_ASM
  351.   GSetSliderLevel(
  352.     G_REG(a1) struct Window *win,
  353.     G_REG(a0) struct Gadget *gad,
  354.     G_REG(d0) int level);
  355.  
  356.  
  357. /* Varargs support functions available only in the linked library */
  358. #ifndef G_RUNLIB
  359.  
  360. void G_STD
  361.   GDisableGadgets(
  362.     struct Window *gwin,
  363.     struct Gadget *ggad,...);
  364.  
  365. void G_STD
  366.   GEnableGadgets(
  367.     struct Window *gwin,
  368.     struct Gadget *ggad,...);
  369.  
  370. void G_STD
  371.   GEnDisGadgets(
  372.     struct Window *gwin,
  373.     long enable,
  374.     struct Gadget *ggad,...);
  375.  
  376. #endif
  377.  
  378.  
  379. /* Manx C register call assignments */
  380. #ifdef AMIGA
  381. #  ifdef AZTEC_C
  382. #    ifndef G_RUNLIB
  383. #      pragma regcall(GCreateRequester(a2))
  384. #      pragma regcall(GOpenRequester(a0,a2,a3))
  385. #      pragma regcall(GCheckRequester(a0,a1))
  386. #      pragma regcall(GGetRequesterLocation(a0,a1))
  387. //#      pragma regcall(GCloseRequester(a0))
  388. #      pragma regcall(GDeleteRequester(a0))
  389. #      pragma regcall(GOpenWindow(a2,a3))
  390. #      pragma regcall(GCloseWindow(a0))
  391. #      pragma regcall(GCreateGadgets(a2,a3,a0,a1,d0,d1,a4))
  392. #      pragma regcall(GDeleteGadgets(a0))
  393. #      pragma regcall(GDisableGadget(a1,a0))
  394. #      pragma regcall(GEnableGadget(a1,a0))
  395. #      pragma regcall(GEnDisGadget(a1,a0,d0))
  396. #      pragma regcall(GActivateGadget(a1,a0))
  397. #      pragma regcall(GGetIMsg(a0))
  398. #      pragma regcall(GReplyIMsg(a1))
  399. #      pragma regcall(GBeginRefresh(a0))
  400. #      pragma regcall(GEndRefresh(a0))
  401. #      pragma regcall(GRefreshWindow(a0))
  402. #      pragma regcall(GOpenPanel(a2,a3,a0))
  403. #      pragma regcall(GClosePanel(a0))
  404. #      pragma regcall(GCheckPanel(a0,a1,d0))
  405. //#      pragma regcall(GGetCycleActive(a0))
  406. #      pragma regcall(GSetCycleActive(a1,a0,d0))
  407. #      pragma regcall(GSetCycleOptions(a1,a0,a2,d0))
  408. #      pragma regcall(GGetCheckboxChecked(a0))
  409. #      pragma regcall(GSetCheckboxChecked(a1,a0,d0))
  410. //#      pragma regcall(GGetMXActive(a0))
  411. //#      pragma regcall(GGetRadioActive(a0))
  412. #      pragma regcall(GSetMXActive(a1,a0,d0))
  413. #      pragma regcall(GSetRadioActive(a1,a0,d0))
  414. #      pragma regcall(GSetText(a1,a0,a3))
  415. #      pragma regcall(GGetString(a0))
  416. #      pragma regcall(GSetString(a1,a0,a2))
  417. #      pragma regcall(GSetNumber(a1,a0,d0))
  418. #      pragma regcall(GGetInteger(a0))
  419. #      pragma regcall(GSetInteger(a1,a0,d0))
  420. //#      pragma regcall(GGetListViewTop(a0))
  421. //#      pragma regcall(GGetListViewActive(a0))
  422. #      pragma regcall(GSetListViewActive(a1,a0,d0,d1))
  423. #      pragma regcall(GAttachListView(a1,a0,a2,d0,d1))
  424. #      pragma regcall(GDetachListView(a1,a0))
  425. //#      pragma regcall(GGetSliderLevel(a0))
  426. #      pragma regcall(GSetSliderLevel(a1,a0,d0))
  427. #    endif
  428. #  endif
  429. #endif
  430.  
  431.  
  432. /* Function call pragmas for use with the runtime library (guido.library). */
  433. /* These pragmas (SAS style) will work for both Manx and SAS. */
  434. #ifdef AMIGA
  435. #  ifdef G_RUNLIB
  436. #    pragma libcall GuidoBase GCreateRequester 1E A01
  437. #    pragma libcall GuidoBase GOpenRequester 24 BA803
  438. #    pragma libcall GuidoBase GCheckRequester 2A 9802
  439. #    pragma libcall GuidoBase GGetRequesterLocation 30 9802
  440. /*    pragma libcall GuidoBase GCloseRequester 36 801*/
  441. #    pragma libcall GuidoBase GDeleteRequester 3C 801
  442. #    pragma libcall GuidoBase GOpenWindow 42 BA02
  443. #    pragma libcall GuidoBase GCloseWindow 48 801
  444. #    pragma libcall GuidoBase GCreateGadgets 4E C1098BA07
  445. #    pragma libcall GuidoBase GDeleteGadgets 54 801
  446. #    pragma libcall GuidoBase GDisableGadget 5A 8902
  447. #    pragma libcall GuidoBase GEnableGadget 60 8902
  448. #    pragma libcall GuidoBase GEnDisGadget 66 08903
  449. #    pragma libcall GuidoBase GActivateGadget 6C 8902
  450. #    pragma libcall GuidoBase GGetIMsg 72 801
  451. #    pragma libcall GuidoBase GReplyIMsg 78 901
  452. #    pragma libcall GuidoBase GBeginRefresh 7E 801
  453. #    pragma libcall GuidoBase GEndRefresh 84 801
  454. #    pragma libcall GuidoBase GRefreshWindow 8A 801
  455. #    pragma libcall GuidoBase GOpenPanel 90 8BA03
  456. #    pragma libcall GuidoBase GClosePanel 96 801
  457. #    pragma libcall GuidoBase GCheckPanel 9C 09803
  458. /*    pragma libcall GuidoBase GGetCycleActive A2 801*/
  459. #    pragma libcall GuidoBase GSetCycleActive A8 08903
  460. #    pragma libcall GuidoBase GSetCycleOptions AE 0A8904
  461. #    pragma libcall GuidoBase GGetCheckboxChecked B4 801
  462. #    pragma libcall GuidoBase GSetCheckboxChecked BA 08903
  463. /*    pragma libcall GuidoBase GGetMXActive C0 801*/
  464. /*    pragma libcall GuidoBase GGetRadioActive C6 801*/
  465. #    pragma libcall GuidoBase GSetMXActive CC 08903
  466. #    pragma libcall GuidoBase GSetRadioActive D2 08903
  467. #    pragma libcall GuidoBase GSetText D8 A8903
  468. #    pragma libcall GuidoBase GGetString DE 801
  469. #    pragma libcall GuidoBase GSetString E4 A8903
  470. #    pragma libcall GuidoBase GSetNumber EA 08903
  471. #    pragma libcall GuidoBase GGetInteger F0 801
  472. #    pragma libcall GuidoBase GSetInteger F6 08903
  473. /*    pragma libcall GuidoBase GGetListViewTop FC 801*/
  474. /*    pragma libcall GuidoBase GGetListViewActive 102 801*/
  475. #    pragma libcall GuidoBase GSetListViewActive 108 108904
  476. #    pragma libcall GuidoBase GAttachListView 10E 10A8905
  477. #    pragma libcall GuidoBase GDetachListView 114 A802
  478. /*    pragma libcall GuidoBase GGetSliderLevel 11A 801*/
  479. #    pragma libcall GuidoBase GSetSliderLevel 120 08903
  480. #  endif
  481. #endif
  482.  
  483. /* Get rid of our baggage */
  484. #undef G_FAR
  485. #undef G_ASM
  486. #undef G_STD
  487. #undef G_REG
  488.  
  489. #endif
  490.