home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / smapp100.zip / sm10.zip / smg.h < prev    next >
Text File  |  2000-05-14  |  39KB  |  1,089 lines

  1. /* ------------------------------------------------------------------------
  2.  *
  3.  *        File: smg.h
  4.  *     Project: Source Mapper.
  5.  *     Created: Mai 28, 1992.
  6.  * Description: Project header.
  7.  *
  8.  * Copyright (C) 2000 Leif-Erik Larsen.
  9.  * This file is part of the Source Mapper source package.
  10.  * Source Mapper is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published
  12.  * by the Free Software Foundation, in version 2 as it comes in the
  13.  * "COPYING" file of the XWorkplace main distribution.
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * ------------------------------------------------------------------------ */
  20.  
  21.  
  22.  
  23.  
  24. #ifndef __SMG_H__
  25. #define __SMG_H__
  26.  
  27.  
  28.  
  29.  
  30. #ifdef __OS2__
  31. #define INCL_DOSERRORS       /* NO_ERROR, ... */
  32. #define INCL_DOS             /* Dos API */
  33. #define INCL_VIO             /* Vio API */
  34. #include <os2.h>
  35. #endif
  36.  
  37.  
  38.  
  39.  
  40. /* ------------------------------------------------------------------------ */
  41. #if __IBMC__ || __IBMCPP__ /* If compiler is IBM Visual Age C++ */
  42.  
  43. #include <io.h>
  44. #include <time.h>
  45. #include <ctype.h>
  46. #include <errno.h>
  47. #include <stdio.h>
  48. #include <stdlib.h>
  49. #include <stdarg.h>
  50. #include <string.h>
  51. #include <signal.h>
  52. #include <conio.h>
  53. #include <direct.h>
  54.  
  55. #define MAXPATH  256
  56. #define MAXDRIVE 3
  57. #define MAXDIR   256
  58. #define MAXFILE  256
  59. #define MAXEXT   256
  60.  
  61. #define WILDCARDS 0x01
  62. #define EXTENSION 0x02
  63. #define FILENAME  0x04
  64. #define DRIVE     0x08
  65. #define DIRECTORY 0x10
  66.  
  67. #define DIRSPLITCHR '\\'
  68. #define DIRSPLITSTR "\\"
  69.  
  70. #define _cdecl
  71.  
  72. /* ------------------------------------------------------------------------ */
  73. #elif __BORLANDC__ /* If compiler is Borland C++ */
  74.  
  75. #include <io.h>
  76. #include <dir.h>
  77. #include <dos.h>
  78. #include <time.h>
  79. #include <ctype.h>
  80. #include <errno.h>
  81. #include <stdio.h>
  82. #include <stdlib.h>
  83. #include <stdarg.h>
  84. #include <string.h>
  85. #include <signal.h>
  86. #include <conio.h>
  87. #include <alloc.h>
  88.  
  89. #define DIRSPLITCHR '\\'
  90. #define DIRSPLITSTR "\\"
  91.  
  92. /* ------------------------------------------------------------------------ */
  93. #elif __GNUC__     /* If compiler is GNU C/C++ */
  94.  
  95. #include <io.h>
  96. #include <dir.h>
  97. #include <dos.h>
  98. #include <time.h>
  99. #include <ctype.h>
  100. #include <errno.h>
  101. #include <stdio.h>
  102. #include <stdlib.h>
  103. #include <stdarg.h>
  104. #include <string.h>
  105. #include <signal.h>
  106. #include <gppconio.h>
  107.  
  108. #ifdef __MSDOS__
  109. #  define MAXPATH  80
  110. #  define MAXDRIVE 3
  111. #  define MAXDIR   66
  112. #  define MAXFILE  9
  113. #  define MAXEXT   5
  114. #else
  115. #  define MAXPATH  256
  116. #  define MAXDRIVE 3
  117. #  define MAXDIR   256
  118. #  define MAXFILE  256
  119. #  define MAXEXT   256
  120. #endif
  121.  
  122. #define SEEK_SET  0
  123. #define SEEK_CUR  1
  124. #define SEEK_END  2
  125.  
  126. #define DIRSPLITCHR '/'
  127. #define DIRSPLITSTR "/"
  128.  
  129. /* ------------------------------------------------------------------------ */
  130. #else              /* Unknown compiler */
  131. #  error Unknown compiler!
  132. #endif
  133.  
  134.  
  135.  
  136.  
  137. /* Source Mapper is FREEWARE, so make it legal to use
  138.    without registration!
  139. */
  140. #define REGISTERED 1
  141.  
  142.  
  143.  
  144.  
  145. #ifdef TRUE
  146. #undef TRUE
  147. #endif
  148.  
  149. #ifdef FALSE
  150. #undef FALSE
  151. #endif
  152.  
  153. #define TRUE   1
  154. #define FALSE  0
  155. #define YES    TRUE
  156. #define NO     FALSE
  157. #define OK     TRUE
  158.  
  159. #ifdef ERROR
  160. #undef ERROR
  161. #endif
  162. #define ERROR  FALSE
  163.  
  164.  
  165.  
  166.  
  167. #define VERTICALLIN '|'    /* Vertikal skillelinje mellom info og kildekode */
  168. #define TABWIDTH    8      /* Tabulatorbredde */
  169. #define NPCHR  12          /* New Page CHaRacter */
  170. #define EOFCHR 26          /* End Of File CHaRacter */
  171. #define WHITECHR "\n\r\t " /* Hvite karakterer */
  172.  
  173.  
  174.  
  175.  
  176. #define VERSION  "1.0"   /* Version number of Source Map Generator         */
  177.  
  178.  
  179.  
  180.  
  181. #ifdef __UNIX__
  182. #define PLATFORM "UNIX"
  183. #elif __GNUC__
  184. #define PLATFORM "DOS-386"
  185. #elif __WIN32__
  186. #define PLATFORM "WIN32"
  187. #elif __OS2__
  188. #define PLATFORM "OS/2"
  189. #elif __MSDOS__
  190. #define PLATFORM "DOS"
  191. #else
  192. #error Unknown platform!
  193. #endif
  194.  
  195.  
  196.  
  197.  
  198. #define MAXINLIN      255  /* Maks antall tegn i linje som leses fra kildefil*/
  199. #define MAXFUNCN      78   /* Maks antall tegn i navn til funksjon og id */
  200. #define MAXLSTLEN     1500 /* Max length of string to specify selective list    */
  201. #define MAXNPSTRL     40   /* Max length of string to specifi new-page string   */
  202. #define MAXUSERPARAML 255  /* Maks lengde på parameter fra komandolinje */
  203.  
  204.  
  205.  
  206.  
  207. #define O_NO      0
  208. #define O_YES     1
  209. #define O_NAME    1
  210. #define O_LINENR  2
  211. #define O_TABULAT 1
  212. #define O_SPACE   2
  213. #define O_LIST    1
  214. #define O_FLOWCH  2
  215. #define O_ALL     1
  216. #define O_TEMP    2
  217. #define O_MAP     3
  218. #define O_LINK    1
  219. #define O_MAKE    2
  220. #define O_BUILD   3
  221.  
  222.  
  223.  
  224.  
  225. #define PRJMAKE  0
  226. #define PRJBUILD 1
  227. #define PRJLINK  2
  228.  
  229.  
  230.  
  231.  
  232. #define int8   char
  233. #define uint8  unsigned char
  234. #define int16  short
  235. #define uint16 unsigned short
  236. #define int32  long
  237. #define uint32 unsigned long
  238.  
  239.  
  240.  
  241.  
  242. #if defined (__OS2__) || defined (__GNUC__) || defined (__WIN32__)
  243. #  define far
  244. #  define huge
  245. #endif
  246.  
  247.  
  248.  
  249.  
  250. typedef struct timeSTRUCT
  251. {
  252.    unsigned int hund  : 7;
  253.    unsigned int sec   : 6;
  254.    unsigned int min   : 6;
  255.    unsigned int hour  : 5;
  256.    unsigned int day   : 5;
  257.    unsigned int month : 4;
  258.    unsigned int year  : 12;
  259. }
  260.    timeTYPE;
  261.  
  262.  
  263.  
  264.  
  265. typedef struct      /* Struktur for lagring av info om identifikatorbuffer */
  266. {
  267.    uint16  cidb;    /* Antall identifikatorblokker i buffer */
  268.    char   *buff;    /* Peker til buffer for lagring av identifikatorer */
  269. }
  270.    idbuffTYPE;
  271.  
  272.  
  273.  
  274.  
  275. typedef struct
  276. {
  277.    int     allinbuff;        /* TRUE hvis alle elementer er lagret i buffer */
  278.    uint16  idsize;           /* St¢rrelsen til hvert element (byte) */
  279.    uint16  cid;              /* Antall e. som er lagret i buffer og fil */
  280.    uint16  cidbuff;          /* Antall elementer som er lagret i bufferet */
  281.    uint16  cidfile;          /* Antall elementer som er lagret i filen */
  282.    uint16  maxidbuff;        /* Maks antall elemeneter i buffer */
  283.    char   *buff_test;        /* Buffer for lesing av enkle elementer */
  284.    char   *buff;             /* Selve bufferet */
  285.    FILE   *file;             /* Filen som er tilknyttet bufferet */
  286. }
  287.    diffbTYPE;
  288.  
  289.  
  290.  
  291.  
  292. typedef struct                         /* Totalinformasjon */
  293. {
  294.    int incl;                           /* INCLude total info */
  295.    int lin_tot;                        /* LINes TOTal */
  296.    int lin_emp;                        /* LINes EMPty */
  297.    int lin_com;                        /* LINes with only COMment */
  298.    int lin_cod;                        /* LINes with CODe */
  299.    int func;                           /* FUNCtions */
  300.    int com;                            /* COMments */
  301. }
  302.    o_totinfoTYPE;
  303.  
  304.  
  305.  
  306.  
  307. typedef struct                         /* Funksjonsregister */
  308. {
  309.    int  incl;                          /* INCLude functionregister */
  310.    int  sort;                          /* SORTing method for the func.reg. */
  311. }
  312.    o_funcregTYPE;
  313.  
  314.  
  315.  
  316.  
  317. typedef struct                         /* Liste over funksjons-kall */
  318. {
  319.    int  incl;                          /* INCLude list for functioncalls */
  320.    int  riselnr;                       /* RISEing Line NumbeRs reference */
  321.    int  sel;                           /* use SELective list for the list */
  322.    char list [MAXLSTLEN + 1];          /* storing witch func. in the LIST */
  323. }
  324.    o_funcallTYPE;
  325.  
  326.  
  327.  
  328.  
  329. typedef struct                         /* Liste over identifikatorer */
  330. {
  331.    int  incl;                          /* INCLude list for identifiers */
  332.    int  riselnr;                       /* RISEing Line NumbeRs reference     */
  333.    int  sel;                           /* use SELective list for the list */
  334.    char list [MAXLSTLEN + 1];          /* storing witch id's in the LIST */
  335. }
  336.    o_idlistTYPE;
  337.  
  338.  
  339.  
  340.  
  341. typedef struct                         /* Liste over kall-sekvenser */
  342. {
  343.    int  incl;                          /* INCLude list for identifiers */
  344.    int  iIncExternals;                 /* TRUE if include externals */
  345.    int  graph;                         /* True if use graphic characters */
  346.    int  format;                        /* 1=List, 2=Flowchart */
  347.    int  indent;                        /* Width of each indent level */
  348.    int  index;                         /* True if include index register */
  349.    char deftoplev [MAXFUNCN + 1];      /* DEFault TOP LEVel function */
  350. }
  351.    o_flowTYPE;
  352.  
  353.  
  354.  
  355.  
  356. typedef struct                         /* Linjeinformasjon */
  357. {
  358.    int incl;                           /* INCLude lineinfo in the map */
  359.    int r_llin;                         /* Report Local LINenumbers */
  360.    int r_bloc;                         /* Report BLOCk */
  361.    int r_coml;                         /* Report COMent-Lines */
  362.    int r_func;                         /* Report FUNCtion-information */
  363.    int c_ltot;                         /* Count Lines TOTaly */
  364.    int c_empl;                         /* Count EMPty Lines */
  365.    int c_coml;                         /* Count COMent-Lines */
  366.    int c_lcod;                         /* Count Lines with CODe */
  367.    int c_com;                          /* Count COMent-blocks */
  368.    int calist;                         /* Report list for function-CALers */
  369. }
  370.    o_lineinfoTYPE;
  371.  
  372.  
  373.  
  374.  
  375. typedef struct                         /* Diverse */
  376. {
  377.    int  np_str;                        /* New Page when STRing for new page */
  378.    int  np_fun;                        /* New Page before FUNction headers */
  379.    int  np_sect;                       /* New Page between map sections */
  380.    int  column;                        /* COLUMN-separator */
  381.    int  del;                           /* DELete .smg-files after use */
  382.    int  gencom;                        /* GENerate COMment-blocks */
  383.    int  twidth;                        /* Width of tabulator */
  384.    char newpag [MAXNPSTRL + 1];        /* storing the string for NEW PAGe */
  385.    int  iShowInfo;                     /* Level of display information on screen */
  386. }
  387.    o_variousTYPE;
  388.  
  389.  
  390.  
  391.  
  392. typedef struct                         /* Generer */
  393. {
  394.    int  gen;                           /* GENerate (O_ALL, O_TEMP, O_MAP) */
  395.    int  met;                           /* METhod (O_LINK, O_MAKE, O_BUILD) */
  396.    char obj [MAXPATH];                 /* path to OBJect files (mellomfiler) */
  397.    char map [MAXPATH];                 /* path to MAP-file */
  398.    char tmp [MAXPATH];                 /* path to TeMPorary files */
  399. }
  400.    o_generateTYPE;
  401.  
  402.  
  403.  
  404.  
  405. typedef struct
  406. {
  407.    char funcal [MAXPATH + 1]; /* Temporary list of function calls */
  408.    char lininf [MAXPATH + 1]; /* Temporary list of line info */
  409.    char funreg [MAXPATH + 1]; /* Temporary list of functions */
  410.    char idlist [MAXPATH + 1]; /* Temporary list of items/identicators */
  411.    char projec [MAXPATH + 1]; /* Temporary projectfile */
  412.    char manobj [MAXPATH + 1]; /* Temporary main objectfile of whole project */
  413.    char sortfi [MAXPATH + 1]; /* Temporary file used when sorting data */
  414.    char indexf [MAXPATH + 1]; /* Temporary file used to index names */
  415. }
  416.    tmpnTYPE;
  417.  
  418.  
  419.  
  420.  
  421. typedef struct                /* Scaninfo om aktiv linje */
  422. {
  423.    unsigned int block : 4;    /* Blokknivå (BLOCK). Maks is 15 */
  424.    unsigned int brack : 5;    /* Parentesnivå (BRACKets). Maks 32 */
  425.    unsigned int comb  : 1;    /* Komentarblokk (COMment) */
  426.    unsigned int quot  : 1;    /* Gåse¢yne (= quotation marks) (") */
  427.    unsigned int drop  : 1;    /* Dråpetegn (') (= anf¢rseltegn) */
  428.    unsigned int com1  : 1;    /* TRUE hvis 1 tegn i linje er innenfor kom.bl*/
  429.    unsigned int emp   : 1;    /* TRUE dersom aktiv linje var tom */
  430.    unsigned int code  : 1;    /* TRUE hvis kode i aktiv linje */
  431.    unsigned int ocom  : 1;    /* TRUE hvis hele linjen "Only COMment" */
  432.    unsigned int dirl  : 1;    /* TRUE hvis linjen er direktivlinje */
  433.    unsigned int intfc : 1;    /* TRUE hvis aktiv INTERFACE-del (kun PASCAL) */
  434. }
  435.    scanTYPE;
  436.  
  437.  
  438.  
  439.  
  440. typedef struct                /* Info om funksjonskall */
  441. {
  442.    char name [MAXFUNCN + 1];  /* Navn til funksjon som kalles */
  443.    long lnr;                  /* Nummer til linje hvor kallet utf¢res */
  444. }
  445.    fcalTYPE;
  446.  
  447.  
  448.  
  449.  
  450. typedef struct                /* Info om elementer i identifikatorliste */
  451. {
  452.    char name [MAXFUNCN + 1];  /* Navn til aktuell identifikator */
  453.    long lnr;                  /* Linjenummer der identifikatoren brukes */
  454. }
  455.    idlstTYPE;
  456.  
  457.  
  458.  
  459.  
  460. typedef struct                /* Scaninfo om aktiv potensiell funksjon */
  461. {
  462.    char name [MAXFUNCN + 1];  /* Lagring av navn til potensiell funksjon */
  463.    uint8 fok;                 /* TRUE når potensiell funksjon er bekreftet */
  464.    long blin;                 /* Beginning LINenumber for function head */
  465.    long blin_block;           /* Beginning LINenumber for first BLOCK */
  466.    long fcal;                 /* Count Function CALls in function */
  467.    uint16 lines;              /* Count LINES in function */
  468.    uint16 empl;               /* Count EMPty Lines in function */
  469.    uint16 coml;               /* Count COMent Lines in function */
  470.    uint16 codl;               /* Count Lines with CODe in function */
  471.    uint16 com;                /* Count COMent blocks in function */
  472.    uint16 dirl;               /* Count DIRective Lines i function */
  473. }
  474.    funcTYPE;
  475.  
  476.  
  477.  
  478.  
  479. /* Finn den st¢rste av strukturene som brukes for å lagre informasjons-
  480.    elementer i midlertidige filer under scanning av kildefil.
  481.    Makro for st¢rrelsen til den st¢rste strukturen vil brukes til å
  482.    definere st¢rrelsen til buffere som skal lese enkeltstående elementer
  483.    fra midlertidige filer hvor slik informasjon er lagret.
  484. */
  485.  
  486. #if __IBMC__ || __IBMCPP__
  487. # define BIGGEST_SCANSTRUC sizeof (funcTYPE)
  488. #elif __GNUC__
  489. # define BIGGEST_SCANSTRUC sizeof (funcTYPE)
  490. #else
  491. # if sizeof (fcalTYPE)  > sizeof (funcTYPE)
  492. #  if sizeof (idlstTYPE) > sizeof (fcalTYPE)
  493. #   define BIGGEST_SCANSTRUC sizeof (idlstTYPE)
  494. #  endif
  495. #  define BIGGEST_SCANSTRUC sizeof (fcalTYPE)
  496. # endif
  497. # define BIGGEST_SCANSTRUC sizeof (funcTYPE)
  498. #endif
  499.  
  500.  
  501.  
  502.  
  503. typedef struct                /* Scaninfo om aktiv kildefil */
  504. {
  505.    long ltot;                 /* Count Lines TOTal in sourcefile */
  506.    long elin;                 /* Count Empty LINes in sourcefile */
  507.    long coml;                 /* Count COMment Lines in sourcefile */
  508.    long codl;                 /* Count CODe Lines in sourcefile */
  509.    long com;                  /* Count COMment blocks in sourcefile */
  510.    long func;                 /* Count FUNCtions in sourcefile */
  511.    long dirl;                 /* Count DIRectiveLines in sourcefile */
  512.    long fcal;                 /* Count Function CALls in sourcefile */
  513.    long cid;                  /* Count IDentifiers in sourcefile */
  514. }
  515.    finfTYPE;
  516.  
  517.  
  518.  
  519.  
  520. typedef struct                /* Filposisjoner til datagrupper i mellomfil */
  521. {
  522.    long finf;                 /* Startposisjon til total kildefil-info */
  523.    long funreg;               /* Startposisjon til funksjonsregister-data */
  524.    long funcal;               /* Startposisjon til funksjonskall-data */
  525.    long idlst;                /* Startposisjon til identifikatorliste-data */
  526.    long lininf;               /* Startposisjon til linjeinformasjon-data */
  527. }
  528.    fposTYPE;
  529.  
  530.  
  531.  
  532.  
  533. typedef struct
  534. {
  535.    char  name [MAXPATH]; /* Navn til aktiv prosjektfil */
  536.    int   filc;           /* Antall filer i aktivt prosjekt */
  537.    int16 usrn;           /* TRUE hvis bruker har definert navn til prjfil */
  538.    int16 temp;           /* TRUE hvis aktiv prosjektfil er midlertidig */
  539.    int16 save;           /* FALSE hvis prosjekt er forandret siden lagring*/
  540.    int16 prjon;          /* FALSE dersom det ikke er noe aktivt prosjekt */
  541.    FILE *file;           /* Filpeker til prosjektfil. NULL hvis ikke åpen */
  542. }
  543.    prjstatTYPE;
  544.  
  545.  
  546.  
  547.  
  548. typedef struct
  549. {
  550.    char     name [MAXPATH + 1]; /* Navn til kildefil */
  551.    char     objn [MAXPATH + 1]; /* Navn til mellomfil */
  552.    uint8    dataok;             /* TRUE hvis "finf" er lest og o.k. */
  553.    finfTYPE finf;               /* Filinformasjon om kildefil */
  554.    fposTYPE fpos;               /* Indekser til blokker av data i mellomfil */
  555. }
  556.    prjfeTYPE;                   /* PRoJect File-Element type */
  557.  
  558.  
  559.  
  560.  
  561. typedef struct
  562. {
  563.    int   iErr;                  /* Actual error code. 0 if no error */
  564.    int   errno;                 /* Value of errno at error record time */
  565.    char  cFName[MAXPATH];       /* Name of file which caused the error */
  566.    char* pSFileName;            /* Name of source file where error occoured */
  567.    int   iSFileLNr;             /* Line number of source where error occoure*/
  568. }
  569.    ErrorType;                   /* CB to maintain errors (smgerror.c) */
  570.  
  571.  
  572.  
  573.  
  574. extern ErrorType Error;
  575.  
  576.  
  577.  
  578.  
  579. extern diffbTYPE diffb;            /* SMGDIFID.C */
  580. extern char      progdir[MAXPATH]; /* SM -programkatalog */
  581. extern int       stdwidth;         /* Antall tegn i skillelinjer etc.: */
  582. extern char      linechr1;         /* Karakter som utgj¢r skillelinjer: ──────────── */
  583. extern char      linechr2;         /* Karakter som utgj¢r skillelinjer: ════════════ */
  584.  
  585.  
  586.  
  587.  
  588. extern char     *ptbl[];           /* Parametertabell (Parameter TaBLe) */
  589. extern char     *defoptcom[];      /* Komentarer til fil for standard brukervalg */
  590. extern char     *optblocks[];      /* Navnt til blokker av brukervalg */
  591. extern char     *errmsg[];         /* Feilmeldinger (ERRor MeSsaGes) */
  592. extern char     *fnames[];         /* Fil-navn og -endelser */
  593.  
  594.  
  595.  
  596.  
  597. extern tmpnTYPE tmpn;
  598. extern o_totinfoTYPE  o_totinfo;
  599. extern o_funcregTYPE  o_funcreg;
  600. extern o_funcallTYPE  o_funcall;
  601. extern o_idlistTYPE   o_idlist;
  602. extern o_flowTYPE     o_flow;
  603. extern o_lineinfoTYPE o_lineinfo;
  604. extern o_variousTYPE  o_various;
  605. extern o_generateTYPE o_generate;
  606. extern prjstatTYPE    prjstat;
  607.  
  608.  
  609.  
  610.  
  611. /*
  612. ** Filene nedenfor er gjordt globale for å slippe å oppgi dem som parameter
  613. ** til alle de funksjonene som skal bruke dem:
  614. */
  615. extern FILE *tempf;   /* For lagring av mellomfil */
  616. extern FILE *sourcef; /* Aktiv kildefil */
  617. extern FILE *funcalf; /* Fil for midlertidig funksjonskall-liste */
  618. extern FILE *lininff; /* Fil for midlertidig linjeinfo/totalinfo */
  619. extern FILE *funregf; /* Fil for midlertidig funksjonsregister */
  620. extern FILE *idlistf; /* Fil for midlertidig identifikatorliste */
  621.  
  622.  
  623.  
  624.  
  625. #define COMCHAR     ';' /* For å skille kommentarer i valg-filer */
  626. #define YESCHAR     'Y' /* Representerer ja ved ja/nei-spr¢rsmål */
  627. #define NOCHAR      'N' /* Representerer nei ved ja/nei-sp¢rsmål */
  628. #define GLOBLINCHR  'G' /* Forkortelse for global linje */
  629. #define LOCLINCHR   'L' /* Forkortelse for lokal linje */
  630. #define FUNCTIONCHR 'F' /* Forkortelse for funksjon */
  631. #define FILECHR     'F' /* Forkortelse for fil */
  632. #define BLOCKCHR    'B' /* Forkortelse for blokknivå */
  633.  
  634.  
  635.  
  636.  
  637. typedef enum
  638. {
  639.    D_NONSENSE = 0,   /* Nonsense (Will NEVER be displayed :-) */
  640.    D_LOW,            /* Line# process indicator of D_HEIGH */
  641.    D_HEIGH,          /* Heigh (main action type). */
  642.    D_HEIGHEST,       /* Heighest (Copyright, interrupt, warnings, etc.) */
  643.    D_WARNING,        /* Warnings only */
  644. }
  645.    DISP_PRIORITY;    /* Priority level used by Display (); */
  646.  
  647.  
  648.  
  649.  
  650. enum access_ptbl /* Aksess-makroer for parametertabell (Parameter TaBLe) */
  651. {
  652.    /* ______ Totalinfo: ______ */
  653.    PT_iti,   /* Include Total Information */
  654.    PT_ctl,   /* Count Total Lines */
  655.    PT_cel,   /* Count Empty Lines */
  656.    PT_coc,   /* Count lines with Only Coments */
  657.    PT_clc,   /* Count Lines with Code */
  658.    PT_cfu,   /* Count FUnctions */
  659.    PT_cco,   /* Count COments */
  660.  
  661.    /* ______ Funksjonsregister: ______ */
  662.    PT_ifr,   /* Include Function Register */
  663.    PT_fso,   /* Functionregister-SOrting */
  664.  
  665.    /* ______ Liste over funksjonskall: ______ */
  666.    PT_ilf,   /* Include List for Functioncalls */
  667.    PT_slf,   /* Selective List for Functincall */
  668.    PT_fln,   /* Functioncall rising Line Numbers reference */
  669.  
  670.    /* ______ Liste over identifikatorer: ______ */
  671.    PT_iil,   /* Include Identifier List */
  672.    PT_sli,   /* Selective List for Identifiers */
  673.    PT_iln,   /* Identifier-list rising Line Number references */
  674.  
  675.    /* ______ Kall-sekvenser: ______ */
  676.    PT_csi,   /* Include */
  677.    PT_cie,   /* Include external functions in list of calling sequences */
  678.    PT_csg,   /* Use graphicals characters */
  679.    PT_csf,   /* Format (1=List, 2=Flowchart) */
  680.    PT_cwi,   /* Width of indents */
  681.    PT_cir,   /* Include indexregister */
  682.    PT_cdt,   /* Default top level function */
  683.  
  684.    /* ______ Linjeinformasjon: ______ */
  685.    PT_ili,   /* Include Line-Info */
  686.    PT_lll,   /* Lineinfo-Lokal-Linenumber */
  687.    PT_rbi,   /* Report Block-Indention */
  688.    PT_lcl,   /* Lineinfo-Comment-Line */
  689.    PT_lfi,   /* Lineinfo-Function-Information */
  690.    PT_LLF,   /* Lineinfo-Linetotal-in-Function */
  691.    PT_LEF,   /* Lineinfo-Empty-lines-in-Function */
  692.    PT_LCF,   /* Lineinfo-CommentLines-in-function */
  693.    PT_LCO,   /* Lineinfo-COdelines-in-function */
  694.    PT_LCC,   /* Lineinfo-Count-Comentlines-in-function */
  695.    PT_LLC,   /* Lineinfo-List-of-Callers */
  696.  
  697.    /* ______ Diverse: ______ */
  698.    PT_NPs,   /* New-Page-String */
  699.    PT_NPS,   /* New-Page-when-String-for-new-page */
  700.    PT_NFU,   /* New-page-when-new-FUnctions */
  701.    PT_NFI,   /* New-page-when-new-FIles */
  702.    PT_cse,   /* Column-SEparator */
  703.    PT_dtu,   /* Delete Temporary files after Use */
  704.    PT_gcb,   /* Generate-Coment-Blocks */
  705.    PT_tab,   /* Width of tabulator */
  706.    PT_dis,   /* Disp. info on screen (0=Nothing,1=Few,2=Normal,3=Detailed) */
  707.  
  708.    /* ______ Generer: ______ */
  709.    PT_gen,   /* GENerate */
  710.    PT_met,   /* METhod for generator */
  711.    PT_pof,   /* Path to Object File(s) */
  712.    PT_pmf,   /* Path to Map File(s) */
  713.    PT_ptf,   /* Path to Temporary Files */
  714.    PT_upf,   /* Use Project-File */
  715.    PT_uof,   /* Use Option-File */
  716.  
  717.    /* ______ Brytere som bare utf¢res direkte, uten å lagres i valg-fil: */
  718.    PT_wof,   /* Write Options to File */
  719.    PT_res,   /* RESet options */
  720.    PT_hlp,   /* HeLP user with the option */
  721.  
  722.    PT_MAXNR,
  723.  
  724.    PT_ILLEGAL,
  725. };
  726.  
  727.  
  728.  
  729.  
  730. enum access_defoptcom   /* ACCESS-macros for accessing OPTion-BLOCK-nameS */
  731. {
  732.    OB_TOTINFO,          /* Totalinformasjon */
  733.    OB_FUNCREG,          /* Funksjonsregister */
  734.    OB_FUNCALL,          /* Liste over funksjons-kall */
  735.    OB_IDLIST,           /* Liste over identifikatorer */
  736.    OB_CALSEQ,           /* Kall-sekvenser */
  737.    OB_LINEINF,          /* Linjeinformasjon */
  738.    OB_FUNCINFO,         /* Informasjon om funksjoner */
  739.    OB_VARIOUS,          /* Diverse */
  740.    OB_GENERATE,         /* Generer */
  741. };
  742.  
  743.  
  744.  
  745.  
  746. enum access_fnames   /* Makroer til å aksessere elementer i "fnames" */
  747. {
  748.    CSOURCE_EXT,      /* Endelse til C-kildetekster */
  749.    SMGTEMP_EXT,      /* Endelse til midlertidige mellomfiler */
  750.    SMGOPTI_EXT,      /* Endelse til valgfiler */
  751.    SMGPRJ_EXT,       /* Endelse til prosjektfiler */
  752.    SMGOBJC_EXT,      /* Endelse til endelig mellomfil */
  753.    SMGMAPF_EXT,      /* Endelse til endelig kildekart */
  754.    SMGBACK_EXT,      /* Endelse til reservekopier */
  755.    DEFOPT_FNAME,     /* Navn til standard valgfil */
  756. };
  757.  
  758.  
  759.  
  760. extern char _StrHlpOptions[];
  761. extern char _StrHlpOptionsMore[];
  762.  
  763.  
  764.  
  765.  
  766. extern char _StrErrWarning[];
  767. extern char _StrErrUnknownOption[];
  768.  
  769.  
  770.  
  771.  
  772. extern char _StrMSGCOPYRIGHT[];
  773. extern char _StrMSGTEMPFILEID[];
  774. extern char _StrMSGPRJFILEID[];
  775. extern char _StrMSGUSAGE[];
  776. extern char _StrMSGINTERPRETLIN[];
  777. extern char _StrMSGSORTFUNCREG[];
  778. extern char _StrMSGSORTIDLST[];
  779. extern char _StrMSGSORTFCALLST[];
  780. extern char _StrMSGINCLFUNDATA[];
  781. extern char _StrMSGINCLLINEINFO[];
  782. extern char _StrMSGINCLIDDATA[];
  783. extern char _StrMSGINCLFCALDATA[];
  784. extern char _StrMSGMAKEDIFIDF[];
  785. extern char _StrMSGMAKEDIFFCALF[];
  786. extern char _StrMSGMAKINDXFCAL[];
  787. extern char _StrMSGMAKINDXIDLST[];
  788. extern char _StrMSGTRYAGAIN[];
  789. extern char _StrMSGTOTINF_SNAME[];
  790. extern char _StrMSGTOTINF_LINTOT[];
  791. extern char _StrMSGTOTINF_EMPLIN[];
  792. extern char _StrMSGTOTINF_COMLIN[];
  793. extern char _StrMSGTOTINF_CODLIN[];
  794. extern char _StrMSGTOTINF_FUNTOT[];
  795. extern char _StrMSGTOTINF_COMENT[];
  796. extern char _StrMSGTOTALYSTR[];
  797. extern char _StrMSGGENERATESOBJ[];
  798. extern char _StrMSGGENERATESMAP[];
  799. extern char _StrMSGINCLTOTINFO[];
  800. extern char _StrMSGGLOBLINSTART[];
  801. extern char _StrMSGINCLFUNCREG[];
  802. extern char _StrMSGFUNCREGSTR[];
  803. extern char _StrMSGNOFUNCTIONS[];
  804. extern char _StrMSGTOTFUNCTIONS[];
  805. extern char _StrMSGINCLFUNCALLST[];
  806. extern char _StrMSGFUNCALLSTSTR[];
  807. extern char _StrMSGSELFUNCALLSTSTR[];
  808. extern char _StrMSGTOTFUNCCALS[];
  809. extern char _StrMSGIDLSTSTR[];
  810. extern char _StrMSGSELIDLSTSTR[];
  811. extern char _StrMSGTOTIDS[];
  812. extern char _StrMSGINCLIDLST[];
  813. extern char _StrMSGINCLINEINFO[];
  814. extern char _StrMSGSOURCECODEINF[];
  815. extern char _StrMSGONLYCOMENT[];
  816. extern char _StrMSGLISTOFCALLERS[];
  817. extern char _StrMSGGENERALFUNCINF[];
  818. extern char _StrMSGFUNCINF_LINTOT[];
  819. extern char _StrMSGFUNCINF_LINEMP[];
  820. extern char _StrMSGFUNCINF_LINCOM[];
  821. extern char _StrMSGFUNCINF_LINCOD[];
  822. extern char _StrMSGFUNCINF_CBLOCS[];
  823. extern char _StrMSGNOBODYCALLFUNC[];
  824. extern char _StrMSGSEEKTPLEVELF[];
  825. extern char _StrMSGNOTOPLEVELFUNC[];
  826. extern char _StrMSGFLOWCLSTSTR[];
  827. extern char _StrMSGINCLFLOWC[];
  828. extern char _StrMSGEXTERNAL[];
  829. extern char _StrMSGFLOWGENSTRIP[];
  830. extern char _StrMSGSORTFLOWIDXREG[];
  831. extern char _StrMSGINCLFLOWIDXREG[];
  832. extern char _StrMSGIDXREGFLOW[];
  833.  
  834.  
  835.  
  836.          /* SMG.C */
  837. int      ErrorClear           ( void );
  838. void     ErrorShow            ( void );
  839. int      ErrorSet             ( int iErrCode, const char *pFName, const char *pSFileName, int iSFileLNr );
  840. void     DoError              ( const char *format, ... );
  841. void     DoWarning            ( const char *format, ... );
  842. void     SMHelpCmd            ( const char *pStrHelp );
  843. void     ClrLin               ( void );
  844. void     ClrEOL               ( void );
  845. int      Display              ( DISP_PRIORITY iPriority, const char *format, ... );
  846. void    *Alloc                ( long size );
  847. void     Free                 ( void *buff );
  848. long     MemLeft              ( void );
  849. char    *Adress               ( char *buff, long index, int esize );
  850. void     CallWhenExit         ( void );
  851. int      CallWhenCtrlBrk      ( void );
  852. int      MakeMapFiles         ( int job, const char *path );
  853. int      RunCLineVer          ( char *param );
  854. int      mainCLineVer         ( int argc, char *argv[] );
  855. int      mainScreenVer        ( int argc, char *argv[] );
  856. int      main                 ( int argc, char *argv[] );
  857.  
  858.          /* SMGGENRL.C */
  859. int      ResetFNames          ( FILE *stream );
  860. void     ResetAllFNames       ( void );
  861. int      SetFNames            ( const char *fname, FILE *stream );
  862. char    *GetFNames            ( FILE *stream );
  863. long     FLength              ( FILE *stream );
  864. FILE    *FOpen                ( const char *filename, char *mode );
  865. int      FClose               ( FILE *stream );
  866. int      FCloseAll            ( void );
  867. int      FPrintF              ( FILE *stream, const char *format, ... );
  868. size_t   FWrite               ( const void *ptr, size_t size, size_t n, FILE *stream );
  869. size_t   FRead                ( void *ptr, size_t size, size_t n, FILE *stream );
  870. int      FGetS                ( char *string, int maxlen, FILE *stream );
  871. int      FGetS0               ( char *string, int maxlen, FILE *stream );
  872. int      Remove               ( const char *filename );
  873. long     FTell                ( FILE *stream );
  874. int      FSeek                ( FILE *stream, long offset, int whence );
  875. int      Rewind               ( FILE *stream );
  876. int      FPutC                ( FILE *stream, char c );
  877. int      FGetC                ( FILE *stream, char *c );
  878. int      FGetL                ( FILE *stream, long *l );
  879. int      FPutL                ( FILE *stream, long l );
  880. int      WritFLine            ( FILE *file, int count, char chr );
  881. int      WritFLineLn          ( FILE *file, int count, char chr );
  882. int      GetFileTime          ( const char *filename, timeTYPE *_time );
  883. int      PrintStrTab          ( FILE *file, const char *str, int tabw );
  884. int      CopyNBytes           ( FILE *dest, FILE *source, long nr );
  885. int      CopyNBytesP          ( FILE *dest, FILE *source, long spos, long nr );
  886. int      IsItemInFile         ( FILE *file, const char *item, int itlen, long itnr, long *res );
  887. int      FAddDummy            ( FILE *file, long chrnr, char value );
  888. int      FCreatePath          ( const char *path );
  889. char    *BigStr               ( int nr, ... );
  890. char    *GetFName             ( const char *path );
  891. char    *GetPath              ( const char *path );
  892. int      IsWild               ( const char *path );
  893. char    *Slash                ( char *dir );
  894. char    *CutFName             ( char *path );
  895. char    *CutFExt              ( char *path );
  896. int      StrPart              ( int nr, int maxlen, char *dest, const char *src, const char *sep );
  897. int      IsExt                ( const char *path );
  898. int      FNSplit              ( const char *path, char *drive, char *dir, char *file, char *ext );
  899. int      StrLenSL             ( long value );
  900. int      StrLenSI             ( int value );
  901. int      GetDisk              ( void );
  902. void     SetDisk              ( int disk );
  903. int      GetCurDir            ( int drive, char *directory );
  904. void     Randomize            ( void );
  905.  
  906.          /* SMGCONTF.C */
  907. int      MakeDiffIdF          ( FILE *idf, int esize, uint32 count, char *userinf );
  908. int      ConnectTempFiles     ( char *sfnam, finfTYPE *finf );
  909. int      ConnectIdLst         ( uint32 count );
  910. int      ConnectIdLst_        ( FILE *diffidf );
  911. int      ConnectIdLstData     ( char *id, idbuffTYPE *idbuff );
  912. int      ConnectFunCal        ( uint32 count );
  913. int      ConnectFunCalData    ( char *name );
  914. int      ConnectFunReg        ( long count );
  915. int      ConnectLinInf        ( long count );
  916. int      JoinObjFiles         ( void );
  917. int      JoinObjFiles_        ( FILE *tmpf );
  918. int      JoinSourceInfo       ( FILE *tmpf );
  919. int      JoinLineInfo         ( FILE *tmpf );
  920. int      JoinFuncInfo         ( FILE *tmpf );
  921. int      JoinFuncInfo_        ( FILE *tmpf, FILE *sortf, long fnr );
  922. int      JoinSortFuncInfo     ( FILE *sortf, long *fnr );
  923. int      JoinSortFuncInfo_    ( FILE *sortf, FILE *objf, finfTYPE *finf, fposTYPE *fpos, long globlin );
  924. int      JoinFunCalInfo       ( FILE *tmpf );
  925. int      JoinFunCalInfo_      ( FILE *tmpf, FILE *sortf, FILE *indxf, long fnr );
  926. int      JoinSortFunCalInfo   ( FILE *sortf, long *fnr );
  927. int      JoinSortFunCalInfo_  ( FILE *sortf, FILE *objf, long *fnr, fposTYPE *fpos );
  928. int      JoinFunCalMakIndx    ( FILE *sortf, FILE *indxf, long fnr );
  929. int      JoinFunCalMakIndx_   ( FILE *sortf, FILE *indxf, FILE *objf, long fnr, int objfnr, fposTYPE *fpos );
  930. int      JoinIdLstInfo        ( FILE *tmpf );
  931. int      JoinIdLstInfo_       ( FILE *tmpf, FILE *sortf, FILE *indxf, long inr );
  932. int      JoinSortIdLstInfo    ( FILE *sortf, long *inr );
  933. int      JoinSortIdLstInfo_   ( FILE *sortf, FILE *objf, long *inr, fposTYPE *fpos );
  934. int      JoinIdLstMakIndx     ( FILE *sortf, FILE *indxf, long inr );
  935. int      JoinIdLstMakIndx_    ( FILE *sortf, FILE *indxf, FILE *objf, long inr, int objfnr, fposTYPE *fpos );
  936.  
  937.          /* SMGCONV.C */
  938. int      MakeMapFile          ( void );
  939. int      MakeMapFile_         ( FILE *mapf );
  940. int      MakeMapName          ( char *mapname );
  941. int      WrtComStart          ( FILE *file );
  942. int      WrtComStartLn        ( FILE *file );
  943. int      WrtComEnd            ( FILE *file );
  944. int      WrtComEndLn          ( FILE *file );
  945. int      GetFPosTYPE          ( FILE *objf, fposTYPE *fpos );
  946. int      GetFInfTYPE          ( FILE *objf, finfTYPE *finf );
  947. int      TestObjFile          ( const char *ofname );
  948. int      TestObjFile_         ( FILE *objf );
  949. int      TestObjFileHead      ( FILE *objf );
  950. int      WrtStdLinComStart    ( FILE *file, int linlen, int chr );
  951. int      WrtStdLinComEnd      ( FILE *file, int linlen, int chr );
  952.  
  953.          /* SMGDIFID.C */
  954. int      DiffBConstruct       ( const char *fname, int idsize );
  955. int      DiffBClear           ( void );
  956. int      DiffBDestruct        ( void );
  957. int      DiffBAddId           ( const char *id );
  958. int      DiffBIfId            ( const char *id, uint16 *answ );
  959. int      DiffBGetId           ( uint16 indx, char *id );
  960.  
  961.          /* SMGFCAL.C */
  962. int      FCalIncludeToMap     ( FILE *mapf );
  963. int      FCalNameInSelList    ( const char *funcn );
  964. int      FCalIncludeToMap1    ( FILE *mapf, FILE *objf, fposTYPE *fpos );
  965. int      FCalIncludeToMap1_   ( FILE *mapf, FILE *objf );
  966. int      FCalIncludeToMap2    ( FILE *mapf, FILE *objf, fposTYPE *fpos );
  967.  
  968.          /* SMGFLOW.C */
  969. int      FlowCIncludeToMap    ( FILE *mapf );
  970. int      FlowCIncludeToMap_   ( FILE *mapf, FILE *objf, fposTYPE *fpos );
  971. int      FlowCIncludeToMap__  ( FILE *mapf, FILE *tmpf, const char *topl, long *lnr );
  972. int      IsFuncCalled         ( FILE *objf, const char *funcn, fposTYPE *fpos, int *answ );
  973. int      FlowCSubLevels       ( void );
  974. int      FlowCStripTmpf       ( FILE *objf, FILE *tmpf, fposTYPE *fpos );
  975. int      FlowCDrawIndts       ( FILE *mapf, int indent, char vertchr );
  976. int      FlowCDrawBox         ( FILE *mapf, long lnr, int indent, const char *txt );
  977. int      FlowCDrawBox_        ( FILE *mapf, long lnr, int indent, const char *txt, const char chrs[] );
  978. int      FlowCInclIndx        ( FILE *mapf, FILE *funcs );
  979.  
  980.          /* SMGFUNCR.C */
  981. int      FuncRIncludeToMap    ( FILE *mapf );
  982. int      FuncRBuffConstruct   ( void );
  983. int      FuncRBuffDestruct    ( void );
  984. int      FuncRBuffIndxGet     ( long indx, funcTYPE *func );
  985. long     FuncRBuffGetFNr      ( void );
  986. int      FuncRBuffLNrGet      ( long lnr, funcTYPE *func );
  987. int      FuncRBuffIsFunc      ( const char *fname );
  988. int      FuncRIncludeToMap1   ( FILE *mapf );
  989. int      FuncRIncludeToMap2   ( FILE *mapf );
  990.  
  991.          /* SMGIDLST.C */
  992. int      IdLstIncludeToMap    ( FILE *mapf );
  993. int      IdLstNameInSelList   ( const char *idname );
  994. int      IdLstIncludeToMap1   ( FILE *mapf, FILE *objf, fposTYPE *fpos );
  995. int      IdLstIncludeToMap1_  ( FILE *mapf, FILE *objf );
  996. int      IdLstIncludeToMap2   ( FILE *mapf, FILE *objf, fposTYPE *fpos );
  997.  
  998.          /* SMGLINF.C */
  999. int      LInfoIncToMap        ( FILE *mapf );
  1000. int      LInfo1               ( FILE *mapf );
  1001. int      LInfo2               ( FILE *mapf );
  1002. int      LInfoSourceHead      ( FILE *mapf, int fnr );
  1003. int      LInfoInclSource      ( FILE *mapf, FILE *objf, FILE *srcf, long *glnr, long lines, fposTYPE *fpos );
  1004. int      LInfoInclSource_     ( FILE *mapf, const char *line, scanTYPE *scan, long llnr, long glnr );
  1005. int      LInfoEmpty           ( FILE *mapf );
  1006. int      LInfoFindNextFunc    ( long curlnr, funcTYPE *func );
  1007. int      LInfoInclFuncInfo    ( FILE *mapf, FILE *objf, funcTYPE *func, fposTYPE *fpos );
  1008.  
  1009.          /* SMGOPTFI.C */
  1010. char     optchr_pm            ( int opt );
  1011. char     optchr_v             ( int opt );
  1012. int      save_options         ( const char *fname );
  1013. int      read_options         ( const char *name );
  1014. void     read_default_options ( void );
  1015.  
  1016.          /* SMGOPTIO.C */
  1017. int      SetDefaultOptions    ( void );
  1018. int      SetTmpFNames         ( void );
  1019. int      CreateUniqueFile     ( const char *pcDir, char *pPath, int iMaxPath );
  1020.  
  1021.          /* SMGPRJCT.C */
  1022. int      GetFDataFromPrj      ( int filenr, prjfeTYPE *fdata );
  1023. int      PutFDataToPrj        ( int filenr, prjfeTYPE *fdata );
  1024. void     ResetPrjStat         ( void );
  1025. int      AddFDataToPrj        ( prjfeTYPE *fdata );
  1026. int      MakePrjF             ( const char *fname );
  1027. void     ResetPrjFETYPE       ( prjfeTYPE *fdata );
  1028. void     GetObjFileName       ( char *ofname, const char *sfname );
  1029. int      IsTime1NewerThanTime2 ( const timeTYPE *Time1, const timeTYPE *Time2 );
  1030. int      ScanFilesInPrj       ( int job );
  1031. int      MakePrjDataOK        ( void );
  1032. int      GetFDataOfGLin       ( long glin, long *slin, prjfeTYPE *fdata );
  1033.  
  1034.          /* SMGPRTLK.C */
  1035. int      interpret_switch     ( const char *sw, int *code, const char *legal );
  1036. int      UseOptionsFile       ( const char *path );
  1037. int      get_PT_macro         ( const char *name);
  1038. int      param_getnext        ( int nr, int maxlen, char *dest, char *source );
  1039. int      param_ishook         ( const char *point );
  1040. int      interpret_parameters ( char *param, int iEWarn );
  1041.  
  1042.          /* SMGSCANF.C */
  1043. int      ifkeyword            ( char *word );
  1044. int      scan_sourcef         ( char *sfnam, char *tfnam );
  1045. int      scan_sourcef_        ( char *sfnam );
  1046. void     reset_scantype       ( scanTYPE *scan );
  1047. void     reset_functype       ( funcTYPE *func );
  1048. void     reset_fcaltype       ( fcalTYPE *fcal );
  1049. void     reset_finftype       ( finfTYPE *finf );
  1050. void     reset_idlsttype      ( idlstTYPE *idlst );
  1051. int      intpret_line         ( char *line, scanTYPE *scan, funcTYPE *func, finfTYPE *finf, idlstTYPE *idlst );
  1052. void     posnexttoken         ( char **linep );
  1053.  
  1054.          /* SMGSORTF.C */
  1055. int      sortfile             ( FILE *stream, uint16 size );
  1056.  
  1057.          /* SMGTOTIN.C */
  1058. int      wrt_totinfo          ( FILE *mapf );
  1059. int      wrt_totinfo1         ( FILE *file, int fnr );
  1060. int      wrt_totinfo2         ( FILE *file );
  1061. int      wrt_totinfo2_        ( FILE *file, finfTYPE *finf, int fnr, const char *sfname, int iLongestFName );
  1062. int      max_totinf_strlen    ( void );
  1063. int      wrt_totinfo_         ( FILE *file, finfTYPE *finf, const char *sfname, int *cinf );
  1064.  
  1065.  
  1066.  
  1067.  
  1068. #if defined (__OS2__) || defined (__GNUC__)
  1069. #  define ADRESS(buff,idx,esize) ((void *) (((char*)(buff))+((idx)*(esize))))
  1070. #else
  1071. #  define ADRESS(buff,idx,esize) ((void *) Adress ((void*) buff, idx, esize))
  1072. #endif
  1073.  
  1074.  
  1075.  
  1076.  
  1077. #define ERRORSET(iErrCode, pFName) ErrorSet (iErrCode, pFName, __FILE__, __LINE__)
  1078. #define RETERR(iErrCode, pFName) { ERRORSET (iErrCode, pFName); return (ERROR); }
  1079. #define RETURN_ERR return (ERROR)
  1080.  
  1081. extern int _iErrNo;             /* Shadow of errno value */
  1082.  
  1083.  
  1084.  
  1085.  
  1086. #endif /* #ifndef __SMG_H__ */
  1087.  
  1088.  
  1089.