home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / viewer / SuperView-Lib.LHA / superview-lib / Programmers / Example_Tools / ListSVOs / ListSVOs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-10  |  5.2 KB  |  156 lines

  1. /* ======================================================================== */
  2. /* = Programmname    : ListSVOs V7.1                      = */
  3. /* =                                      = */
  4. /* ======================================================================== */
  5. /* = Autor/Copyright : (c) 1993-94 by Andreas R. Kleinert.                = */
  6. /* =               All rights reserved.                  = */
  7. /* ======================================================================== */
  8. /* = Funktion         : Show available svobjects of superview.library.     = */
  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.  
  24. #include <proto/exec.h>
  25. #include <proto/dos.h>
  26. #include <proto/superview.h>
  27.  
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <string.h>
  31.  
  32.  
  33.    /* Help- and Info- Texts */
  34.  
  35. char entry1_text  [] = "\2331;32;40mListSVOs 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";
  36. char entry2_text  [] = "Lists up available \42svobjects\42 of \42superview.library\42.\n";
  37. char entry3_text  [] = "USAGE : \2330;33;40mListSVOs\2330;31;40m\n";
  38.  
  39. char ver_text [] = "\0$VER: ListSVOs V7.1 (15.7.94)";
  40.  
  41.  
  42. /* *************************************************** */
  43. /* *                             * */
  44. /* * Error-Messages for Leave() and KF_Message()     * */
  45. /* *                             * */
  46. /* *************************************************** */
  47.  
  48. char svlib_text [] = "You need \42superview.library\42 V3+ !";
  49.  
  50.  
  51. /* *************************************************** */
  52. /* *                             * */
  53. /* * Function Declarations                 * */
  54. /* *                             * */
  55. /* *************************************************** */
  56.  
  57. void __regargs Leave(char *endtext, long code);
  58.  
  59.  
  60.    /* Functions from module "ListSVOs_Subs.o" : */
  61.  
  62. extern void __stdargs K_Printf(char *formatstring, ...);
  63.  
  64.  
  65. /* *************************************************** */
  66. /* *                             * */
  67. /* * Additional Base Declarations             * */
  68. /* *                             * */
  69. /* *************************************************** */
  70.  
  71. extern struct ExecBase *SysBase;
  72.  
  73. struct SuperViewBase *SuperViewBase = N;
  74.  
  75.  
  76. /* *************************************************** */
  77. /* *                             * */
  78. /* * MAIN                         * */
  79. /* *                             * */
  80. /* *************************************************** */
  81.  
  82. void main(long argc, char **argv)
  83. {
  84.  struct List           *obj_list = N;
  85.  struct SVO_ObjectNode *svo_node = N;
  86.  long i;
  87.  
  88.  if(!argc) exit(0); /* started from WB ... */
  89.  
  90.  if( argc > 3 || (argv[1][0] =='?')||(argv[2][0] =='?'))
  91.   {
  92.    K_Printf("%s%s%s", entry1_text, entry2_text, entry3_text);
  93.  
  94.    Leave(N, 0);
  95.   }
  96.  
  97.  SuperViewBase = (struct SuperViewBase *) OpenLibrary("superview.library", 3);
  98.  if(!SuperViewBase) Leave(svlib_text, 100);
  99.  
  100.  K_Printf("\nList of available svobjects :");
  101.  
  102.  obj_list = &SuperViewBase->svb_SVObjectList;
  103.  
  104.  for(svo_node=(APTR) obj_list->lh_Head;(svo_node)&&(svo_node!=(APTR) &(obj_list->lh_Tail));)
  105.   {
  106.    K_Printf("\n\n");
  107.  
  108.    K_Printf("\nSVObject : \42%s\42", svo_node->svo_FileName);
  109.    K_Printf("\nsvo-Type : %lx",      svo_node->svo_ObjectType);
  110.    K_Printf("\nPriority : %ld",      (long) ((struct Node *)svo_node)->ln_Pri);
  111.    K_Printf("\nTypeID   : \42%s\42", svo_node->svo_TypeID);
  112.    K_Printf("\nTypeCode : %ld",      svo_node->svo_TypeCode);
  113.  
  114.    for(i=0; i<svo_node->svo_SubTypeNum; i++)
  115.     {
  116.      K_Printf("\n\n%ld. SubType     :", i+1);
  117.      K_Printf("\n   SubTypeID   : \42%s\42", svo_node->svo_SubTypeID[i]);
  118.      K_Printf("\n   SubTypeCode : %ld",      svo_node->svo_SubTypeCode[i]);
  119.     }
  120.  
  121.    if(svo_node->svo_Version > 1)
  122.     {
  123.      K_Printf("\n\nFlags    :");
  124.  
  125.      if(svo_node->svo_Flags & SVO_FLAG_READS_TO_BUFFER)    K_Printf(" file->buffer");
  126.      if(svo_node->svo_Flags & SVO_FLAG_READS_TO_SCREEN)    K_Printf(" file->screen");
  127.      if(svo_node->svo_Flags & SVO_FLAG_WRITES_FROM_BUFFER) K_Printf(" buffer->file");
  128.      if(svo_node->svo_Flags & SVO_FLAG_WRITES_FROM_SCREEN) K_Printf(" screen->file");
  129.      if(svo_node->svo_Flags & SVO_FLAG_SUPPORTS_SVDRIVER)  K_Printf(" svdriver?");
  130.      if(svo_node->svo_Flags & SVO_FLAG_NEEDS_SVDRIVER)     K_Printf(" svdriver!");
  131.  
  132.     }else K_Printf("\n\nNo flag field found (Version 1 SVObject)");
  133.  
  134.    svo_node = (APTR) ((struct Node *)svo_node)->ln_Succ;
  135.   }
  136.  
  137.  K_Printf("\n\nNo more svobjects available.\n\n");
  138.  
  139.  Leave(N, 0);
  140. }
  141.  
  142. /* *************************************************** */
  143. /* *                             * */
  144. /* * LEAVE : Global Exit Function Replacement         * */
  145. /* *                             * */
  146. /* *************************************************** */
  147.  
  148. void __regargs Leave(char *endtext, long code)
  149. {
  150.  if(SuperViewBase) CloseLibrary((APTR) SuperViewBase);
  151.  
  152.  if(endtext)       K_Printf("%s\n", endtext);
  153.  
  154.  exit(code);
  155. }
  156.