home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / extensions / PEX / SI / xref.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-15  |  3.4 KB  |  101 lines

  1. /* $XConsortium: xref.h,v 5.1 91/02/16 09:45:55 rws Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright (c) 1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Sun Microsystems,
  13. the X Consortium, and MIT not be used in advertising or publicity 
  14. pertaining to distribution of the software without specific, written 
  15. prior permission.  
  16.  
  17. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
  18. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 
  19. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  20. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27.  
  28. #define    FALSE    0
  29. #define    TRUE    1
  30.  
  31. /*
  32.  * Structure for a codeword entry
  33.  */
  34. struct    codeword_entry    {
  35.     int    entry_type;        /*  Type of entry  */
  36.     char    *codeword;        /*  Actual Codeword  */
  37.     char    *title;            /*  Text of Title  */
  38.     int    h1_counter;        /*  Chapter Level Counter  */
  39.     int    h2_counter;        /*  Section Level Counter  */
  40.     int    h3_counter;        /*  SubSection Level Counter  */
  41.     int    h4_counter;        /*  Paragraph Level Counter  */
  42.     int    h5_counter;        /*  SubParagraph Level Counter  */
  43.     int    table_number;        /*  Table Number  */
  44.     int    figure_number;        /*  Figure Number  */
  45.     int    appendix;        /*  TRUE if this is an appendix  */
  46.     int    page_number;        /*  Page Number (not yet available)  */
  47.     struct    codeword_entry    *lesser;/*  pointer to lesser number */
  48.     struct    codeword_entry    *greater;/*  pointer to greater number */
  49. };
  50.  
  51.                 /*  Codeword Types  */
  52. #define    HEADING        1
  53. #define    TABLE        2
  54. #define    FIGURE        3
  55. #define    CROSSREF    4
  56.                 /*  Phase of Processing  */
  57. #define    GATHER_REFERENCES    1
  58. #define    SUBSTITUTE_REFERENCES    2
  59.                 /*  Document Types  */
  60. #define    MINOR_SECTIONED    1
  61. #define    MAJOR_SECTIONED    2
  62.                 /*  Reference Types  */
  63. #define    NUMBER    1
  64. #define    TITLE    2
  65.                 /*  Instructions to the token reader  */
  66. #define    SKIP_SPACES    1
  67. #define    DONT_SKIP_SPACES    2
  68.                 /*  Types of tokens  */
  69. #define    SPACES_TOKEN    1
  70. #define    DELIMITER_TOKEN    2
  71. #define    STRING_TOKEN    3
  72. #define    ALPHA_TOKEN    4
  73. #define    NUMBER_TOKEN    5
  74. #define    ENDOFLINE_TOKEN    6
  75.  
  76. FILE    *current_file;        /*  Current input file  */
  77. char    *current_filename;    /*  Name of current input file  */
  78. int    line_number;        /*  Line number in current file  */
  79. int    document_type;        /*  Major Sectioned or Minor Sectioned  */
  80. char    *command_name;        /*  Name of command  */
  81. struct codeword_entry    *previous_codeword_entry;
  82.  
  83. #define MAXLINE    512
  84.  
  85. #define SPACE    ' '
  86. #define TAB    '\t'
  87.  
  88. #define    strdup(str)    strcpy(malloc(strlen(str) + 1), str)
  89. #define new(type)    (type *) calloc(sizeof(type), 1)
  90. #define exists(arg)    (strcmp(arg, "") != 0)
  91.  
  92. char    *malloc();
  93. char    *calloc();
  94. char    *strcpy();
  95. char    get_char();
  96. char    *get_field();
  97. char    *skipspace();
  98. struct codeword_entry    *build_codeword_entry();
  99. struct codeword_entry    *insert_codeword_entry();
  100. struct codeword_entry    *locate_codeword_entry();
  101.