home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / viewer / SVLIBS81.LHA / superview-lib / Programmers / Example_Tools / NewInfoList / NL.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-13  |  4.8 KB  |  173 lines

  1. /* ======================================================================== */
  2. /* = Programmname    : NewInfoList V7.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.7.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 V7.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 V7.1 (15.7.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.  
  70. void __regargs Leave(char *endtext, long code);
  71.  
  72.  
  73.    /* Functions from module "NL_Subs.o" : */
  74.  
  75. extern void __stdargs K_Printf(char *formatstring, ...);
  76.  
  77.  
  78. /* *************************************************** */
  79. /* *                             * */
  80. /* * Additional Base Declarations             * */
  81. /* *                             * */
  82. /* *************************************************** */
  83.  
  84. extern struct ExecBase *SysBase;
  85.  
  86. struct SuperViewBase *SuperViewBase = N;
  87.  
  88.  
  89. /* *************************************************** */
  90. /* *                             * */
  91. /* * MAIN                         * */
  92. /* *                             * */
  93. /* *************************************************** */
  94.  
  95. void main(long argc, char **argv)
  96. {
  97.  if(!argc) Leave(N, 0);
  98.  
  99.  if( argc > 3 || (argv[1][0] =='?')||(argv[2][0] =='?'))
  100.   {
  101.    K_Printf("%s%s%s", entry1_text, entry2_text, entry3_text);
  102.  
  103.    Leave(N, 0);
  104.   }
  105.  
  106.  SuperViewBase = (struct SuperViewBase *) OpenLibrary("superview.library", 6);
  107.  if(!SuperViewBase) Leave(svlib_text, 103);
  108.  
  109.  SVObjectInfo_Test();
  110.  SVDriverInfo_Test();
  111.  
  112.  Leave("\n", 0);
  113. }
  114.  
  115. void __regargs SVObjectInfo_Test(void)
  116. {
  117.  struct SVObjectInfo *pad;
  118.  struct SVObjectInfo *fpad;
  119.  
  120.  K_Printf("\n\nTesting SVObjectInfo functions :\n");
  121.  
  122.  if(!SVL_GetSVObjectList(&pad))
  123.   {
  124.    fpad = pad;
  125.  
  126.    while(pad)
  127.     {
  128.      K_Printf("\n %-24s (SubTypeCode : %2ld), Flags : 0x%lx", pad->soi_TypeName, pad->soi_Type, pad->soi_Flags);
  129.  
  130.      pad = pad->soi_NextEntry;
  131.     }
  132.  
  133.    if(fpad) SVL_FreeSVObjectList(fpad);
  134.   }
  135. }
  136.  
  137. void __regargs SVDriverInfo_Test(void)
  138. {
  139.  struct SVDriverInfo *pad;
  140.  struct SVDriverInfo *fpad;
  141.  
  142.  K_Printf("\n\nTesting SVDriverInfo functions :\n");
  143.  
  144.  if(!SVL_GetSVDriverList(&pad))
  145.   {
  146.    fpad = pad;
  147.  
  148.    while(pad)
  149.     {
  150.      K_Printf("\n %-24s, Flags : 0x%lx", pad->sdi_Name, pad->sdi_Flags);
  151.  
  152.      pad = pad->sdi_NextEntry;
  153.     }
  154.  
  155.    if(fpad) SVL_FreeSVDriverList(fpad);
  156.   }
  157. }
  158.  
  159. /* *************************************************** */
  160. /* *                             * */
  161. /* * LEAVE : Global Exit Function Replacement         * */
  162. /* *                             * */
  163. /* *************************************************** */
  164.  
  165. void __regargs Leave(char *endtext, long code)
  166. {
  167.  if(SuperViewBase) CloseLibrary((APTR) SuperViewBase);
  168.  
  169.  if(endtext)       K_Printf("%s\n", endtext);
  170.  
  171.  exit(code);
  172. }
  173.