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

  1. /* ======================================================================== */
  2. /* = Programmname    : ListSVDs V7.1                      = */
  3. /* =                                      = */
  4. /* ======================================================================== */
  5. /* = Autor/Copyright : (c) 1994 by Andreas R. Kleinert.                   = */
  6. /* =               All rights reserved.                  = */
  7. /* ======================================================================== */
  8. /* = Funktion         : Show available svdrivers of superview.library V3+. = */
  9. /* =                                                             = */
  10. /* ======================================================================== */
  11. /* = Letztes Update  : 15.7.1994                          = */
  12. /* =                                      = */
  13. /* ======================================================================== */
  14. /* = Bemerkungen     : "superview.library" V3+ needed.                    = */
  15. /* =                                      = */
  16. /* ======================================================================== */
  17. /* = Compiler         : SAS/C V6.51                        = */
  18. /* =               (smakefile)                                        = */
  19. /* ======================================================================== */
  20.  
  21. #include <superview/superviewbase.h>
  22. #include <svobjects/svobjectbase.h>
  23. #include <svdrivers/svdriverbase.h>
  24.  
  25. #include <proto/exec.h>
  26. #include <proto/dos.h>
  27. #include <proto/superview.h>
  28. #include <proto/svobjects.h>
  29. #include <proto/svdrivers.h>
  30.  
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34.  
  35.  
  36.    /* Help- and Info- Texts */
  37.  
  38. char entry1_text  [] = "\2331;32;40mListSVDs V7.1 \2330;32;40m\2333;32;40m(FREEWARE)\2330;32;40m\n(c) 1993 by Andreas Ralph Kleinert.\nAndreas R. Kleinert, Grube Hohe Grethe 23, D-57074 Siegen, Germany.\n";
  39. char entry2_text  [] = "Lists up available \42svobjects\42 of \42superview.library\42.\n";
  40. char entry3_text  [] = "USAGE : \2330;33;40mListSVDs\2330;31;40m\n";
  41.  
  42. char ver_text [] = "\0$VER: ListSVDs V7.1 (15.7.94)";
  43.  
  44.  
  45. /* *************************************************** */
  46. /* *                             * */
  47. /* * Error-Messages for Leave() and KF_Message()     * */
  48. /* *                             * */
  49. /* *************************************************** */
  50.  
  51. char svlib_text [] = "You need \42superview.library\42 V3+ !";
  52.  
  53.  
  54. /* *************************************************** */
  55. /* *                             * */
  56. /* * Function Declarations                 * */
  57. /* *                             * */
  58. /* *************************************************** */
  59.  
  60. void __regargs Leave(char *endtext, long code);
  61.  
  62.  
  63.    /* Functions from module "ListSVDs_Subs.o" : */
  64.  
  65. extern void __stdargs K_Printf(char *formatstring, ...);
  66.  
  67.  
  68. /* *************************************************** */
  69. /* *                             * */
  70. /* * Additional Base Declarations             * */
  71. /* *                             * */
  72. /* *************************************************** */
  73.  
  74. extern struct ExecBase *SysBase;
  75.  
  76. struct SuperViewBase *SuperViewBase = N;
  77.  
  78.  
  79. /* *************************************************** */
  80. /* *                             * */
  81. /* * MAIN                         * */
  82. /* *                             * */
  83. /* *************************************************** */
  84.  
  85. void main(long argc, char **argv)
  86. {
  87.  struct List           *drv_list = N;
  88.  struct SVD_DriverNode *svd_node = N;
  89.  
  90.  if(!argc) exit(0); /* started from WB ... */
  91.  
  92.  if( argc > 3 || (argv[1][0] =='?')||(argv[2][0] =='?'))
  93.   {
  94.    K_Printf("%s%s%s", entry1_text, entry2_text, entry3_text);
  95.  
  96.    Leave(N, 0);
  97.   }
  98.  
  99.  SuperViewBase = (struct SuperViewBase *) OpenLibrary("superview.library", 3);
  100.  if(!SuperViewBase) Leave(svlib_text, 100);
  101.  
  102.  K_Printf("\nList of available svdrivers :\n");
  103.  
  104.  drv_list = &SuperViewBase->svb_SVDriverList;
  105.  
  106.  for(svd_node=(APTR) drv_list->lh_Head;(svd_node)&&(svd_node!=(APTR) &(drv_list->lh_Tail));)
  107.   {
  108.    K_Printf("\n  --------------------------------------------------------");
  109.  
  110.    K_Printf("\nSVDriver : \42%s\42", svd_node->svd_FileName);
  111.    K_Printf("\nPriority : %ld",      (long) ((struct Node *)svd_node)->ln_Pri);
  112.    K_Printf("\nDriverID : \42%s\42", svd_node->svd_ID);
  113.    K_Printf("\nFlags    : ");
  114.  
  115.         if(svd_node->svd_Flags & SVDF_INTUITION) K_Printf("Intuition compatible");
  116.    else if(svd_node->svd_Flags & SVDF_FOREIGN)   K_Printf("Foreign display");
  117.    else                                          K_Printf("Unknown display");
  118.  
  119.    svd_node = (APTR) ((struct Node *)svd_node)->ln_Succ;
  120.   }
  121.  
  122.  K_Printf("\n  --------------------------------------------------------");
  123.  
  124.  K_Printf("\n\nCurrently selected Global Driver is : ");
  125.  
  126.  /* retval = */ SVL_GetGlobalDriver(&svd_node, N);
  127.  /* SuperViewBase->svb_GlobalDriver */
  128.  
  129.  if(svd_node) K_Printf("\42%s\42\n\n", svd_node->svd_ID);
  130.   else        K_Printf("- no Driver selected -\n\n");
  131.  
  132.  Leave(N, 0);
  133. }
  134.  
  135. /* *************************************************** */
  136. /* *                             * */
  137. /* * LEAVE : Global Exit Function Replacement         * */
  138. /* *                             * */
  139. /* *************************************************** */
  140.  
  141. void __regargs Leave(char *endtext, long code)
  142. {
  143.  if(SuperViewBase) CloseLibrary((APTR) SuperViewBase);
  144.  
  145.  if(endtext)       K_Printf("%s\n", endtext);
  146.  
  147.  exit(code);
  148. }
  149.