home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / gfx / superview-lib-9.12.lha / SuperView-Lib / Programmers / Example_Tools / NewInfoList / NL.c < prev    next >
C/C++ Source or Header  |  1994-12-28  |  5KB  |  197 lines

  1. /* ======================================================================== */
  2. /* = Programmname    : NewInfoList V9.1                      = */
  3. /* =                                      = */
  4. /* ======================================================================== */
  5. /* = Author/Copyright : (c) 1993-94 by Andreas Ralph Kleinert.            = */
  6. /* =               Freeware. All rights reserved.              = */
  7. /* =                                      = */
  8. /* =                   Use it as an example for programming               = */
  9. /* =                   superview.library !                                = */
  10. /* =                                      = */
  11. /* ======================================================================== */
  12. /* = Function          : Demonstrates handling and creation of             = */
  13. /* =                SVObjectInfo- and SVDriverInfo-Lists.             = */
  14. /* =                                      = */
  15. /* ======================================================================== */
  16. /* = Last Update      : 15.9.1994                      = */
  17. /* =                                      = */
  18. /* ======================================================================== */
  19. /* = Remarks          : Needs "superview.library" V6+.                    = */
  20. /* =                                      = */
  21. /* ======================================================================== */
  22. /* = Compiler          : SAS/C V6.51                        = */
  23. /* =                (smakefile)                                       = */
  24. /* ======================================================================== */
  25.  
  26. #include <exec/types.h>
  27. #include <exec/memory.h>
  28.  
  29. #include <superview/superview.h>
  30. #include <superviewsupport/superviewsupport.h>
  31.  
  32. #include <proto/exec.h>
  33. #include <proto/dos.h>
  34. #include <proto/superview.h>
  35. #include <proto/superviewsupport.h>
  36.  
  37. #include <stdio.h>
  38. #include <stdlib.h>
  39. #include <string.h>
  40.  
  41.  
  42.    /* Help- and Info- Texts */
  43.  
  44. char entry1_text  [] = "\2331;32;40mNewInfoList V9.1 \2330;32;40m\2333;32;40m(FREEWARE)\2330;32;40m\n(c) 1993-94 by Andreas Ralph Kleinert.\nAndreas R. Kleinert, Grube Hohe Grethe 23, D-57074 Siegen, Germany.\n";
  45. char entry2_text  [] = "Tests some superview.library functions.\n";
  46. char entry3_text  [] = "USAGE : \2330;33;40mNewInfoList\2330;31;40m\n";
  47.  
  48.  
  49. char ver_text [] = "\0$VER: NewInfoList V9.1 (25.9.94)";
  50.  
  51.  
  52. /* *************************************************** */
  53. /* *                             * */
  54. /* * Error-Messages for Leave() and KF_Message()     * */
  55. /* *                             * */
  56. /* *************************************************** */
  57.  
  58. char svlib_text [] = "You need \42superview.library\42 V6+ !";
  59.  
  60.  
  61. /* *************************************************** */
  62. /* *                             * */
  63. /* * Function Declarations                 * */
  64. /* *                             * */
  65. /* *************************************************** */
  66.  
  67. void __regargs SVObjectInfo_Test(void);
  68. void __regargs SVDriverInfo_Test(void);
  69. void __regargs SVOperatorInfo_Test(void);
  70.  
  71. void __regargs Leave(char *endtext, long code);
  72.  
  73.  
  74.    /* Functions from module "NL_Subs.o" : */
  75.  
  76. extern void __stdargs K_Printf(char *formatstring, ...);
  77.  
  78.  
  79. /* *************************************************** */
  80. /* *                             * */
  81. /* * Additional Base Declarations             * */
  82. /* *                             * */
  83. /* *************************************************** */
  84.  
  85. extern struct ExecBase *SysBase;
  86.  
  87. struct SuperViewBase *SuperViewBase = N;
  88.  
  89.  
  90. /* *************************************************** */
  91. /* *                             * */
  92. /* * MAIN                         * */
  93. /* *                             * */
  94. /* *************************************************** */
  95.  
  96. void main(long argc, char **argv)
  97. {
  98.  if(!argc) Leave(N, 0);
  99.  
  100.  if( argc > 3 || (argv[1][0] =='?')||(argv[2][0] =='?'))
  101.   {
  102.    K_Printf("%s%s%s", entry1_text, entry2_text, entry3_text);
  103.  
  104.    Leave(N, 0);
  105.   }
  106.  
  107.  SuperViewBase = (struct SuperViewBase *) OpenLibrary("superview.library", 6);
  108.  if(!SuperViewBase) Leave(svlib_text, 103);
  109.  
  110.  SVObjectInfo_Test();
  111.  SVDriverInfo_Test();
  112.  SVOperatorInfo_Test();
  113.  
  114.  Leave("\n", 0);
  115. }
  116.  
  117. void __regargs SVObjectInfo_Test(void)
  118. {
  119.  struct SVObjectInfo *pad;
  120.  struct SVObjectInfo *fpad;
  121.  
  122.  K_Printf("\n\nTesting SVObjectInfo functions :\n");
  123.  
  124.  if(!SVL_GetSVObjectList(&pad))
  125.   {
  126.    fpad = pad;
  127.  
  128.    while(pad)
  129.     {
  130.      K_Printf("\n %-24s (SubTypeCode : %2ld), Flags : 0x%lx", pad->soi_TypeName, pad->soi_Type, pad->soi_Flags);
  131.  
  132.      pad = pad->soi_NextEntry;
  133.     }
  134.  
  135.    if(fpad) SVL_FreeSVObjectList(fpad);
  136.   }
  137. }
  138.  
  139. void __regargs SVDriverInfo_Test(void)
  140. {
  141.  struct SVDriverInfo *pad;
  142.  struct SVDriverInfo *fpad;
  143.  
  144.  K_Printf("\n\nTesting SVDriverInfo functions :\n");
  145.  
  146.  if(!SVL_GetSVDriverList(&pad))
  147.   {
  148.    fpad = pad;
  149.  
  150.    while(pad)
  151.     {
  152.      K_Printf("\n %-24s, Flags : 0x%lx", pad->sdi_Name, pad->sdi_Flags);
  153.  
  154.      pad = pad->sdi_NextEntry;
  155.     }
  156.  
  157.    if(fpad) SVL_FreeSVDriverList(fpad);
  158.   }
  159. }
  160.  
  161. void __regargs SVOperatorInfo_Test(void)
  162. {
  163.  struct SVOperatorInfo *pad;
  164.  struct SVOperatorInfo *fpad;
  165.  
  166.  K_Printf("\n\nTesting SVOperatorInfo functions :\n");
  167.  
  168.  if(!SVL_GetSVOperatorList(&pad))
  169.   {
  170.    fpad = pad;
  171.  
  172.    while(pad)
  173.     {
  174.      K_Printf("\n \42%s\42, \42%s\42, Flags : 0x%lx", pad->spi_Desc, pad->spi_Author, pad->spi_Flags);
  175.  
  176.      pad = pad->spi_NextEntry;
  177.     }
  178.  
  179.    if(fpad) SVL_FreeSVOperatorList(fpad);
  180.   }
  181. }
  182.  
  183. /* *************************************************** */
  184. /* *                             * */
  185. /* * LEAVE : Global Exit Function Replacement         * */
  186. /* *                             * */
  187. /* *************************************************** */
  188.  
  189. void __regargs Leave(char *endtext, long code)
  190. {
  191.  if(SuperViewBase) CloseLibrary((APTR) SuperViewBase);
  192.  
  193.  if(endtext)       K_Printf("%s\n", endtext);
  194.  
  195.  exit(code);
  196. }
  197.