home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / misc / xref_v1.1.lha / XRef / include / libraries / xref.h
Encoding:
C/C++ Source or Header  |  1994-09-22  |  12.8 KB  |  347 lines

  1. #ifndef LIBRARIES_XREF_H
  2. #define LIBRARIES_XREF_H
  3. /* xref.library
  4. **
  5. ** $VER: xref.h 1.10 (22.09.94) 
  6. **
  7. ** by
  8. **
  9. ** Stefan Ruppert , Windthorststraße 5 , 65439 Flörsheim , GERMANY
  10. **
  11. ** (C) Copyright 1994
  12. ** All Rights Reserved !
  13. **
  14. */
  15.  
  16. #ifndef UTILITY_TAGITEM_H
  17. #include <utility/tagitem.h>
  18. #endif
  19.  
  20. struct XRefFileNode
  21. {
  22.    /* node to link all xreffile into a list !
  23.     * Note ln_Name and ln_Pri are valid for now, but please use the
  24.     * appropriate set/get calls to read or manipulate it. But you can
  25.     * use this node to display the name in a gadtools listview.
  26.     */
  27.    struct Node xrfn_Node;
  28.  
  29.    /* data beyond this point are strictly private !!! */
  30. };
  31.  
  32. /* handle for xreffile creation functions !!! */
  33.  
  34. struct XRefFileHandle
  35. {
  36.    void *xrfh_PRIVATE;
  37. };
  38.  
  39. /* ------------------------- type of a given XRef ------------------------- */
  40.  
  41. /* Note : the following defines are compatible with the amigaguide xref 
  42.  *        defines. For future it is planed to make a tool , that converts
  43.  *        amigaguide xref files to xref.library xref files !
  44.  */
  45.  
  46. /* cross reference types */
  47.  
  48. #define XREFT_GENERIC          0     /* a amigaguide node name */
  49. #define XREFT_FUNCTION         1     /* a library function name */
  50. #define XREFT_COMMAND          2     /* a device command name */
  51. #define XREFT_INCLUDE          3     /* a include file name */
  52. #define XREFT_MACRO            4     /* a macro defiiniton name */
  53. #define XREFT_STRUCT           5     /* a structure definition name */
  54. #define XREFT_FIELD            6     /* a structure field name */
  55. #define XREFT_TYPEDEF          7     /* a type definition name */
  56. #define XREFT_DEFINE           8     /* a simple define name */
  57.  
  58. #define XREFT_MAXTYPES         9     /* max number of types internal use */
  59.  
  60. #define XREFT_USER             63    /* indicate, that this is a user defined
  61.                                       * xrefentry ! This can only be parsed
  62.                                       * with a XREFA_CustomHook !
  63.                                       */
  64.  
  65. /* ------------------- tags for all xref.library calls -------------------- */
  66.  
  67. /* the letters in the parenthesis have the following meaning :
  68.  *
  69.  * C - can be used by a call to CreateXRefFileA()
  70.  * L - can be used by a call to XR_LoadXRef()
  71.  * E - can be used by a call to XR_ExpungeXRef()
  72.  * G - can be used by a call to GetXRefFileAttrsA()
  73.  * S - can be used by a call to SetXRefFileAttrsA()
  74.  * P - can be used by a call to ParseXRef()
  75.  * M - can be in the PM_XREF message attribute list
  76.  */
  77.  
  78. #define XREFA_Base      (TAG_USER + 0x11000)
  79.  
  80. #define XREFA_Lock      (XREFA_Base + 0x01)
  81.                         /* (LEGS) (ULONG)
  82.                          * one of two possible values
  83.                          * XREF_LOCK : locks this xref this isn't free'd
  84.                          *     during a memory flush
  85.                          *
  86.                          * XREF_UNLOCK : unlocks a locked xref file
  87.                          */
  88.  
  89. #define XREFA_Category  (XREFA_Base + 0x02)
  90.                         /* (CLEGP) (STRPTR) category for a xref file */
  91.  
  92. #define XREFA_Priority  (XREFA_Base + 0x03)
  93.                         /* (CLGS) (BYTE) priority of a xref memory node */
  94.  
  95. #define XREFA_CustomHook (XREFA_Base + 0x04)
  96.                         /* (LS) (struct Hook *) callback function to handle
  97.                          * XREFT_USER xrefentries !
  98.                          * Not implemented yet !
  99.                          */
  100.  
  101. #define XREFA_XRefHook  (XREFA_Base + 0x05)
  102.                         /* (LEP) (struct Hook *) hook function, which is called,
  103.                          * for expunging or loading a xreffile. Or if a xrefentry
  104.                          * matches the given pattern in ParseXRef().
  105.                          * This tag is REQUIRED for the ParseXRef() call.
  106.                          */
  107.  
  108. #define XREFA_Matching  (XREFA_Base + 0x06)
  109.                         /* (P) (ULONG) matching mode for ParseXRef() see
  110.                          * XREFMATCH_#? below
  111.                          */
  112.  
  113. #define XREFA_Limit     (XREFA_Base + 0x07)
  114.                         /* (P) (ULONG) maximale number of matching xref 
  115.                          * entries
  116.                          */
  117.  
  118. #define XREFA_File      (XREFA_Base + 0x08)
  119.                         /* (CLEP) (STRPTR) complete filename for the xref file
  120.                          * to load or change attributes (comparison with Lock())
  121.                          */
  122.  
  123. #define XREFA_Name      (XREFA_Base + 0x09)
  124.                         /* (CLEGM) (STRPTR) name of the xref file, use this name
  125.                          * instead of the filename
  126.                          */
  127.  
  128. #define XREFA_VersTag   (XREFA_Base + 0x0A)
  129.                         /* (CG) (ULONG) AmigaDOS version string for the
  130.                          * xreffile
  131.                          */
  132.  
  133. #define XREFA_Author    (XREFA_Base + 0x0B)
  134.                         /* (CG) Author of xref file */
  135.  
  136. #define XREFA_Path      (XREFA_Base + 0x0C)
  137.                         /* (CGM) global path of xref file */
  138.  
  139. #define XREFA_Index     (XREFA_Base + 0x0D)
  140.                         /* (LGS) (BOOL) if TRUE, tries to create an index
  141.                          * array to get fast access to all entries. Otherwise
  142.                          * it removes all memory used by the array.
  143.                          * If the array is successfully allocated each
  144.                          * ParseXRef() uses a binary search algorithm !!!
  145.                          */
  146.  
  147. #define XREFA_Length    (XREFA_Base + 0x0E)
  148.                         /* (G) (ULONG) returns the number of bytes allocated
  149.                          * for this xreffile !
  150.                          */
  151.  
  152. #define XREFA_RejectTypes (XREFA_Base + 0x0F)
  153.                         /* (P) (ULONG *) ~0 terminated array of types, which
  154.                          * should not be used. Thus you can exclude some xref-
  155.                          * types (such as XREFT_TYPEDEF perhaps).
  156.                          */
  157.  
  158. #define XREFA_AcceptTypes (XREFA_Base + 0x10)
  159.                         /* (P) (ULONG *) ~0 terminated array of types, which
  160.                          * should be used explicitly. If this tag isn't set
  161.                          * all types are used !
  162.                          */
  163.  
  164. #define XREFA_CategoryParsed (XREFA_Base + 0x11)
  165.                         /* (P) (STRPTR) pointer to an tokenized pattern
  166.                          * string after using ParsePattern(). If you call
  167.                          * the ParseXRef() function a lot with the same
  168.                          * pattern you can ParsePattern() before and call
  169.                          * with this tag. This will speed up the parsing !
  170.                          */
  171.  
  172. #define XREFA_AutoLoad     (XREFA_Base + 0x12)
  173.                         /* (P) (BOOL) enables (TRUE) , disables (FALSE) 
  174.                          * the autoload mechanism
  175.                          */
  176.  
  177. /* tags for the WriteXRefFileEntry() function and in the PM_XREF
  178.  * attribute list
  179.  */
  180.  
  181. #define ENTRYA_Base     (TAG_USER + 0x12000)
  182.  
  183. #define ENTRYA_Type     (ENTRYA_Base + 0x01)
  184.                         /* (ULONG) type of the entry */
  185.  
  186. #define ENTRYA_File     (ENTRYA_Base + 0x02)
  187.                         /* (STRPTR) file, in which the entry resides */
  188.  
  189. #define ENTRYA_Name     (ENTRYA_Base + 0x03)
  190.                         /* (STRPTR) name of the entry */
  191.  
  192. #define ENTRYA_Line     (ENTRYA_Base + 0x04)
  193.                         /* line of the entry */
  194.  
  195. #define ENTRYA_NodeName (ENTRYA_Base + 0x05)
  196.                         /* name of the amigaguide node in the ENTRYA_File */
  197.  
  198. #define ENTRYA_CheckMode (ENTRYA_Base + 0x06)
  199.                         /* one of the ENTRYCHECK_#? modes
  200.                          * default is : ENTRYCHECK_NAME 
  201.                          */
  202.  
  203. #define ENTRYCHECK_NONE 0
  204. #define ENTRYCHECK_NAME 1
  205. #define ENTRYCHECK_FILE 2
  206.  
  207. /* --------- modes for the XRefParse function (XREFA_Matching tag)--------- */
  208.  
  209. #define XREFMATCH_PATTERN_CASE       0 
  210.                         /* matching done with
  211.                          * ParsePattern()/MatchPattern()
  212.                          */
  213. #define XREFMATCH_PATTERN_NOCASE     1
  214.                         /* matching done with
  215.                          * ParsePatternNoCase()/MatchPatternNoCase()
  216.                          */
  217. #define XREFMATCH_COMPARE_CASE       2
  218.                         /* compare with strcmp() */
  219. #define XREFMATCH_COMPARE_NOCASE     3
  220.                         /* compare with Stricmp() */
  221. #define XREFMATCH_COMPARE_NUM_CASE   4
  222.                         /* compare with strncmp(string,xrefentry,strlen(string)) */
  223. #define XREFMATCH_COMPARE_NUM_NOCASE 5
  224.                         /* compare with Strnicmp(string,xrefentry,strlen(string)) */
  225.  
  226.  
  227. /* ------------------------ values for XREFA_Lock ------------------------- */
  228.  
  229. #define XREF_UNLOCK                  0
  230.                         /* a xref is unlocked, if a memory flush occurs
  231.                          * all xref nodes with XREF_UNLOCK set are flushed
  232.                          */
  233.  
  234. #define XREF_LOCK                    1
  235.                         /* a xref is locked, can't be free'd during memory
  236.                          * flush or a normal XRefExpunge. It must be free'd
  237.                          * with XRefExpunge set the XREFA_Lock attribute to
  238.                          * XREF_UNLOCK !
  239.                          */
  240.  
  241. /* -------------------- global xref.library attributes -------------------- */
  242.  
  243. /* tags for the GetXRefBaseAttrsA() and SetXRefBaseAttrsA() call
  244.  * the letters in the parenthesis means :
  245.  * G - available for the GetXRefBaseAttrsA() call
  246.  * S - availbale for the SetXRefBaseAttrsA() call
  247.  *
  248.  */
  249.  
  250. #define XREFBA_Base               (TAG_USER + 0x12000)
  251.  
  252. #define XREFBA_List               (XREFBA_Base + 0x01)
  253.                         /* (G) (struct List *)
  254.                          * returns a pointer of the global xreffiles list.
  255.                          * Ths list contains all xreffiles in memory with
  256.                          * (struct XRefFileNode *) declared above.
  257.                          * Note you must lock the base if you step through
  258.                          * the list !! The entries in the list are private !!
  259.                          * You can get information about the Nodes with the
  260.                          * GetXRefFileAttrsA() call.
  261.                          * Only the name and pri field of the Node are valid.
  262.                          */
  263.  
  264. #define XREFBA_LineLength         (XREFBA_Base + 0x02)
  265.                         /* (GS) (UWORD)
  266.                          * number of characters for a line in the dynamic
  267.                          * node.
  268.                          */
  269.  
  270. #define XREFBA_Columns            (XREFBA_Base + 0x03)
  271.                         /* (GS) (UWORD)
  272.                          * number of columns for the dynamic node to use
  273.                          */
  274.  
  275. #define XREFBA_DefaultLimit       (XREFBA_Base + 0x04)
  276.                         /* (GS) (ULONG)
  277.                          * default maximal number of xref entries for the
  278.                          * ParseXRef() function. This value will be over-
  279.                          * written, if the tag XREFA_Limit is specified
  280.                          * for the ParseXRef() call.
  281.                          */
  282.  
  283. #define XREFBA_XRefDir            (XREFBA_Base + 0x05)
  284.                         /* (GS) (STRPTR)
  285.                          * the dir to hold all xref files. This dir is used to
  286.                          * create or open a xref file.If a xref file should be
  287.                          * created via the CreateXRefFileA() call,this call
  288.                          * tries to create the file in <XREFBA_XRefDir> by
  289.                          * using this directory as the current directory. Thus
  290.                          * you have to specify only the filename!
  291.                          */
  292.  
  293. /* ------------------------------- ParseMsg ------------------------------- */
  294.  
  295. #define XRM_XREF           1
  296. #define XRM_CUSTOMXREF     2
  297. #define XRM_EXPUNGE        3
  298. #define XRM_LOAD           4
  299.  
  300. /* the hook is called in the standard AmigaOS 2.0 way.See utility/hook.h
  301.  * for more detail !
  302.  *
  303.  * For all Messages the object is a pointer to an XRefFileNode structure :
  304.  * (struct XRefFileNode *) !
  305.  */
  306.  
  307. /* XRM_XREF */
  308. struct xrmXRef
  309. {
  310.    ULONG Msg;                 /* message for the CallBack Hook , only XRM_#?
  311.                                * are defined at the moment
  312.                                */
  313.  
  314.    struct TagItem *xref_Attrs; /* attributes of the xref entry */
  315. };
  316.  
  317. /* XRM_CUSTOMXREF */
  318. struct xrmCustomXRef
  319. {
  320.    ULONG Msg;
  321.    APTR  XRefEntry;           /* pointer to the custom xrefentry, if you return
  322.                                * from the hook with TRUE, you must provide here
  323.                                * the pointer to the next entry !
  324.                                * If you return with FALSE, the parsing is
  325.                                * aborted !
  326.                                */
  327. };
  328.  
  329. /* XRM_EXPUNGE */
  330. struct xrmExpunge
  331. {
  332.    ULONG Msg;
  333.  
  334.    struct TagItem *exp_Attrs;
  335. };
  336.  
  337. /* XRM_LOAD */
  338. struct xrmLoad
  339. {
  340.    ULONG Msg;
  341.  
  342.    struct TagItem *l_Attrs;
  343. };
  344.  
  345. #endif /* LIBRARIES_XREF_H */
  346.  
  347.