/[global]/global/htags/htags.c
ViewVC logotype

Diff of /global/htags/htags.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53 by shigio, Thu Apr 7 10:20:07 2005 UTC revision 1.54 by shigio, Fri Apr 8 06:49:20 2005 UTC
# Line 50  Line 50 
50  #include "path2url.h"  #include "path2url.h"
51  #include "const.h"  #include "const.h"
52    
53  void src2html(char *, char *, int);  void src2html(const char *, const char *, int);
54  int makedupindex(void);  int makedupindex(void);
55  int makedefineindex(char *, int, STRBUF *);  int makedefineindex(const char *, int, STRBUF *);
56  int makefileindex(char *, STRBUF *);  int makefileindex(const char *, STRBUF *);
57  void makeincludeindex();  void makeincludeindex();
58    
59  #if defined(_WIN32) && !defined(__CYGWIN__)  #if defined(_WIN32) && !defined(__CYGWIN__)
# Line 65  void makeincludeindex(); Line 65  void makeincludeindex();
65   * Global data.   * Global data.
66   */   */
67  int w32 = W32;                          /* Windows32 environment        */  int w32 = W32;                          /* Windows32 environment        */
68  char *www = "http://www.gnu.org/software/global/";  const char *www = "http://www.gnu.org/software/global/";
69  char *include_header;  const char *include_header;
70  int file_count = 0;  int file_count = 0;
71  int sep = '/';  int sep = '/';
72  char *save_config;  const char *save_config;
73  char *save_argv;  const char *save_argv;
74    
75  char cwdpath[MAXPATHLEN];  char cwdpath[MAXPATHLEN];
76  char dbpath[MAXPATHLEN];  char dbpath[MAXPATHLEN];
# Line 82  char sort_path[MAXFILLEN]; Line 82  char sort_path[MAXFILLEN];
82  char gtags_path[MAXFILLEN];  char gtags_path[MAXFILLEN];
83  char global_path[MAXFILLEN];  char global_path[MAXFILLEN];
84  char findcom[MAXFILLEN];  char findcom[MAXFILLEN];
85  char *null_device = NULL_DEVICE;  const char *null_device = NULL_DEVICE;
86  char *tmpdir = "/tmp";  const char *tmpdir = "/tmp";
87    
88  /*  /*
89   * options   * options
# Line 115  int enable_grep;                       /* 1: enable grep               */ Line 115  int enable_grep;                       /* 1: enable grep               */
115  int enable_idutils;                     /* 1: enable idutils            */  int enable_idutils;                     /* 1: enable idutils            */
116  int enable_xhtml;                       /* 1: enable XHTML              */  int enable_xhtml;                       /* 1: enable XHTML              */
117    
118  char *action_value;  const char *action_value;
119  char *id_value;  const char *id_value;
120  char *cgidir;  const char *cgidir;
121  char *main_func = "main";  const char *main_func = "main";
122  char *style_sheet;  const char *style_sheet;
123  char *cvsweb_url;  const char *cvsweb_url;
124  char *cvsweb_cvsroot;  const char *cvsweb_cvsroot;
125  char *gtagslabel;  const char *gtagslabel;
126  char *title;  const char *title;
127    
128  /*  /*
129   * Constant values.   * Constant values.
130   */   */
131  char *title_define_index = "DEFINITIONS";  const char *title_define_index = "DEFINITIONS";
132  char *title_file_index = "FILES";  const char *title_file_index = "FILES";
133  char *title_included_from = "INCLUDED FROM";  const char *title_included_from = "INCLUDED FROM";
134  /*  /*
135   * Function header items.   * Function header items.
136   */   */
137  char *anchor_label[] = {  const char *anchor_label[] = {
138          "<",          "<",
139          ">",          ">",
140          "^",          "^",
# Line 144  char *anchor_label[] = { Line 144  char *anchor_label[] = {
144          "index",          "index",
145          "help"          "help"
146  };  };
147  char *anchor_icons[] = {  const char *anchor_icons[] = {
148          "left",          "left",
149          "right",          "right",
150          "first",          "first",
# Line 154  char *anchor_icons[] = { Line 154  char *anchor_icons[] = {
154          "index",          "index",
155          "help"          "help"
156  };  };
157  char *anchor_comment[] = {  const char *anchor_comment[] = {
158          "previous",          "previous",
159          "next",          "next",
160          "first",          "first",
# Line 164  char *anchor_comment[] = { Line 164  char *anchor_comment[] = {
164          "index",          "index",
165          "help"          "help"
166  };  };
167  char *anchor_msg[] = {  const char *anchor_msg[] = {
168          "Previous definition.",          "Previous definition.",
169          "Next definition.",          "Next definition.",
170          "First definition in this file.",          "First definition in this file.",
# Line 174  char *anchor_msg[] = { Line 174  char *anchor_msg[] = {
174          "Return to index page.",          "Return to index page.",
175          "You are seeing now."          "You are seeing now."
176  };  };
177  char *back_icon = "back";  const char *back_icon = "back";
178  char *dir_icon  = "dir";  const char *dir_icon  = "dir";
179  char *c_icon = "c";  const char *c_icon = "c";
180  char *file_icon = "text";  const char *file_icon = "text";
181    
182  /*  /*
183   * Configuration parameters.   * Configuration parameters.
# Line 187  int tabs = 8;                          /* tab skip                     */ Line 187  int tabs = 8;                          /* tab skip                     */
187  char stabs[8];                          /* tab skip (string)            */  char stabs[8];                          /* tab skip (string)            */
188  int full_path = 0;                      /* file index format            */  int full_path = 0;                      /* file index format            */
189  int map_file = 1;                       /* 1: create MAP file           */  int map_file = 1;                       /* 1: create MAP file           */
190  char *icon_list = NULL;                 /* use icon list                */  const char *icon_list = NULL;           /* use icon list                */
191  char *icon_suffix = "png";              /* icon suffix (jpg, png etc)   */  const char *icon_suffix = "png";        /* icon suffix (jpg, png etc)   */
192  char *icon_spec = "border='0' align='top'";/* parameter in IMG tag      */  const char *icon_spec = "border='0' align='top'";/* parameter in IMG tag*/
193  char *prolog_script = NULL;             /* include script at first      */  const char *prolog_script = NULL;       /* include script at first      */
194  char *epilog_script = NULL;             /* include script at last       */  const char *epilog_script = NULL;       /* include script at last       */
195  int show_position = 0;                  /* show current position        */  int show_position = 0;                  /* show current position        */
196  int table_list = 0;                     /* tag list using table tag     */  int table_list = 0;                     /* tag list using table tag     */
197  int colorize_warned_line = 0;           /* colorize warned line         */  int colorize_warned_line = 0;           /* colorize warned line         */
198  char *script_alias = "/cgi-bin";        /* script alias of WWW server   */  const char *script_alias = "/cgi-bin";  /* script alias of WWW server   */
199  char *gzipped_suffix = "ghtml";         /* suffix of gzipped html file  */  const char *gzipped_suffix = "ghtml";   /* suffix of gzipped html file  */
200  char *normal_suffix = "html";           /* suffix of normal html file   */  const char *normal_suffix = "html";     /* suffix of normal html file   */
201  char *HTML;  const char *HTML;
202  char *action = "cgi-bin/global.cgi";    /* default action               */  const char *action = "cgi-bin/global.cgi";/* default action             */
203  char *saction;                          /* safe action                  */  const char *saction;                    /* safe action                  */
204  char *id = NULL;                        /* id (default non)             */  const char *id = NULL;                  /* id (default non)             */
205  int cgi = 1;                            /* 1: make cgi-bin/             */  int cgi = 1;                            /* 1: make cgi-bin/             */
206  int definition_header=NO_HEADER;        /* (NO|BEFORE|RIGHT|AFTER)_HEADER */  int definition_header=NO_HEADER;        /* (NO|BEFORE|RIGHT|AFTER)_HEADER */
207  char *htags_options = NULL;  const char *htags_options = NULL;
208  char *include_file_suffixes = "h,hxx,hpp,H,inc.php";  const char *include_file_suffixes = "h,hxx,hpp,H,inc.php";
209  static char *langmap = DEFAULTLANGMAP;  static const char *langmap = DEFAULTLANGMAP;
210    
211  static struct option const long_options[] = {  static struct option const long_options[] = {
212          {"alphabet", no_argument, NULL, 'a'},          {"alphabet", no_argument, NULL, 'a'},
# Line 316  generate_file(dist, file) Line 316  generate_file(dist, file)
316          char *_;          char *_;
317          int i;          int i;
318          struct map {          struct map {
319                  char *name;                  const char *name;
320                  char *value;                  const char *value;
321          } tab[] = {          } tab[] = {
322                  {"@page_begin@", NULL},                  {"@page_begin@", NULL},
323                  {"@page_end@", NULL},                  {"@page_end@", NULL},
# Line 375  generate_file(dist, file) Line 375  generate_file(dist, file)
375           * Read templete file and evaluate macros.           * Read templete file and evaluate macros.
376           */           */
377          while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) {          while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) {
378                  char *p;                  const char *p;
379    
380                  /* Pick up macro name */                  /* Pick up macro name */
381                  for (p = _; !regexec(&preg, p, 2, pmatch, 0); p += pmatch[0].rm_eo) {                  for (p = _; !regexec(&preg, p, 2, pmatch, 0); p += pmatch[0].rm_eo) {
382                          char *start = p + pmatch[0].rm_so;                          const char *start = p + pmatch[0].rm_so;
383                          int length = pmatch[0].rm_eo - pmatch[0].rm_so;                          int length = pmatch[0].rm_eo - pmatch[0].rm_so;
384    
385                          /* print before macro */                          /* print before macro */
# Line 392  generate_file(dist, file) Line 392  generate_file(dist, file)
392                                  die("something wrong.");                                  die("something wrong.");
393                          /* print macro value */                          /* print macro value */
394                          if (i < tabsize) {                          if (i < tabsize) {
395                                  char *q;                                  const char *q;
396                                  /*                                  /*
397                                   * Double quote should be quoted using '\\'.                                   * Double quote should be quoted using '\\'.
398                                   */                                   */
# Line 431  static void Line 431  static void
431  makebless(file)  makebless(file)
432          const char *file;          const char *file;
433  {  {
434          char *save = action;          const char *save = action;
435          action = saction;          action = saction;
436          generate_file(distpath, file);          generate_file(distpath, file);
437          action = save;          action = save;
# Line 487  static void Line 487  static void
487  makehelp(file)  makehelp(file)
488          const char *file;          const char *file;
489  {  {
490          char **label = icon_list ? anchor_comment : anchor_label;          const char **label = icon_list ? anchor_comment : anchor_label;
491          char **icons = anchor_icons;          const char **icons = anchor_icons;
492          char **msg   = anchor_msg;          const char **msg   = anchor_msg;
493          int n, last = 7;          int n, last = 7;
494          FILE *op;          FILE *op;
495    
# Line 740  makehtml(total) Line 740  makehtml(total)
740          int total;          int total;
741  {  {
742          FILE *ip;          FILE *ip;
743          char *_, *p;          const char *_;
744          int count = 0;          int count = 0;
745          char command[MAXFILLEN];          char command[MAXFILLEN], path[MAXPATHLEN];
         char path[MAXPATHLEN];  
746          STRBUF *sb = strbuf_open(0);          STRBUF *sb = strbuf_open(0);
747    
748          if (other_files && !dynamic)          if (other_files && !dynamic)
# Line 755  makehtml(total) Line 754  makehtml(total)
754                  die("cannot execute command '%s'.", command);                  die("cannot execute command '%s'.", command);
755          while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) {          while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) {
756                  int notsource = 0;                  int notsource = 0;
757                    const char *p;
758    
759                  if (*_ == ' ') {                  if (*_ == ' ') {
760                          if (!other_files)                          if (!other_files)
# Line 845  makecommonpart(title, defines, files) Line 845  makecommonpart(title, defines, files)
845          STRBUF *sb = strbuf_open(0);          STRBUF *sb = strbuf_open(0);
846          STRBUF *ib = strbuf_open(0);          STRBUF *ib = strbuf_open(0);
847          char command[MAXFILLEN];          char command[MAXFILLEN];
848          char *_;          const char *_;
849    
850          if (include_header) {          if (include_header) {
851                  strbuf_puts_nl(sb, include_header);                  strbuf_puts_nl(sb, include_header);
# Line 939  makecommonpart(title, defines, files) Line 939  makecommonpart(title, defines, files)
939  static void  static void
940  basic_check(void)  basic_check(void)
941  {  {
942          char *p;          const char *p;
943    
944          /*          /*
945           * COMMAND EXISTENCE CHECK           * COMMAND EXISTENCE CHECK
# Line 1129  configuration(argc, argv) Line 1129  configuration(argc, argv)
1129                  p = strdup(strbuf_value(sb));                  p = strdup(strbuf_value(sb));
1130                  if (p == NULL)                  if (p == NULL)
1131                          die("short of memory.");                          die("short of memory.");
                 script_alias = p;  
1132                  /* remove the last '/' */                  /* remove the last '/' */
1133                  p = script_alias + strlen(script_alias) - 1;                  q = p + strlen(p) - 1;
1134                  if (*p == '/')                  if (*q == '/')
1135                          *p = '\0';                          *q = '\0';
1136                    script_alias = p;
1137          }          }
1138          if (getconfb("symbols"))        /* for backward compatibility */          if (getconfb("symbols"))        /* for backward compatibility */
1139                  symbol = 1;                  symbol = 1;
# Line 1322  save_environment(argc, argv) Line 1322  save_environment(argc, argv)
1322          STRBUF *save_c = strbuf_open(0);          STRBUF *save_c = strbuf_open(0);
1323          STRBUF *save_a = strbuf_open(0);          STRBUF *save_a = strbuf_open(0);
1324          int i;          int i;
1325          char *p;          const char *p;
1326          FILE *ip;          FILE *ip;
1327    
1328          /*          /*
# Line 1390  append_options(argc, argv) Line 1390  append_options(argc, argv)
1390  {  {
1391    
1392          STRBUF *sb = strbuf_open(0);          STRBUF *sb = strbuf_open(0);
1393          char *p, *opt = strdup(htags_options);          const char *p, *opt = strdup(htags_options);
1394          int count = 1;          int count = 1;
1395          int quote = 0;          int quote = 0;
1396          char **newargv;          const char **newargv;
1397          int i = 0, j = 1;          int i = 0, j = 1;
1398    
1399          if (!opt)          if (!opt)
# Line 1422  append_options(argc, argv) Line 1422  append_options(argc, argv)
1422                          strbuf_putc(sb, *p);                          strbuf_putc(sb, *p);
1423                  }                  }
1424          }          }
1425          newargv = (char **)malloc(sizeof(char *) * (*argc + count + 1));          newargv = (const char **)malloc(sizeof(char *) * (*argc + count + 1));
1426          if (!newargv)          if (!newargv)
1427                  die("Short of memory.");                  die("Short of memory.");
1428          newargv[i++] = argv[0];          newargv[i++] = argv[0];
# Line 1434  append_options(argc, argv) Line 1434  append_options(argc, argv)
1434          while (j < *argc)          while (j < *argc)
1435                  newargv[i++] = argv[j++];                  newargv[i++] = argv[j++];
1436          newargv[i] = NULL;          newargv[i] = NULL;
1437          argv = newargv;          argv = (char **)newargv;
1438          *argc = i;          *argc = i;
1439  #ifdef DEBUG  #ifdef DEBUG
1440          for (i = 0; i < *argc; i++)          for (i = 0; i < *argc; i++)
# Line 1449  main(argc, argv) Line 1449  main(argc, argv)
1449          int argc;          int argc;
1450          char *argv[];          char *argv[];
1451  {  {
1452          char *path, *av = NULL;          const char *path, *av = NULL;
1453          int func_total, file_total;          int func_total, file_total;
1454          char arg_dbpath[MAXPATHLEN];          char arg_dbpath[MAXPATHLEN];
1455          char *index = NULL;          const char *index = NULL;
1456          int optchar;          int optchar;
1457          int option_index = 0;          int option_index = 0;
1458          time_t start_time, end_time, start_all_time, end_all_time,          time_t start_time, end_time, start_all_time, end_all_time,
# Line 1946  main(argc, argv) Line 1946  main(argc, argv)
1946                          message(" gzipped files. (Please see 'HTML/.htaccess')\n");                          message(" gzipped files. (Please see 'HTML/.htaccess')\n");
1947                  }                  }
1948                  if (fflag || dynamic) {                  if (fflag || dynamic) {
1949                          char *path = (*action == '/') ? makepath("DOCUMENT_ROOT", action, NULL) : makepath("HTML", action, NULL);                          const char *path = (*action == '/') ? makepath("DOCUMENT_ROOT", action, NULL) : makepath("HTML", action, NULL);
1950    
1951                          message(" You need to setup http server so that %s", path);                          message(" You need to setup http server so that %s", path);
1952                          message(" is executed as a CGI script. (DOCUMENT_ROOT means WWW server's data root.)\n");                          message(" is executed as a CGI script. (DOCUMENT_ROOT means WWW server's data root.)\n");

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26