[BACK]Return to extern.h CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / texi2mdoc

Diff for /texi2mdoc/extern.h between version 1.10 and 1.20

version 1.10, 2015/02/23 15:09:09 version 1.20, 2015/02/28 13:16:44
Line 17 
Line 17 
 #ifndef EXTERN_H  #ifndef EXTERN_H
 #define EXTERN_H  #define EXTERN_H
   
   #if !defined(__BEGIN_DECLS)
   #  ifdef __cplusplus
   #  define       __BEGIN_DECLS           extern "C" {
   #  else
   #  define       __BEGIN_DECLS
   #  endif
   #endif
   #if !defined(__END_DECLS)
   #  ifdef __cplusplus
   #  define       __END_DECLS             }
   #  else
   #  define       __END_DECLS
   #  endif
   #endif
   
 /*  /*
  * This defines each one of the Texinfo commands that we understand.   * This defines each one of the Texinfo commands that we understand.
  * Obviously this only refers to native commands; overriden names are a   * Obviously this only refers to native commands; overriden names are a
  * different story.   * different story.
  */   */
 enum    texicmd {  enum    texicmd {
           TEXICMD_A4PAPER,
           TEXICMD_AA,
           TEXICMD_AASMALL,
         TEXICMD_ACRONYM,          TEXICMD_ACRONYM,
         TEXICMD_ACUTE,          TEXICMD_ACUTE,
         TEXICMD_A4PAPER,          TEXICMD_AE,
           TEXICMD_AESMALL,
         TEXICMD_ANCHOR,          TEXICMD_ANCHOR,
         TEXICMD_APPENDIX,          TEXICMD_APPENDIX,
         TEXICMD_APPENDIXSEC,          TEXICMD_APPENDIXSEC,
Line 83  enum texicmd {
Line 102  enum texicmd {
         TEXICMD_DEFVRX,          TEXICMD_DEFVRX,
         TEXICMD_DETAILMENU,          TEXICMD_DETAILMENU,
         TEXICMD_DFN,          TEXICMD_DFN,
           TEXICMD_DH,
           TEXICMD_DHSMALL,
         TEXICMD_DIRCATEGORY,          TEXICMD_DIRCATEGORY,
         TEXICMD_DIRENTRY,          TEXICMD_DIRENTRY,
         TEXICMD_DISPLAY,          TEXICMD_DISPLAY,
         TEXICMD_DMN,          TEXICMD_DMN,
           TEXICMD_DOCUMENTDESCRPITION,
           TEXICMD_DOCUMENTENCODING,
           TEXICMD_DOCUMENTLANGUAGE,
           TEXICMD_DOTACCENT,
           TEXICMD_DOTLESS,
         TEXICMD_DOTS,          TEXICMD_DOTS,
         TEXICMD_EMAIL,          TEXICMD_EMAIL,
         TEXICMD_EMPH,          TEXICMD_EMPH,
Line 96  enum texicmd {
Line 122  enum texicmd {
         TEXICMD_ENV,          TEXICMD_ENV,
         TEXICMD_EQUIV,          TEXICMD_EQUIV,
         TEXICMD_ERROR,          TEXICMD_ERROR,
           TEXICMD_EURO,
         TEXICMD_EXAMPLE,          TEXICMD_EXAMPLE,
           TEXICMD_EXCLAMDOWN,
         TEXICMD_EXDENT,          TEXICMD_EXDENT,
         TEXICMD_EXPANSION,          TEXICMD_EXPANSION,
         TEXICMD_FILE,          TEXICMD_FILE,
         TEXICMD_FINALOUT,          TEXICMD_FINALOUT,
         TEXICMD_FINDEX,          TEXICMD_FINDEX,
           TEXICMD_FLUSHLEFT,
           TEXICMD_FLUSHRIGHT,
           TEXICMD_FIRSTPARAGRAPHINDENT,
         TEXICMD_FOOTNOTE,          TEXICMD_FOOTNOTE,
           TEXICMD_FOOTNOTESTYLE,
         TEXICMD_FTABLE,          TEXICMD_FTABLE,
         TEXICMD_FORMAT,          TEXICMD_FORMAT,
           TEXICMD_GEQ,
         TEXICMD_GRAVE,          TEXICMD_GRAVE,
         TEXICMD_GROUP,          TEXICMD_GROUP,
           TEXICMD_GUILLEMETLEFT,
           TEXICMD_GUILLEMETRIGHT,
           TEXICMD_GUILLEMOTLEFT,
           TEXICMD_GUILLEMOTRIGHT,
           TEXICMD_GUILSINGLLEFT,
           TEXICMD_GUILSINGLRIGHT,
           TEXICMD_H,
         TEXICMD_HEADING,          TEXICMD_HEADING,
         TEXICMD_HEADINGS,          TEXICMD_HEADINGS,
         TEXICMD_HEADITEM,          TEXICMD_HEADITEM,
Line 131  enum texicmd {
Line 171  enum texicmd {
         TEXICMD_IMAGE,          TEXICMD_IMAGE,
         TEXICMD_INCLUDE,          TEXICMD_INCLUDE,
         TEXICMD_INDENTBLOCK,          TEXICMD_INDENTBLOCK,
           TEXICMD_INDICATEURL,
         TEXICMD_INFOREF,          TEXICMD_INFOREF,
         TEXICMD_INSERTCOPYING,          TEXICMD_INSERTCOPYING,
         TEXICMD_ITEM,          TEXICMD_ITEM,
Line 139  enum texicmd {
Line 180  enum texicmd {
         TEXICMD_KBD,          TEXICMD_KBD,
         TEXICMD_KEY,          TEXICMD_KEY,
         TEXICMD_KINDEX,          TEXICMD_KINDEX,
           TEXICMD_L,
         TEXICMD_LATEX,          TEXICMD_LATEX,
           TEXICMD_LEQ,
         TEXICMD_LOWERSECTIONS,          TEXICMD_LOWERSECTIONS,
           TEXICMD_LSMALL,
         TEXICMD_MACRO,          TEXICMD_MACRO,
           TEXICMD_MACRON,
         TEXICMD_MATH,          TEXICMD_MATH,
         TEXICMD_MENU,          TEXICMD_MENU,
         TEXICMD_MINUS,          TEXICMD_MINUS,
Line 150  enum texicmd {
Line 195  enum texicmd {
         TEXICMD_NEWLINE,          TEXICMD_NEWLINE,
         TEXICMD_NODE,          TEXICMD_NODE,
         TEXICMD_NOINDENT,          TEXICMD_NOINDENT,
           TEXICMD_O,
           TEXICMD_OE,
           TEXICMD_OESMALL,
           TEXICMD_OGONEK,
         TEXICMD_OPTION,          TEXICMD_OPTION,
         TEXICMD_PXREF,          TEXICMD_ORDF,
         TEXICMD_QUESTIONMARK,          TEXICMD_ORDM,
         TEXICMD_QUOTATION,          TEXICMD_OSMALL,
         TEXICMD_PAGE,          TEXICMD_PAGE,
         TEXICMD_PARINDENT,          TEXICMD_PARINDENT,
         TEXICMD_PERIOD,          TEXICMD_PERIOD,
         TEXICMD_PINDEX,          TEXICMD_PINDEX,
           TEXICMD_POUNDS,
         TEXICMD_PRINTINDEX,          TEXICMD_PRINTINDEX,
           TEXICMD_PXREF,
           TEXICMD_QUESTIONDOWN,
           TEXICMD_QUESTIONMARK,
           TEXICMD_QUOTATION,
           TEXICMD_QUOTEDBLBASE,
           TEXICMD_QUOTEDBLLEFT,
           TEXICMD_QUOTEDBLRIGHT,
           TEXICMD_QUOTESINGLBASE,
           TEXICMD_QUOTELEFT,
           TEXICMD_QUOTERIGHT,
         TEXICMD_R,          TEXICMD_R,
         TEXICMD_RAISESECTIONS,          TEXICMD_RAISESECTIONS,
         TEXICMD_REF,          TEXICMD_REF,
         TEXICMD_REFILL,          TEXICMD_REFILL,
           TEXICMD_REGISTEREDSYMBOL,
         TEXICMD_RESULT,          TEXICMD_RESULT,
           TEXICMD_RINGACCENT,
         TEXICMD_SAMP,          TEXICMD_SAMP,
         TEXICMD_SANSSERIF,          TEXICMD_SANSSERIF,
         TEXICMD_SC,          TEXICMD_SC,
Line 201  enum texicmd {
Line 263  enum texicmd {
         TEXICMD_TABLE,          TEXICMD_TABLE,
         TEXICMD_TEX,          TEXICMD_TEX,
         TEXICMD_TEXSYM,          TEXICMD_TEXSYM,
           TEXICMD_TEXTDEGREE,
           TEXICMD_TH,
           TEXICMD_THSMALL,
         TEXICMD_TIE,          TEXICMD_TIE,
           TEXICMD_TIEACCENT,
         TEXICMD_TILDE,          TEXICMD_TILDE,
         TEXICMD_TINDEX,          TEXICMD_TINDEX,
         TEXICMD_TITLE,          TEXICMD_TITLE,
         TEXICMD_TITLEFONT,          TEXICMD_TITLEFONT,
         TEXICMD_TITLEPAGE,          TEXICMD_TITLEPAGE,
         TEXICMD_TOP,          TEXICMD_TOP,
           TEXICMD_U,
           TEXICMD_UBARACCENT,
           TEXICMD_UDOTACCENT,
         TEXICMD_UMLAUT,          TEXICMD_UMLAUT,
         TEXICMD_UNNUMBERED,          TEXICMD_UNNUMBERED,
         TEXICMD_UNNUMBEREDSEC,          TEXICMD_UNNUMBEREDSEC,
Line 216  enum texicmd {
Line 285  enum texicmd {
         TEXICMD_UREF,          TEXICMD_UREF,
         TEXICMD_URL,          TEXICMD_URL,
         TEXICMD_USER_INDEX,          TEXICMD_USER_INDEX,
           TEXICMD_V,
         TEXICMD_VALUE,          TEXICMD_VALUE,
         TEXICMD_VAR,          TEXICMD_VAR,
         TEXICMD_VERB,          TEXICMD_VERB,
Line 229  enum texicmd {
Line 299  enum texicmd {
         TEXICMD__MAX          TEXICMD__MAX
 };  };
   
   enum    texisrc {
           TEXISRC_FILE,
           TEXISRC_STDIN
   };
   
 /*  /*
  * The file currently being parsed.   * The file currently being parsed.
  * This keeps track of our location within that file.   * This keeps track of our location within that file.
  */   */
 struct  texifile {  struct  texifile {
           enum texisrc     type; /* type of file */
         const char      *name; /* name of the file */          const char      *name; /* name of the file */
         size_t           line; /* current line (from zero) */          size_t           line; /* current line (from zero) */
         size_t           col; /* current column in line (from zero) */          size_t           col; /* current column in line (from zero) */
         char            *map; /* mmap'd file */          char            *map; /* allocated file buffer */
         size_t           mapsz; /* size of mmap */          size_t           mapsz; /* size of map */
           size_t           mapmaxsz; /* full size of map */
           size_t           insplice; /* how many bytes left in splice */
           size_t           depth; /* pasted macro recursive depth */
 };  };
   
 struct  texi;  struct  texi;
Line 246  struct texi;
Line 325  struct texi;
 /*  /*
  * Callback for functions implementing texi commands.   * Callback for functions implementing texi commands.
  */   */
 typedef void (*texicmdfp)(struct texi *,  typedef void (*texicmdfp)(struct texi *, enum texicmd, size_t *);
         enum texicmd, const char *, size_t, size_t *);  
   
 /*  /*
  * Describes Texinfo commands, whether native or overriden.   * Describes Texinfo commands, whether native or overriden.
Line 258  struct texitok {
Line 336  struct texitok {
         size_t           len; /* strlen(tok) */          size_t           len; /* strlen(tok) */
 };  };
   
   /*
    * These values instruct us on whether a list (or table) of some type is
    * currently being parsed.
    */
 enum    texilist {  enum    texilist {
         TEXILIST_NONE = 0,          TEXILIST_NONE = 0,
         TEXILIST_ITEM,          TEXILIST_ITEM,
Line 265  enum texilist {
Line 347  enum texilist {
         TEXILIST_TABLE          TEXILIST_TABLE
 };  };
   
   /*
    * Hold values assigned with @set and retrieved with @value.
    * These values can contain arbitrary Texinfo.
    */
 struct  texivalue {  struct  texivalue {
         char            *key;          char            *key; /* the nil-terminated value name */
         char            *value;          char            *value; /* the nil-terminated value */
 };  };
   
   /*
    * Macros are (possibly-recursive) Texinfo sequences created with @macro
    * and filled in by arguments when invoked.
    */
 struct  teximacro {  struct  teximacro {
         char             *key;          char             *key; /* nil-terminated macro name */
         char             *value;          char             *value; /* nil-terminated value */
         char            **args;          char            **args; /* array of argument names (or NULL) */
         size_t            argsz;          size_t            argsz; /* array size */
 };  };
   
 /*  /*
Line 296  struct texi {
Line 386  struct texi {
         size_t            indexsz; /* entries in indexs */          size_t            indexsz; /* entries in indexs */
         struct texivalue *vals; /* @value entries */          struct texivalue *vals; /* @value entries */
         size_t            valsz; /* entries in vals */          size_t            valsz; /* entries in vals */
         struct teximacro *macros;          struct teximacro *macros; /* @macro entries */
         size_t            macrosz;          size_t            macrosz; /* entries in macros */
         /*          /*
          * The following control what we output to the screen.           * The following control what we output to the screen.
          * The complexity is required to accomodate for mdoc(7).           * The complexity is required to accomodate for mdoc(7).
Line 310  struct texi {
Line 400  struct texi {
         int               literal; /* if >0, literal context */          int               literal; /* if >0, literal context */
 };  };
   
   #define BUF(_p) ((_p)->files[(_p)->filepos - 1].map)
   #define BUFSZ(_p) ((_p)->files[(_p)->filepos - 1].mapsz)
   
 #define isws(_x) \  #define isws(_x) \
         (' ' == (_x) || '\t' == (_x))          (' ' == (_x) || '\t' == (_x))
 #define ismspace(_x) \  #define ismspace(_x) \
Line 317  struct texi {
Line 410  struct texi {
   
 __BEGIN_DECLS  __BEGIN_DECLS
   
 void    advance(struct texi *, const char *, size_t *);  void    advance(struct texi *, size_t *);
 size_t  advanceeoln(struct texi *, const char *, size_t, size_t *, int);  size_t  advanceeoln(struct texi *, size_t *, int);
 void    advanceto(struct texi *, const char *, size_t *, size_t);  void    advanceto(struct texi *, size_t *, size_t);
   
 char  **argparse(struct texi *, const char *, size_t, size_t *, size_t *, size_t);  char  **argparse(struct texi *, size_t *, size_t *, size_t);
   
 int     parsearg(struct texi *, const char *, size_t, size_t *, size_t);  int     parsearg(struct texi *, size_t *, size_t);
 void    parsebracket(struct texi *, const char *, size_t, size_t *);  void    parsebracket(struct texi *, size_t *, int);
   void    parsestdin(struct texi *);
 void    parsefile(struct texi *, const char *, int);  void    parsefile(struct texi *, const char *, int);
 int     parselinearg(struct texi *, const char *, size_t, size_t *);  int     parselinearg(struct texi *, size_t *);
 void    parseeof(struct texi *, const char *, size_t);  void    parseeoln(struct texi *, size_t *);
 void    parsemembuf(struct texi *, const char *, size_t);  void    parseto(struct texi *, size_t *, const char *);
 void    parseeoln(struct texi *, const char *, size_t, size_t *);  
 void    parsesingle(struct texi *, const char *, size_t, size_t *);  
 void    parseto(struct texi *, const char *, size_t, size_t *, const char *);  
   
 void    texiabort(struct texi *, const char *)  void    texiabort(struct texi *, const char *)
                 __attribute__((noreturn));                  __attribute__((noreturn));
 enum texicmd  enum texicmd
         texicmd(struct texi *, const char *, size_t, size_t,          texicmd(const struct texi *, size_t, size_t *, struct teximacro **);
                 size_t *, struct teximacro **);  enum texicmd
           peekcmd(const struct texi *, size_t);
 void    texierr(struct texi *, const char *, ...)  void    texierr(struct texi *, const char *, ...)
                 __attribute__((format(printf, 2, 3)))                  __attribute__((format(printf, 2, 3)))
                 __attribute__((noreturn));                  __attribute__((noreturn));
Line 346  void texifilepop(struct texi *);
Line 438  void texifilepop(struct texi *);
 void    teximacro(struct texi *, const char *);  void    teximacro(struct texi *, const char *);
 void    teximacroclose(struct texi *);  void    teximacroclose(struct texi *);
 void    teximacroopen(struct texi *, const char *);  void    teximacroopen(struct texi *, const char *);
 void    texipunctuate(struct texi *, const char *, size_t, size_t *);  void    texipunctuate(struct texi *, size_t *);
 void    texiputbuf(struct texi *p, const char *, size_t, size_t);  void    texiputbuf(struct texi *p, size_t, size_t);
 void    texiputchar(struct texi *p, char);  void    texiputchar(struct texi *p, char);
 void    texiputchars(struct texi *, const char *);  void    texiputchars(struct texi *, const char *);
 void    texivspace(struct texi *);  void    texivspace(struct texi *);
 void    texiwarn(const struct texi *, const char *, ...)  void    texiwarn(const struct texi *, const char *, ...)
                 __attribute__((format(printf, 2, 3)));                  __attribute__((format(printf, 2, 3)));
   void    texisplice(struct texi *, const char *, size_t, size_t *);
   
 void    valueadd(struct texi *, char *, char *);  void    valueadd(struct texi *, char *, char *);
 const char *  const char *
         valueblookup(struct texi *, const char *, size_t, size_t *);          valueblookup(struct texi *, size_t *);
 void    valuelclear(struct texi *, const char *, size_t, size_t *);  void    valuelclear(struct texi *, size_t *);
 const char *  const char *
         valuellookup(struct texi *, const char *, size_t, size_t *);          valuellookup(struct texi *, size_t *);
   
 extern  const struct texitok *const texitoks;  extern  const struct texitok *const texitoks;
   

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.20

CVSweb