home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / DOCJET.ZIP / data.z / Source File Scanner.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-29  |  4.7 KB  |  146 lines

  1. /* Copyright (C) 1997-1998, Tall Tree Software Co.
  2.  *
  3.  * This code is provided AS-IS, with no warranty expressed or implied.
  4.  *  in no way shall Tall Tree Software Co. be held liable for damages
  5.  *  brought about by the use of this software.
  6.  */
  7.  
  8. #ifndef Source_File_Scanner_h
  9. #define Source_File_Scanner_h
  10.  
  11. /*
  12.  
  13.    For detailed information about how to use the stuff in here, you
  14. should refer to the on-line help.  The place to go within the help is
  15. the topic titled "Source File Scanner DLL's".  You can find it by
  16. opening the on-line help to the "Contents" tab.  Open the book
  17. titled "DocJet Plug-Ins" and select the topic labeled "Source File
  18. Scanner DLL's".
  19.  
  20.     A quickie version follows.  You need to define a DLL that
  21. exports functions with these prototypes:
  22.  
  23.   extern "C" DLLEXPORT const Subtype *GetAllSubtypes()
  24.   extern "C" DLLEXPORT void ScanSource( const char *sourceFile,
  25.                     ObjectReportFunction f )
  26.  
  27.     GetAllSubtypes will be called once by both the generator and
  28. editors, it should return a series of Subtype objects, terminated
  29. by one with 0 for its fullname.  ScanSource will only be called
  30. by the generator
  31.  
  32.     You can also write a function that implements this interface:
  33.  
  34.   extern "C" DLLEXPORT void ScanComplete( ObjectReportFunction f )
  35.  
  36. It will be called by the generator when all files of your DLL's file
  37. type have been scanned.  (That is, when it knows that it will never
  38. call your ScanSource function again.)
  39.  
  40.     Your DLL's resource script should include two string-table
  41. entries, like so:
  42.  
  43. STRINGTABLE DISCARDABLE
  44. BEGIN
  45.     IDS_FILE_TYPE_EXTENSIONS "*.gls"
  46.     IDS_FILE_TYPE_NAME      "Glossary Source"
  47. END
  48.  
  49. Where IDS_FILE_TYPE_EXTENSIONS is defined to 1004 and
  50. IDS_FILE_TYPE_NAME is defined to 1005.
  51.  
  52. */
  53.  
  54. #ifndef DLLEXPORT
  55. #define DLLEXPORT _declspec(dllexport)
  56. #define DLLIMPORT _declspec(dllimport)
  57. #endif
  58.  
  59. enum RoughType {
  60.     ABSTRACT_ID = 0,    // Use this for rough-types that are
  61.                 //   used as groups, and never have
  62.                 //   instances.
  63.     TYPEDEF_ID = 't',
  64.     MACRO_ID = 'm',
  65.     FUNCTION_ID= 'f',
  66.     VARIABLE_ID = 'v',    // Also variables & constants
  67.     CLASS_ID = 'c',        // Also namespaces and other things
  68.                 //  that contain other objects
  69.     PAPER_ID = 'p',        // Only for "raw" objects
  70.     ARGUMENT_ID = 'a',    // Arguments to functions, macros, templates, etc.
  71.     GLOSSARY_TERM_ID = 'w'
  72. };
  73.  
  74. struct Subtype {
  75.     const Subtype *generalization; // Or 0 if none
  76.     const char *fullname;
  77.     RoughType roughType;
  78. };
  79.  
  80. extern "C" void SyntaxError( const char *file, int line, const char *fmt, ... );
  81.  
  82. typedef void (*ObjectReportFunction)( const char *sourceFile,
  83.                       unsigned int commentStartLine,
  84.                       unsigned int declStartLine,
  85.                       const char *objectName,
  86.                       const Subtype &subtype,
  87.                       const char *superclass,
  88.                       const char *declaration,
  89.                       const char *comment,
  90.                       const char *body,
  91.                       /* Pairs of const char *, const char *,
  92.                        * followed by a 0 */
  93.                       ... );
  94.  
  95. typedef char *(*CustomGeneratorFunction)
  96.             ( char *(*doSubstitutions)( const char *in ),
  97.               const char *assignedTag, const char *title,
  98.               const char *body );
  99.  
  100. #define FILE_TYPE_ICON_RESOURCE_ID 1003
  101. #define FILE_TYPE_EXTENSIONS_RESOURCE_ID 1004
  102. #define FILE_TYPE_NAME_RESOURCE_ID 1005
  103.  
  104.  
  105. /*
  106.  * The "ATTR_" macros are attributes (used in the "extras" parameter).
  107.  * Obviously, you can pass any name you want.  What we are trying to do
  108.  * here is establish some conventions, at least for the generally used
  109.  * attributes.  "AV_" macros are possible values for the attributes.
  110.  */
  111.  
  112. #define ATTR_IMPLEMENTS "implements"
  113. #define ATTR_EVENT_SOURCES "event_sources"
  114. #define ATTR_DEFAULT_INTERFACE "default_interface"
  115. #define ATTR_SUPERCLASSES "superclasses"
  116. #define ATTR_SUBCLASSES "subclasses"
  117. #define ATTR_ORDER_IN_CODE "orderInCode"
  118. #define ATTR_OTHER_CONTEXTS "otherContexts"
  119. #define ATTR_ACCESS "security"
  120. #define AV_PUBLIC "public"
  121. #define AV_PRIVATE "private"
  122. #define AV_PROTECTED "protected"
  123. #define ATTR_TYPE "type"
  124. #define ATTR_ARGDIR "argdir"
  125. #define AV_ARGDIR_BYVAL "input"
  126. #define AV_ARGDIR_BYREF "output"
  127. #define AV_ARGDIR_RETVAL "retval"
  128. #define ATTR_DEFAULT_VALUE "default"
  129. #define AV_DEFVAL_OPTIONAL "null"
  130. #define ATTR_VIRTUAL "virtual"
  131. #define ATTR_NAMESPACE_ALIAS "alias_of"
  132. #define ATTR_FINAL "final"
  133. #define AV_TRUE "true"
  134. #define AV_FALSE "false"
  135. #define ATTR_ABSTRACT "abstract"
  136. #define ATTR_IMPORTS "imports"
  137. #define ATTR_TRANSIENT "transient"
  138. #define ATTR_VOLATILE "volatile"
  139. #define ATTR_SYNCHRONIZED "synchronized"
  140. #define ATTR_THROWS "throws"
  141. #define ATTR_STATIC "static"
  142. #define ATTR_DEFAULT_GROUP "defaultGroup"
  143. #define ATTR_LIBRARY "library"
  144.  
  145.  
  146. #endif