[geany/geany] 6bc579: Don't use combination of tabs and spaces for indentation
Jiří Techet
git-noreply at xxxxx
Sat Sep 10 07:26:09 UTC 2016
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Fri, 29 Jul 2016 20:03:56 UTC
Commit: 6bc579798716dbe94a171a016f9989c92c4b67e2
https://github.com/geany/geany/commit/6bc579798716dbe94a171a016f9989c92c4b67e2
Log Message:
-----------
Don't use combination of tabs and spaces for indentation
This was done using Geany's "replace tabs with spaces" followed by
"replace spaces with tabs" plus a lot of manual work because the
indentation was inconsistent in many cases.
Modified Paths:
--------------
ctags/main/args.c
ctags/main/args.h
ctags/main/ctags.c
ctags/main/ctags.h
ctags/main/entry.c
ctags/main/entry.h
ctags/main/general.h
ctags/main/main.h
ctags/main/options.c
ctags/main/options.h
ctags/main/parse.c
ctags/main/parse.h
ctags/main/parsers.h
ctags/main/read.c
ctags/main/read.h
ctags/main/sort.c
ctags/main/sort.h
ctags/main/vstring.c
ctags/main/vstring.h
ctags/parsers/asciidoc.c
ctags/parsers/c.c
ctags/parsers/conf.c
ctags/parsers/css.c
ctags/parsers/diff.c
ctags/parsers/fortran.c
ctags/parsers/haskell.c
ctags/parsers/haxe.c
ctags/parsers/latex.c
ctags/parsers/matlab.c
ctags/parsers/nsis.c
ctags/parsers/pascal.c
ctags/parsers/python.c
ctags/parsers/r.c
ctags/parsers/rest.c
ctags/parsers/sh.c
ctags/parsers/vhdl.c
Modified: ctags/main/args.c
320 lines changed, 160 insertions(+), 160 deletions(-)
===================================================================
@@ -11,7 +11,7 @@
/*
* INCLUDE FILES
*/
-#include "general.h" /* must always come first */
+#include "general.h" /* must always come first */
#include <stdio.h>
#include <string.h>
@@ -26,231 +26,231 @@
static char *nextStringArg (const char** const next)
{
- char* result = NULL;
- const char* start;
+ char* result = NULL;
+ const char* start;
- Assert (*next != NULL);
- for (start = *next ; isspace ((int) *start) ; ++start)
- ;
- if (*start == '\0')
- *next = start;
- else
- {
- size_t length;
- const char* end;
+ Assert (*next != NULL);
+ for (start = *next ; isspace ((int) *start) ; ++start)
+ ;
+ if (*start == '\0')
+ *next = start;
+ else
+ {
+ size_t length;
+ const char* end;
- for (end = start ; *end != '\0' && ! isspace ((int) *end) ; ++end)
- ;
- length = end - start;
- Assert (length > 0);
- result = xMalloc (length + 1, char);
- strncpy (result, start, length);
- result [length] = '\0';
- *next = end;
- }
- return result;
+ for (end = start ; *end != '\0' && ! isspace ((int) *end) ; ++end)
+ ;
+ length = end - start;
+ Assert (length > 0);
+ result = xMalloc (length + 1, char);
+ strncpy (result, start, length);
+ result [length] = '\0';
+ *next = end;
+ }
+ return result;
}
static char* nextStringLine (const char** const next)
{
- char* result = NULL;
- size_t length;
- const char* end;
+ char* result = NULL;
+ size_t length;
+ const char* end;
- Assert (*next != NULL);
- for (end = *next ; *end != '\n' && *end != '\0' ; ++end)
- ;
- length = end - *next;
- if (length > 0)
- {
- result = xMalloc (length + 1, char);
- strncpy (result, *next, length);
- result [length] = '\0';
- }
- if (*end == '\n')
- ++end;
- *next = end;
- return result;
+ Assert (*next != NULL);
+ for (end = *next ; *end != '\n' && *end != '\0' ; ++end)
+ ;
+ length = end - *next;
+ if (length > 0)
+ {
+ result = xMalloc (length + 1, char);
+ strncpy (result, *next, length);
+ result [length] = '\0';
+ }
+ if (*end == '\n')
+ ++end;
+ *next = end;
+ return result;
}
static char* nextString (const Arguments* const current, const char** const next)
{
- char* result;
- if (current->lineMode)
- result = nextStringLine (next);
- else
- result = nextStringArg (next);
- return result;
+ char* result;
+ if (current->lineMode)
+ result = nextStringLine (next);
+ else
+ result = nextStringArg (next);
+ return result;
}
static char* nextFileArg (FILE* const fp)
{
- char* result = NULL;
- Assert (fp != NULL);
- if (! feof (fp))
- {
- vString* vs = vStringNew ();
- int c;
- do
- c = fgetc (fp);
- while (isspace (c));
-
- if (c != EOF)
+ char* result = NULL;
+ Assert (fp != NULL);
+ if (! feof (fp))
{
- do
- {
- vStringPut (vs, c);
- c = fgetc (fp);
- } while (c != EOF && ! isspace (c));
- vStringTerminate (vs);
- Assert (vStringLength (vs) > 0);
- result = xMalloc (vStringLength (vs) + 1, char);
- strcpy (result, vStringValue (vs));
+ vString* vs = vStringNew ();
+ int c;
+ do
+ c = fgetc (fp);
+ while (isspace (c));
+
+ if (c != EOF)
+ {
+ do
+ {
+ vStringPut (vs, c);
+ c = fgetc (fp);
+ } while (c != EOF && ! isspace (c));
+ vStringTerminate (vs);
+ Assert (vStringLength (vs) > 0);
+ result = xMalloc (vStringLength (vs) + 1, char);
+ strcpy (result, vStringValue (vs));
+ }
+ vStringDelete (vs);
}
- vStringDelete (vs);
- }
- return result;
+ return result;
}
static char* nextFileLine (FILE* const fp)
{
- char* result = NULL;
- Assert (fp != NULL);
- if (! feof (fp))
- {
- vString* vs = vStringNew ();
- int c;
-
- c = fgetc (fp);
- while (c != EOF && c != '\n')
- {
- vStringPut (vs, c);
- c = fgetc (fp);
- }
- vStringTerminate (vs);
- if (vStringLength (vs) > 0)
+ char* result = NULL;
+ Assert (fp != NULL);
+ if (! feof (fp))
{
- result = xMalloc (vStringLength (vs) + 1, char);
- strcpy (result, vStringValue (vs));
+ vString* vs = vStringNew ();
+ int c;
+
+ c = fgetc (fp);
+ while (c != EOF && c != '\n')
+ {
+ vStringPut (vs, c);
+ c = fgetc (fp);
+ }
+ vStringTerminate (vs);
+ if (vStringLength (vs) > 0)
+ {
+ result = xMalloc (vStringLength (vs) + 1, char);
+ strcpy (result, vStringValue (vs));
+ }
+ vStringDelete (vs);
}
- vStringDelete (vs);
- }
- return result;
+ return result;
}
static char* nextFileString (const Arguments* const current, FILE* const fp)
{
- char* result;
- if (current->lineMode)
- result = nextFileLine (fp);
- else
- result = nextFileArg (fp);
- return result;
+ char* result;
+ if (current->lineMode)
+ result = nextFileLine (fp);
+ else
+ result = nextFileArg (fp);
+ return result;
}
extern Arguments* argNewFromString (const char* const string)
{
- Arguments* result = xMalloc (1, Arguments);
- memset (result, 0, sizeof (Arguments));
- result->type = ARG_STRING;
- result->u.stringArgs.string = string;
- result->u.stringArgs.item = string;
- result->u.stringArgs.next = string;
- result->item = nextString (result, &result->u.stringArgs.next);
- return result;
+ Arguments* result = xMalloc (1, Arguments);
+ memset (result, 0, sizeof (Arguments));
+ result->type = ARG_STRING;
+ result->u.stringArgs.string = string;
+ result->u.stringArgs.item = string;
+ result->u.stringArgs.next = string;
+ result->item = nextString (result, &result->u.stringArgs.next);
+ return result;
}
extern Arguments* argNewFromArgv (char* const* const argv)
{
- Arguments* result = xMalloc (1, Arguments);
- memset (result, 0, sizeof (Arguments));
- result->type = ARG_ARGV;
- result->u.argvArgs.argv = argv;
- result->u.argvArgs.item = result->u.argvArgs.argv;
- result->item = *result->u.argvArgs.item;
- return result;
+ Arguments* result = xMalloc (1, Arguments);
+ memset (result, 0, sizeof (Arguments));
+ result->type = ARG_ARGV;
+ result->u.argvArgs.argv = argv;
+ result->u.argvArgs.item = result->u.argvArgs.argv;
+ result->item = *result->u.argvArgs.item;
+ return result;
}
extern Arguments* argNewFromFile (FILE* const fp)
{
- Arguments* result = xMalloc (1, Arguments);
- memset (result, 0, sizeof (Arguments));
- result->type = ARG_FILE;
- result->u.fileArgs.fp = fp;
- result->item = nextFileString (result, result->u.fileArgs.fp);
- return result;
+ Arguments* result = xMalloc (1, Arguments);
+ memset (result, 0, sizeof (Arguments));
+ result->type = ARG_FILE;
+ result->u.fileArgs.fp = fp;
+ result->item = nextFileString (result, result->u.fileArgs.fp);
+ return result;
}
extern Arguments* argNewFromLineFile (FILE* const fp)
{
- Arguments* result = xMalloc (1, Arguments);
- memset (result, 0, sizeof (Arguments));
- result->type = ARG_FILE;
- result->lineMode = TRUE;
- result->u.fileArgs.fp = fp;
- result->item = nextFileString (result, result->u.fileArgs.fp);
- return result;
+ Arguments* result = xMalloc (1, Arguments);
+ memset (result, 0, sizeof (Arguments));
+ result->type = ARG_FILE;
+ result->lineMode = TRUE;
+ result->u.fileArgs.fp = fp;
+ result->item = nextFileString (result, result->u.fileArgs.fp);
+ return result;
}
extern char *argItem (const Arguments* const current)
{
- Assert (current != NULL);
- Assert (! argOff (current));
- return current->item;
+ Assert (current != NULL);
+ Assert (! argOff (current));
+ return current->item;
}
extern boolean argOff (const Arguments* const current)
{
- Assert (current != NULL);
- return (boolean) (current->item == NULL);
+ Assert (current != NULL);
+ return (boolean) (current->item == NULL);
}
extern void argSetWordMode (Arguments* const current)
{
- Assert (current != NULL);
- current->lineMode = FALSE;
+ Assert (current != NULL);
+ current->lineMode = FALSE;
}
extern void argSetLineMode (Arguments* const current)
{
- Assert (current != NULL);
- current->lineMode = TRUE;
+ Assert (current != NULL);
+ current->lineMode = TRUE;
}
extern void argForth (Arguments* const current)
{
- Assert (current != NULL);
- Assert (! argOff (current));
- switch (current->type)
- {
- case ARG_STRING:
- if (current->item != NULL)
- eFree (current->item);
- current->u.stringArgs.item = current->u.stringArgs.next;
- current->item = nextString (current, ¤t->u.stringArgs.next);
- break;
- case ARG_ARGV:
- ++current->u.argvArgs.item;
- current->item = *current->u.argvArgs.item;
- break;
- case ARG_FILE:
- if (current->item != NULL)
- eFree (current->item);
- current->item = nextFileString (current, current->u.fileArgs.fp);
- break;
- default:
- Assert ("Invalid argument type" == NULL);
- break;
- }
+ Assert (current != NULL);
+ Assert (! argOff (current));
+ switch (current->type)
+ {
+ case ARG_STRING:
+ if (current->item != NULL)
+ eFree (current->item);
+ current->u.stringArgs.item = current->u.stringArgs.next;
+ current->item = nextString (current, ¤t->u.stringArgs.next);
+ break;
+ case ARG_ARGV:
+ ++current->u.argvArgs.item;
+ current->item = *current->u.argvArgs.item;
+ break;
+ case ARG_FILE:
+ if (current->item != NULL)
+ eFree (current->item);
+ current->item = nextFileString (current, current->u.fileArgs.fp);
+ break;
+ default:
+ Assert ("Invalid argument type" == NULL);
+ break;
+ }
}
extern void argDelete (Arguments* const current)
{
- Assert (current != NULL);
- if (current->type == ARG_STRING && current->item != NULL)
- eFree (current->item);
- memset (current, 0, sizeof (Arguments));
- eFree (current);
+ Assert (current != NULL);
+ if (current->type == ARG_STRING && current->item != NULL)
+ eFree (current->item);
+ memset (current, 0, sizeof (Arguments));
+ eFree (current);
}
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/args.h
40 lines changed, 20 insertions(+), 20 deletions(-)
===================================================================
@@ -13,30 +13,30 @@
/*
* INCLUDE FILES
*/
-#include "general.h" /* must always come first */
+#include "general.h" /* must always come first */
/*
* DATA DECLARATIONS
*/
typedef struct sArgs {
- enum { ARG_NONE, ARG_STRING, ARG_ARGV, ARG_FILE } type;
- union {
- struct sStringArgs {
- const char* string;
- const char* next;
- const char* item;
- } stringArgs;
- struct sArgvArgs {
- char* const* argv;
- char* const* item;
- } argvArgs;
- struct sFileArgs {
- FILE* fp;
- } fileArgs;
- } u;
- char* item;
- boolean lineMode;
+ enum { ARG_NONE, ARG_STRING, ARG_ARGV, ARG_FILE } type;
+ union {
+ struct sStringArgs {
+ const char* string;
+ const char* next;
+ const char* item;
+ } stringArgs;
+ struct sArgvArgs {
+ char* const* argv;
+ char* const* item;
+ } argvArgs;
+ struct sFileArgs {
+ FILE* fp;
+ } fileArgs;
+ } u;
+ char* item;
+ boolean lineMode;
} Arguments;
/*
@@ -53,6 +53,6 @@ extern void argSetLineMode (Arguments* const current);
extern void argForth (Arguments* const current);
extern void argDelete (Arguments* const current);
-#endif /* _ARGS_H */
+#endif /* _ARGS_H */
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/ctags.c
1496 lines changed, 748 insertions(+), 748 deletions(-)
===================================================================
@@ -19,24 +19,24 @@
/*
* INCLUDE FILES
*/
-#include "general.h" /* must always come first */
+#include "general.h" /* must always come first */
#include <glib.h>
#include <glib/gstdio.h>
#ifdef HAVE_STDLIB_H
-# include <stdlib.h> /* to declare malloc (), realloc () */
+# include <stdlib.h> /* to declare malloc (), realloc () */
#endif
#include <string.h>
#include <errno.h>
#include <ctype.h>
-#include <stdio.h> /* to declare SEEK_SET (hopefully) */
-# include <fcntl.h> /* to declar O_RDWR, O_CREAT, O_EXCL */
-# include <unistd.h> /* to declare mkstemp () */
+#include <stdio.h> /* to declare SEEK_SET (hopefully) */
+# include <fcntl.h> /* to declar O_RDWR, O_CREAT, O_EXCL */
+# include <unistd.h> /* to declare mkstemp () */
#ifdef AMIGA
-# include <dos/dosasl.h> /* for struct AnchorPath */
-# include <clib/dos_protos.h> /* function prototypes */
+# include <dos/dosasl.h> /* for struct AnchorPath */
+# include <clib/dos_protos.h> /* function prototypes */
# define ANCHOR_BUF_SIZE 512
# define ANCHOR_SIZE (sizeof (struct AnchorPath) + ANCHOR_BUF_SIZE)
# ifdef __SASC
@@ -76,16 +76,16 @@
# undef boolean
#endif
#ifdef HAVE_DIRECT_H
-# include <direct.h> /* to _getcwd */
+# include <direct.h> /* to _getcwd */
#endif
#ifdef HAVE_DOS_H
-# include <dos.h> /* to declare FA_DIREC */
+# include <dos.h> /* to declare FA_DIREC */
#endif
#ifdef HAVE_DIR_H
-# include <dir.h> /* to declare findfirst () and findnext () */
+# include <dir.h> /* to declare findfirst () and findnext () */
#endif
#ifdef HAVE_IO_H
-# include <io.h> /* to declare _finddata_t in MSVC++ 4.x */
+# include <io.h> /* to declare _finddata_t in MSVC++ 4.x */
#endif
/* To provide timings features if available.
@@ -121,8 +121,8 @@
/*
* Miscellaneous macros
*/
-#define selected(var,feature) (((int)(var) & (int)(feature)) == (int)feature)
-#define plural(value) (((unsigned long)(value) == 1L) ? "" : "s")
+#define selected(var,feature) (((int)(var) & (int)(feature)) == (int)feature)
+#define plural(value) (((unsigned long)(value) == 1L) ? "" : "s")
/*
* Portability macros
@@ -138,34 +138,34 @@
#endif
#if defined (MSDOS_STYLE_PATH) && defined (UNIX_PATH_SEPARATOR)
-# define OUTPUT_PATH_SEPARATOR '/'
+# define OUTPUT_PATH_SEPARATOR '/'
#else
-# define OUTPUT_PATH_SEPARATOR PATH_SEPARATOR
+# define OUTPUT_PATH_SEPARATOR PATH_SEPARATOR
#endif
/* File type tests.
*/
#ifndef S_ISREG
# if defined (S_IFREG) && ! defined (AMIGA)
-# define S_ISREG(mode) ((mode) & S_IFREG)
+# define S_ISREG(mode) ((mode) & S_IFREG)
# else
-# define S_ISREG(mode) TRUE /* assume regular file */
+# define S_ISREG(mode) TRUE /* assume regular file */
# endif
#endif
#ifndef S_ISLNK
# ifdef S_IFLNK
-# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
+# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
# else
-# define S_ISLNK(mode) FALSE /* assume no soft links */
+# define S_ISLNK(mode) FALSE /* assume no soft links */
# endif
#endif
#ifndef S_ISDIR
# ifdef S_IFDIR
-# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
# else
-# define S_ISDIR(mode) FALSE /* assume no soft links */
+# define S_ISDIR(mode) FALSE /* assume no soft links */
# endif
#endif
@@ -255,246 +255,246 @@ static boolean createTagsForEntry (const char *const entryName);
extern const char *getExecutableName (void)
{
- return ExecutableName;
+ return ExecutableName;
}
#if 0
static void setCurrentDirectory (void)
{
#ifdef AMIGA
- char* const cwd = eStrdup (".");
+ char* const cwd = eStrdup (".");
#else
- char* const cwd = getcwd (NULL, PATH_MAX);
-#endif
- CurrentDirectory = xMalloc (strlen (cwd) + 2, char);
- if (cwd [strlen (cwd) - (size_t) 1] == PATH_SEPARATOR)
- strcpy (CurrentDirectory, cwd);
- else
- sprintf (CurrentDirectory, "%s%c", cwd, OUTPUT_PATH_SEPARATOR);
- free (cwd);
+ char* const cwd = getcwd (NULL, PATH_MAX);
+#endif
+ CurrentDirectory = xMalloc (strlen (cwd) + 2, char);
+ if (cwd [strlen (cwd) - (size_t) 1] == PATH_SEPARATOR)
+ strcpy (CurrentDirectory, cwd);
+ else
+ sprintf (CurrentDirectory, "%s%c", cwd, OUTPUT_PATH_SEPARATOR);
+ free (cwd);
}
#endif
extern void error (const errorSelection selection,
- const char *const format, ...)
+ const char *const format, ...)
{
- va_list ap;
-
- va_start (ap, format);
- fprintf (errout, "%s: %s", getExecutableName (),
- selected (selection, WARNING) ? "Warning: " : "");
- vfprintf (errout, format, ap);
- if (selected (selection, PERROR))
- fprintf (errout, " : %s", g_strerror (errno));
- fputs ("\n", errout);
- va_end (ap);
- if (selected (selection, FATAL))
- exit (1);
+ va_list ap;
+
+ va_start (ap, format);
+ fprintf (errout, "%s: %s", getExecutableName (),
+ selected (selection, WARNING) ? "Warning: " : "");
+ vfprintf (errout, format, ap);
+ if (selected (selection, PERROR))
+ fprintf (errout, " : %s", g_strerror (errno));
+ fputs ("\n", errout);
+ va_end (ap);
+ if (selected (selection, FATAL))
+ exit (1);
}
#ifndef HAVE_STRICMP
extern int stricmp (const char *s1, const char *s2)
{
- int result;
- do
- {
- result = toupper ((int) *s1) - toupper ((int) *s2);
- } while (result == 0 && *s1++ != '\0' && *s2++ != '\0');
- return result;
+ int result;
+ do
+ {
+ result = toupper ((int) *s1) - toupper ((int) *s2);
+ } while (result == 0 && *s1++ != '\0' && *s2++ != '\0');
+ return result;
}
#endif
#ifndef HAVE_STRNICMP
extern int strnicmp (const char *s1, const char *s2, size_t n)
{
- int result;
- do
- {
- result = toupper ((int) *s1) - toupper ((int) *s2);
- } while (result == 0 && --n > 0 && *s1++ != '\0' && *s2++ != '\0');
- return result;
+ int result;
+ do
+ {
+ result = toupper ((int) *s1) - toupper ((int) *s2);
+ } while (result == 0 && --n > 0 && *s1++ != '\0' && *s2++ != '\0');
+ return result;
}
#endif
#ifndef HAVE_STRSTR
extern char* strstr (const char *str, const char *substr)
{
- const size_t length = strlen (substr);
- const char *match = NULL;
- const char *p;
-
- for (p = str ; *p != '\0' && match == NULL ; ++p)
- if (strncmp (p, substr, length) == 0)
- match = p;
- return (char*) match;
+ const size_t length = strlen (substr);
+ const char *match = NULL;
+ const char *p;
+
+ for (p = str ; *p != '\0' && match == NULL ; ++p)
+ if (strncmp (p, substr, length) == 0)
+ match = p;
+ return (char*) match;
}
#endif
extern char* eStrdup (const char* str)
{
- char* result = xMalloc (strlen (str) + 1, char);
- strcpy (result, str);
- return result;
+ char* result = xMalloc (strlen (str) + 1, char);
+ strcpy (result, str);
+ return result;
}
extern void *eMalloc (const size_t size)
{
- void *buffer = g_malloc (size);
+ void *buffer = g_malloc (size);
- if (buffer == NULL)
- error (FATAL, "out of memory");
+ if (buffer == NULL)
+ error (FATAL, "out of memory");
- return buffer;
+ return buffer;
}
extern void *eCalloc (const size_t count, const size_t size)
{
- void *buffer = calloc (count, size);
+ void *buffer = calloc (count, size);
- if (buffer == NULL)
- error (FATAL, "out of memory");
+ if (buffer == NULL)
+ error (FATAL, "out of memory");
- return buffer;
+ return buffer;
}
extern void *eRealloc (void *const ptr, const size_t size)
{
- void *buffer;
- if (ptr == NULL)
- buffer = eMalloc (size);
- else
- {
- buffer = g_realloc (ptr, size);
- if (buffer == NULL)
- error (FATAL, "out of memory");
- }
- return buffer;
+ void *buffer;
+ if (ptr == NULL)
+ buffer = eMalloc (size);
+ else
+ {
+ buffer = g_realloc (ptr, size);
+ if (buffer == NULL)
+ error (FATAL, "out of memory");
+ }
+ return buffer;
}
extern void eFree (void *const ptr)
{
- if (ptr != NULL)
- free (ptr);
+ if (ptr != NULL)
+ free (ptr);
}
extern void toLowerString (char* str)
{
- while (*str != '\0')
- {
- *str = tolower ((int) *str);
- ++str;
- }
+ while (*str != '\0')
+ {
+ *str = tolower ((int) *str);
+ ++str;
+ }
}
extern void toUpperString (char* str)
{
- while (*str != '\0')
- {
- *str = toupper ((int) *str);
- ++str;
- }
+ while (*str != '\0')
+ {
+ *str = toupper ((int) *str);
+ ++str;
+ }
}
/* Newly allocated string containing lower case conversion of a string.
*/
extern char* newLowerString (const char* str)
{
- char* const result = xMalloc (strlen (str) + 1, char);
- int i = 0;
- do
- result [i] = tolower ((int) str [i]);
- while (str [i++] != '\0');
- return result;
+ char* const result = xMalloc (strlen (str) + 1, char);
+ int i = 0;
+ do
+ result [i] = tolower ((int) str [i]);
+ while (str [i++] != '\0');
+ return result;
}
/* Newly allocated string containing upper case conversion of a string.
*/
extern char* newUpperString (const char* str)
{
- char* const result = xMalloc (strlen (str) + 1, char);
- int i = 0;
- do
- result [i] = toupper ((int) str [i]);
- while (str [i++] != '\0');
- return result;
+ char* const result = xMalloc (strlen (str) + 1, char);
+ int i = 0;
+ do
+ result [i] = toupper ((int) str [i]);
+ while (str [i++] != '\0');
+ return result;
}
extern long unsigned int getFileSize (const char *const name)
{
- GStatBuf fileStatus;
- unsigned long size = 0;
+ GStatBuf fileStatus;
+ unsigned long size = 0;
- if (g_stat (name, &fileStatus) == 0)
- size = fileStatus.st_size;
+ if (g_stat (name, &fileStatus) == 0)
+ size = fileStatus.st_size;
- return size;
+ return size;
}
#if 0
static boolean isSymbolicLink (const char *const name)
{
#if defined (MSDOS) || defined (WIN32) || defined (VMS) || defined (__EMX__) || defined (AMIGA)
- return FALSE;
+ return FALSE;
#else
- GStatBuf fileStatus;
- boolean result = FALSE;
+ GStatBuf fileStatus;
+ boolean result = FALSE;
- if (g_lstat (name, &fileStatus) == 0)
- result = (boolean) (S_ISLNK (fileStatus.st_mode));
+ if (g_lstat (name, &fileStatus) == 0)
+ result = (boolean) (S_ISLNK (fileStatus.st_mode));
- return result;
+ return result;
#endif
}
static boolean isNormalFile (const char *const name)
{
- GStatBuf fileStatus;
- boolean result = FALSE;
+ GStatBuf fileStatus;
+ boolean result = FALSE;
- if (g_stat (name, &fileStatus) == 0)
- result = (boolean) (S_ISREG (fileStatus.st_mode));
+ if (g_stat (name, &fileStatus) == 0)
+ result = (boolean) (S_ISREG (fileStatus.st_mode));
- return result;
+ return result;
}
#endif
extern boolean isExecutable (const char *const name)
{
- GStatBuf fileStatus;
- boolean result = FALSE;
+ GStatBuf fileStatus;
+ boolean result = FALSE;
- if (g_stat (name, &fileStatus) == 0)
- result = (boolean) ((fileStatus.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) != 0);
+ if (g_stat (name, &fileStatus) == 0)
+ result = (boolean) ((fileStatus.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) != 0);
- return result;
+ return result;
}
extern boolean isSameFile (const char *const name1, const char *const name2)
{
- boolean result = FALSE;
+ boolean result = FALSE;
#ifdef HAVE_STAT_ST_INO
- GStatBuf stat1, stat2;
+ GStatBuf stat1, stat2;
- if (g_stat (name1, &stat1) == 0 && g_stat (name2, &stat2) == 0)
- result = (boolean) (stat1.st_ino == stat2.st_ino);
+ if (g_stat (name1, &stat1) == 0 && g_stat (name2, &stat2) == 0)
+ result = (boolean) (stat1.st_ino == stat2.st_ino);
#endif
- return result;
+ return result;
}
#ifdef HAVE_MKSTEMP
static boolean isSetUID (const char *const name)
{
#if defined (VMS) || defined (MSDOS) || defined (WIN32) || defined (__EMX__) || defined (AMIGA)
- return FALSE;
+ return FALSE;
#else
- GStatBuf fileStatus;
- boolean result = FALSE;
+ GStatBuf fileStatus;
+ boolean result = FALSE;
- if (g_stat (name, &fileStatus) == 0)
- result = (boolean) ((fileStatus.st_mode & S_ISUID) != 0);
+ if (g_stat (name, &fileStatus) == 0)
+ result = (boolean) ((fileStatus.st_mode & S_ISUID) != 0);
- return result;
+ return result;
#endif
}
@@ -503,119 +503,119 @@ static boolean isSetUID (const char *const name)
#if 0
static boolean isDirectory (const char *const name)
{
- boolean result = FALSE;
+ boolean result = FALSE;
#ifdef AMIGA
- struct FileInfoBlock *const fib = xMalloc (1, struct FileInfoBlock);
-
- if (fib != NULL)
- {
- const BPTR flock = Lock ((UBYTE *) name, (long) ACCESS_READ);
+ struct FileInfoBlock *const fib = xMalloc (1, struct FileInfoBlock);
- if (flock != (BPTR) NULL)
+ if (fib != NULL)
{
- if (Examine (flock, fib))
- result = ((fib->fib_DirEntryType >= 0) ? TRUE : FALSE);
- UnLock (flock);
+ const BPTR flock = Lock ((UBYTE *) name, (long) ACCESS_READ);
+
+ if (flock != (BPTR) NULL)
+ {
+ if (Examine (flock, fib))
+ result = ((fib->fib_DirEntryType >= 0) ? TRUE : FALSE);
+ UnLock (flock);
+ }
+ eFree (fib);
}
- eFree (fib);
- }
#else
- GStatBuf fileStatus;
+ GStatBuf fileStatus;
- if (g_stat (name, &fileStatus) == 0)
- result = (boolean) S_ISDIR (fileStatus.st_mode);
+ if (g_stat (name, &fileStatus) == 0)
+ result = (boolean) S_ISDIR (fileStatus.st_mode);
#endif
- return result;
+ return result;
}
#endif
extern boolean doesFileExist (const char *const fileName)
{
- GStatBuf fileStatus;
+ GStatBuf fileStatus;
- return (boolean) (g_stat (fileName, &fileStatus) == 0);
+ return (boolean) (g_stat (fileName, &fileStatus) == 0);
}
/*#ifndef HAVE_FGETPOS*/
/*
extern int fgetpos ( stream, pos )
- FILE *const stream;
- fpos_t *const pos;
+ FILE *const stream;
+ fpos_t *const pos;
{
- int result = 0;
+ int result = 0;
- *pos = ftell (stream);
- if (*pos == -1L)
- result = -1;
+ *pos = ftell (stream);
+ if (*pos == -1L)
+ result = -1;
- return result;
+ return result;
}
extern int fsetpos ( stream, pos )
- FILE *const stream;
- fpos_t *const pos;
+ FILE *const stream;
+ fpos_t *const pos;
{
- return fseek (stream, *pos, SEEK_SET);
+ return fseek (stream, *pos, SEEK_SET);
}
*/
/*#endif*/
extern void addTotals (const unsigned int files,
- const long unsigned int lines,
- const long unsigned int bytes)
+ const long unsigned int lines,
+ const long unsigned int bytes)
{
- Totals.files += files;
- Totals.lines += lines;
- Totals.bytes += bytes;
+ Totals.files += files;
+ Totals.lines += lines;
+ Totals.bytes += bytes;
}
extern boolean isDestinationStdout (void)
{
- boolean toStdout = FALSE;
+ boolean toStdout = FALSE;
- if (Option.xref || Option.filter ||
- (Option.tagFileName != NULL && (strcmp (Option.tagFileName, "-") == 0
+ if (Option.xref || Option.filter ||
+ (Option.tagFileName != NULL && (strcmp (Option.tagFileName, "-") == 0
#if defined (VMS)
- || strcmp (Option.tagFileName, "sys$output") == 0
+ || strcmp (Option.tagFileName, "sys$output") == 0
#else
- || strcmp (Option.tagFileName, "/dev/stdout") == 0
+ || strcmp (Option.tagFileName, "/dev/stdout") == 0
#endif
- )))
- toStdout = TRUE;
- return toStdout;
+ )))
+ toStdout = TRUE;
+ return toStdout;
}
extern FILE *tempFile (const char *const mode, char **const pName)
{
- char *name;
- FILE *fp;
- int fd;
+ char *name;
+ FILE *fp;
+ int fd;
#ifdef HAVE_MKSTEMP
- const char *const template = "tags.XXXXXX";
- const char *tmpdir = NULL;
- if (! isSetUID (ExecutableProgram))
- tmpdir = getenv ("TMPDIR");
- if (tmpdir == NULL)
- tmpdir = TMPDIR;
- name = xMalloc (strlen (tmpdir) + 1 + strlen (template) + 1, char);
- sprintf (name, "%s%c%s", tmpdir, OUTPUT_PATH_SEPARATOR, template);
- fd = mkstemp(name);
+ const char *const template = "tags.XXXXXX";
+ const char *tmpdir = NULL;
+ if (! isSetUID (ExecutableProgram))
+ tmpdir = getenv ("TMPDIR");
+ if (tmpdir == NULL)
+ tmpdir = TMPDIR;
+ name = xMalloc (strlen (tmpdir) + 1 + strlen (template) + 1, char);
+ sprintf (name, "%s%c%s", tmpdir, OUTPUT_PATH_SEPARATOR, template);
+ fd = mkstemp(name);
#else
- name = xMalloc (L_tmpnam, char);
- if (tmpnam (name) != name)
- error (FATAL | PERROR, "cannot assign temporary file name");
- fd = open (name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
-#endif
- if (fd == -1)
- error (FATAL | PERROR, "cannot open temporary file");
- fp = fdopen (fd, mode);
- if (fp == NULL)
- error (FATAL | PERROR, "cannot open temporary file");
- DebugStatement (
- debugPrintf (DEBUG_STATUS, "opened temporary file %s\n", name); )
- Assert (*pName == NULL);
- *pName = name;
- return fp;
+ name = xMalloc (L_tmpnam, char);
+ if (tmpnam (name) != name)
+ error (FATAL | PERROR, "cannot assign temporary file name");
+ fd = open (name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+#endif
+ if (fd == -1)
+ error (FATAL | PERROR, "cannot open temporary file");
+ fp = fdopen (fd, mode);
+ if (fp == NULL)
+ error (FATAL | PERROR, "cannot open temporary file");
+ DebugStatement (
+ debugPrintf (DEBUG_STATUS, "opened temporary file %s\n", name); )
+ Assert (*pName == NULL);
+ *pName = name;
+ return fp;
}
/*
@@ -625,61 +625,61 @@ extern FILE *tempFile (const char *const mode, char **const pName)
extern const char *baseFilename (const char *const filePath)
{
#if defined (MSDOS_STYLE_PATH) || defined (VMS)
- const char *tail = NULL;
- unsigned int i;
-
- /* Find whichever of the path delimiters is last.
- */
- for (i = 0 ; i < strlen (PathDelimiters) ; ++i)
- {
- const char *sep = strrchr (filePath, PathDelimiters [i]);
-
- if (sep > tail)
- tail = sep;
- }
+ const char *tail = NULL;
+ unsigned int i;
+
+ /* Find whichever of the path delimiters is last.
+ */
+ for (i = 0 ; i < strlen (PathDelimiters) ; ++i)
+ {
+ const char *sep = strrchr (filePath, PathDelimiters [i]);
+
+ if (sep > tail)
+ tail = sep;
+ }
#else
- const char *tail = strrchr (filePath, PATH_SEPARATOR);
+ const char *tail = strrchr (filePath, PATH_SEPARATOR);
#endif
- if (tail == NULL)
- tail = filePath;
- else
- ++tail; /* step past last delimiter */
+ if (tail == NULL)
+ tail = filePath;
+ else
+ ++tail; /* step past last delimiter */
#ifdef VAXC
- {
- /* remove version number from filename */
- char *p = strrchr ((char *) tail, ';');
- if (p != NULL)
- *p = '\0';
- }
+ {
+ /* remove version number from filename */
+ char *p = strrchr ((char *) tail, ';');
+ if (p != NULL)
+ *p = '\0';
+ }
#endif
- return tail;
+ return tail;
}
extern boolean isAbsolutePath (const char *const path)
{
- boolean result = FALSE;
+ boolean result = FALSE;
#if defined (MSDOS_STYLE_PATH)
- if (strchr (PathDelimiters, path [0]) != NULL)
- result = TRUE;
- else if (isalpha (path [0]) && path [1] == ':')
- {
- if (strchr (PathDelimiters, path [2]) != NULL)
- result = TRUE;
- else
- /* We don't support non-absolute file names with a drive
- * letter, like `d:NAME' (it's too much hassle).
- */
- error (FATAL,
- "%s: relative file names with drive letters not supported",
- path);
- }
+ if (strchr (PathDelimiters, path [0]) != NULL)
+ result = TRUE;
+ else if (isalpha (path [0]) && path [1] == ':')
+ {
+ if (strchr (PathDelimiters, path [2]) != NULL)
+ result = TRUE;
+ else
+ /* We don't support non-absolute file names with a drive
+ * letter, like `d:NAME' (it's too much hassle).
+ */
+ error (FATAL,
+ "%s: relative file names with drive letters not supported",
+ path);
+ }
#elif defined (VMS)
- result = (boolean) (strchr (path, ':') != NULL);
+ result = (boolean) (strchr (path, ':') != NULL);
#else
- result = (boolean) (path [0] == PATH_SEPARATOR);
+ result = (boolean) (path [0] == PATH_SEPARATOR);
#endif
- return result;
+ return result;
}
/* Return a newly-allocated string whose contents concatenate those of
@@ -688,15 +688,15 @@ extern boolean isAbsolutePath (const char *const path)
*/
static char* concat (const char *s1, const char *s2, const char *s3)
{
- int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
- char *result = xMalloc (len1 + len2 + len3 + 1, char);
+ int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
+ char *result = xMalloc (len1 + len2 + len3 + 1, char);
- strcpy (result, s1);
- strcpy (result + len1, s2);
- strcpy (result + len1 + len2, s3);
- result [len1 + len2 + len3] = '\0';
+ strcpy (result, s1);
+ strcpy (result + len1, s2);
+ strcpy (result + len1 + len2, s3);
+ result [len1 + len2 + len3] = '\0';
- return result;
+ return result;
}
/* Return a newly allocated string containing the absolute file name of FILE
@@ -705,61 +705,61 @@ static char* concat (const char *s1, const char *s2, const char *s3)
*/
static char* absoluteFilename (const char *file)
{
- char *slashp, *cp;
- char *res = NULL;
-
- if (isAbsolutePath (file))
- res = eStrdup (file);
- else
- res = concat (CurrentDirectory, file, "");
-
- /* Delete the "/dirname/.." and "/." substrings. */
- slashp = strchr (res, '/');
- while (slashp != NULL && slashp [0] != '\0')
- {
- if (slashp[1] == '.')
+ char *slashp, *cp;
+ char *res = NULL;
+
+ if (isAbsolutePath (file))
+ res = eStrdup (file);
+ else
+ res = concat (CurrentDirectory, file, "");
+
+ /* Delete the "/dirname/.." and "/." substrings. */
+ slashp = strchr (res, '/');
+ while (slashp != NULL && slashp [0] != '\0')
{
- if (slashp [2] == '.' && (slashp [3] == '/' || slashp [3] == '\0'))
- {
- cp = slashp;
- do
- cp--;
- while (cp >= res && ! isAbsolutePath (cp));
- if (cp < res)
- cp = slashp;/* the absolute name begins with "/.." */
+ if (slashp[1] == '.')
+ {
+ if (slashp [2] == '.' && (slashp [3] == '/' || slashp [3] == '\0'))
+ {
+ cp = slashp;
+ do
+ cp--;
+ while (cp >= res && ! isAbsolutePath (cp));
+ if (cp < res)
+ cp = slashp;/* the absolute name begins with "/.." */
#ifdef MSDOS_STYLE_PATH
- /* Under MSDOS and NT we get `d:/NAME' as absolute file name,
- * so the luser could say `d:/../NAME'. We silently treat this
- * as `d:/NAME'.
- */
- else if (cp [0] != '/')
- cp = slashp;
-#endif
- memmove (cp, slashp + 3, strlen (slashp + 3) + 1);
- slashp = cp;
- continue;
- }
- else if (slashp [2] == '/' || slashp [2] == '\0')
- {
- memmove (slashp, slashp + 2, strlen (slashp + 2) + 1);
- continue;
- }
+ /* Under MSDOS and NT we get `d:/NAME' as absolute file name,
+ * so the luser could say `d:/../NAME'. We silently treat this
+ * as `d:/NAME'.
+ */
+ else if (cp [0] != '/')
+ cp = slashp;
+#endif
+ memmove (cp, slashp + 3, strlen (slashp + 3) + 1);
+ slashp = cp;
+ continue;
+ }
+ else if (slashp [2] == '/' || slashp [2] == '\0')
+ {
+ memmove (slashp, slashp + 2, strlen (slashp + 2) + 1);
+ continue;
+ }
+ }
+ slashp = strchr (slashp + 1, '/');
}
- slashp = strchr (slashp + 1, '/');
- }
- if (res [0] == '\0')
- return eStrdup ("/");
- else
- {
+ if (res [0] == '\0')
+ return eStrdup ("/");
+ else
+ {
#ifdef MSDOS_STYLE_PATH
- /* Canonicalize drive letter case. */
- if (res [1] == ':' && islower (res [0]))
- res [0] = toupper (res [0]);
+ /* Canonicalize drive letter case. */
+ if (res [1] == ':' && islower (res [0]))
+ res [0] = toupper (res [0]);
#endif
- return res;
- }
+ return res;
+ }
}
/* Return a newly allocated string containing the absolute file name of dir
@@ -768,25 +768,25 @@ static char* absoluteFilename (const char *file)
*/
extern char* absoluteDirname (char *file)
{
- char *slashp, *res;
- char save;
+ char *slashp, *res;
+ char save;
#ifdef MSDOS_STYLE_PATH
- char *p;
- for (p = file ; *p != '\0' ; p++)
- if (*p == '\\')
- *p = '/';
-#endif
- slashp = strrchr (file, '/');
- if (slashp == NULL)
- res = eStrdup (CurrentDirectory);
- else
- {
- save = slashp [1];
- slashp [1] = '\0';
- res = absoluteFilename (file);
- slashp [1] = save;
- }
- return res;
+ char *p;
+ for (p = file ; *p != '\0' ; p++)
+ if (*p == '\\')
+ *p = '/';
+#endif
+ slashp = strrchr (file, '/');
+ if (slashp == NULL)
+ res = eStrdup (CurrentDirectory);
+ else
+ {
+ save = slashp [1];
+ slashp [1] = '\0';
+ res = absoluteFilename (file);
+ slashp [1] = save;
+ }
+ return res;
}
/* Return a newly allocated string containing the file name of FILE relative
@@ -795,603 +795,603 @@ extern char* absoluteDirname (char *file)
*/
extern char* relativeFilename (const char *file, const char *dir)
{
- const char *fp, *dp;
- char *absdir, *res;
- int i;
-
- /* Find the common root of file and dir (with a trailing slash). */
- absdir = absoluteFilename (file);
- fp = absdir;
- dp = dir;
- while (*fp++ == *dp++)
- continue;
- fp--;
- dp--; /* back to the first differing char */
- do
- { /* look at the equal chars until '/' */
- if (fp == absdir)
- return absdir; /* first char differs, give up */
+ const char *fp, *dp;
+ char *absdir, *res;
+ int i;
+
+ /* Find the common root of file and dir (with a trailing slash). */
+ absdir = absoluteFilename (file);
+ fp = absdir;
+ dp = dir;
+ while (*fp++ == *dp++)
+ continue;
fp--;
- dp--;
- } while (*fp != '/');
-
- /* Build a sequence of "../" strings for the resulting relative file name.
- */
- i = 0;
- while ((dp = strchr (dp + 1, '/')) != NULL)
- i += 1;
- res = xMalloc (3 * i + strlen (fp + 1) + 1, char);
- res [0] = '\0';
- while (i-- > 0)
- strcat (res, "../");
-
- /* Add the file name relative to the common root of file and dir. */
- strcat (res, fp + 1);
- free (absdir);
-
- return res;
+ dp--; /* back to the first differing char */
+ do
+ { /* look at the equal chars until '/' */
+ if (fp == absdir)
+ return absdir; /* first char differs, give up */
+ fp--;
+ dp--;
+ } while (*fp != '/');
+
+ /* Build a sequence of "../" strings for the resulting relative file name.
+ */
+ i = 0;
+ while ((dp = strchr (dp + 1, '/')) != NULL)
+ i += 1;
+ res = xMalloc (3 * i + strlen (fp + 1) + 1, char);
+ res [0] = '\0';
+ while (i-- > 0)
+ strcat (res, "../");
+
+ /* Add the file name relative to the common root of file and dir. */
+ strcat (res, fp + 1);
+ free (absdir);
+
+ return res;
}
extern vString *combinePathAndFile (const char *const path,
- const char *const file)
+ const char *const file)
{
- vString *const filePath = vStringNew ();
+ vString *const filePath = vStringNew ();
#ifdef VMS
- const char *const directoryId = strstr (file, ".DIR;1");
-
- if (directoryId == NULL)
- {
- const char *const versionId = strchr (file, ';');
+ const char *const directoryId = strstr (file, ".DIR;1");
- vStringCopyS (filePath, path);
- if (versionId == NULL)
- vStringCatS (filePath, file);
- else
- vStringNCatS (filePath, file, versionId - file);
- vStringCopyToLower (filePath, filePath);
- }
- else
- {
- /* File really is a directory; append it to the path.
- * Gotcha: doesn't work with logical names.
- */
- vStringNCopyS (filePath, path, strlen (path) - 1);
- vStringPut (filePath, '.');
- vStringNCatS (filePath, file, directoryId - file);
- if (strchr (path, '[') != NULL)
- vStringPut (filePath, ']');
+ if (directoryId == NULL)
+ {
+ const char *const versionId = strchr (file, ';');
+
+ vStringCopyS (filePath, path);
+ if (versionId == NULL)
+ vStringCatS (filePath, file);
+ else
+ vStringNCatS (filePath, file, versionId - file);
+ vStringCopyToLower (filePath, filePath);
+ }
else
- vStringPut (filePath, '>');
- vStringTerminate (filePath);
- }
+ {
+ /* File really is a directory; append it to the path.
+ * Gotcha: doesn't work with logical names.
+ */
+ vStringNCopyS (filePath, path, strlen (path) - 1);
+ vStringPut (filePath, '.');
+ vStringNCatS (filePath, file, directoryId - file);
+ if (strchr (path, '[') != NULL)
+ vStringPut (filePath, ']');
+ else
+ vStringPut (filePath, '>');
+ vStringTerminate (filePath);
+ }
#else
- const int lastChar = path [strlen (path) - 1];
+ const int lastChar = path [strlen (path) - 1];
# ifdef MSDOS_STYLE_PATH
- boolean terminated = (boolean) (strchr (PathDelimiters, lastChar) != NULL);
+ boolean terminated = (boolean) (strchr (PathDelimiters, lastChar) != NULL);
# else
- boolean terminated = (boolean) (lastChar == PATH_SEPARATOR);
+ boolean terminated = (boolean) (lastChar == PATH_SEPARATOR);
# endif
- vStringCopyS (filePath, path);
- if (! terminated)
- {
- vStringPut (filePath, OUTPUT_PATH_SEPARATOR);
- vStringTerminate (filePath);
- }
- vStringCatS (filePath, file);
+ vStringCopyS (filePath, path);
+ if (! terminated)
+ {
+ vStringPut (filePath, OUTPUT_PATH_SEPARATOR);
+ vStringTerminate (filePath);
+ }
+ vStringCatS (filePath, file);
#endif
- return filePath;
+ return filePath;
}
/*
- * Create tags
+ * Create tags
*/
extern void processExcludeOption (const char *const UNUSED option,
- const char *const parameter)
+ const char *const parameter)
{
- if (parameter [0] == '\0')
- freeList (&Excluded);
- else if (parameter [0] == '@')
- {
- stringList* const new = stringListNewFromFile (parameter + 1);
- if (Excluded == NULL)
- Excluded = new;
+ if (parameter [0] == '\0')
+ freeList (&Excluded);
+ else if (parameter [0] == '@')
+ {
+ stringList* const new = stringListNewFromFile (parameter + 1);
+ if (Excluded == NULL)
+ Excluded = new;
+ else
+ stringListCombine (Excluded, new);
+ }
else
- stringListCombine (Excluded, new);
- }
- else
- {
- vString *const item = vStringNewInit (parameter);
- if (Excluded == NULL)
- Excluded = stringListNew ();
- stringListAdd (Excluded, item);
- }
+ {
+ vString *const item = vStringNewInit (parameter);
+ if (Excluded == NULL)
+ Excluded = stringListNew ();
+ stringListAdd (Excluded, item);
+ }
}
#if 0
static boolean excludedFile (const char* const name)
{
- const char* base = baseFilename (name);
- boolean result = FALSE;
- if (Excluded != NULL)
- {
- result = stringListFileMatched (Excluded, base);
- if (! result && name != base)
- result = stringListFileMatched (Excluded, name);
- }
+ const char* base = baseFilename (name);
+ boolean result = FALSE;
+ if (Excluded != NULL)
+ {
+ result = stringListFileMatched (Excluded, base);
+ if (! result && name != base)
+ result = stringListFileMatched (Excluded, name);
+ }
#ifdef AMIGA
- /* not a good solution, but the only one which works often */
- if (! result)
- result = (boolean) (strcmp (name, TagFile.name) == 0);
+ /* not a good solution, but the only one which works often */
+ if (! result)
+ result = (boolean) (strcmp (name, TagFile.name) == 0);
#endif
- return result;
+ return result;
}
# if defined (MSDOS) || defined (WIN32)
static boolean createTagsForMatchingEntries (char *const pattern)
{
- boolean resize = FALSE;
- const size_t dirLength = baseFilename (pattern) - (char *) pattern;
- vString *const filePath = vStringNew ();
+ boolean resize = FALSE;
+ const size_t dirLength = baseFilename (pattern) - (char *) pattern;
+ vString *const filePath = vStringNew ();
#if defined (HAVE_FINDFIRST)
- struct ffblk fileInfo;
- int result = findfirst (pattern, &fileInfo, FA_DIREC);
-
- while (result == 0)
- {
- const char *const entryName = fileInfo.ff_name;
+ struct ffblk fileInfo;
+ int result = findfirst (pattern, &fileInfo, FA_DIREC);
- /* We must not recurse into the directories "." or "..".
- */
- if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0)
+ while (result == 0)
{
- vStringNCopyS (filePath, pattern, dirLength);
- vStringCatS (filePath, entryName);
- resize |= createTagsForEntry (vStringValue (filePath));
+ const char *const entryName = fileInfo.ff_name;
+
+ /* We must not recurse into the directories "." or "..".
+ */
+ if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0)
+ {
+ vStringNCopyS (filePath, pattern, dirLength);
+ vStringCatS (filePath, entryName);
+ resize |= createTagsForEntry (vStringValue (filePath));
+ }
+ result = findnext (&fileInfo);
}
- result = findnext (&fileInfo);
- }
#elif defined (HAVE__FINDFIRST)
- struct _finddata_t fileInfo;
- long hFile = _findfirst (pattern, &fileInfo);
+ struct _finddata_t fileInfo;
+ long hFile = _findfirst (pattern, &fileInfo);
- if (hFile != -1L)
- {
- do
+ if (hFile != -1L)
{
- const char *const entryName = fileInfo.name;
-
- /* We must not recurse into the directories "." or "..".
- */
- if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0)
- {
- vStringNCopyS (filePath, pattern, dirLength);
- vStringCatS (filePath, entryName);
- resize |= createTagsForEntry (vStringValue (filePath));
- }
- } while (_findnext (hFile, &fileInfo) == 0);
- _findclose (hFile);
- }
-#endif
-
- vStringDelete (filePath);
- return resize;
+ do
+ {
+ const char *const entryName = fileInfo.name;
+
+ /* We must not recurse into the directories "." or "..".
+ */
+ if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0)
+ {
+ vStringNCopyS (filePath, pattern, dirLength);
+ vStringCatS (filePath, entryName);
+ resize |= createTagsForEntry (vStringValue (filePath));
+ }
+ } while (_findnext (hFile, &fileInfo) == 0);
+ _findclose (hFile);
+ }
+#endif
+
+ vStringDelete (filePath);
+ return resize;
}
#elif defined (AMIGA)
static boolean createTagsForMatchingEntries (char *const pattern)
{
- boolean resize = FALSE;
- struct AnchorPath *const anchor =
- (struct AnchorPath *) eMalloc ((size_t) ANCHOR_SIZE);
+ boolean resize = FALSE;
+ struct AnchorPath *const anchor =
+ (struct AnchorPath *) eMalloc ((size_t) ANCHOR_SIZE);
- if (anchor != NULL)
- {
- LONG result;
+ if (anchor != NULL)
+ {
+ LONG result;
- memset (anchor, 0, (size_t) ANCHOR_SIZE);
- anchor->ap_Strlen = ANCHOR_BUF_SIZE; /* ap_Length no longer supported */
+ memset (anchor, 0, (size_t) ANCHOR_SIZE);
+ anchor->ap_Strlen = ANCHOR_BUF_SIZE; /* ap_Length no longer supported */
- /* Allow '.' for current directory.
- */
+ /* Allow '.' for current directory.
+ */
#ifdef APF_DODOT
- anchor->ap_Flags = APF_DODOT | APF_DOWILD;
+ anchor->ap_Flags = APF_DODOT | APF_DOWILD;
#else
- anchor->ap_Flags = APF_DoDot | APF_DoWild;
+ anchor->ap_Flags = APF_DoDot | APF_DoWild;
#endif
- result = MatchFirst ((UBYTE *) pattern, anchor);
- while (result == 0)
- {
- resize |= createTagsForEntry ((char *) anchor->ap_Buf);
- result = MatchNext (anchor);
+ result = MatchFirst ((UBYTE *) pattern, anchor);
+ while (result == 0)
+ {
+ resize |= createTagsForEntry ((char *) anchor->ap_Buf);
+ result = MatchNext (anchor);
+ }
+ MatchEnd (anchor);
+ eFree (anchor);
}
- MatchEnd (anchor);
- eFree (anchor);
- }
- return resize;
+ return resize;
}
#endif
static boolean isRecursiveLink (const char* const dirName)
{
- boolean result = FALSE;
- char* const path = absoluteFilename (dirName);
- while (path [strlen (path) - 1] == PATH_SEPARATOR)
- path [strlen (path) - 1] = '\0';
- while (! result && strlen (path) > (size_t) 1)
- {
- char *const separator = strrchr (path, PATH_SEPARATOR);
- if (separator == NULL)
- break;
- else if (separator == path) /* backed up to root directory */
- *(separator + 1) = '\0';
- else
- *separator = '\0';
- result = isSameFile (path, dirName);
- }
- eFree (path);
- return result;
+ boolean result = FALSE;
+ char* const path = absoluteFilename (dirName);
+ while (path [strlen (path) - 1] == PATH_SEPARATOR)
+ path [strlen (path) - 1] = '\0';
+ while (! result && strlen (path) > (size_t) 1)
+ {
+ char *const separator = strrchr (path, PATH_SEPARATOR);
+ if (separator == NULL)
+ break;
+ else if (separator == path) /* backed up to root directory */
+ *(separator + 1) = '\0';
+ else
+ *separator = '\0';
+ result = isSameFile (path, dirName);
+ }
+ eFree (path);
+ return result;
}
static boolean recurseIntoDirectory (const char *const dirName)
{
- boolean resize = FALSE;
- if (isRecursiveLink (dirName))
- verbose ("ignoring \"%s\" (recursive link)\n", dirName);
- else if (! Option.recurse)
- verbose ("ignoring \"%s\" (directory)\n", dirName);
- else
- {
-#if defined (HAVE_OPENDIR)
- DIR *const dir = opendir (dirName);
- if (dir == NULL)
- error (WARNING | PERROR, "cannot recurse into directory \"%s\"",
- dirName);
+ boolean resize = FALSE;
+ if (isRecursiveLink (dirName))
+ verbose ("ignoring \"%s\" (recursive link)\n", dirName);
+ else if (! Option.recurse)
+ verbose ("ignoring \"%s\" (directory)\n", dirName);
else
{
- struct dirent *entry;
- verbose ("RECURSING into directory \"%s\"\n", dirName);
- while ((entry = readdir (dir)) != NULL)
- {
- if (strcmp (entry->d_name, ".") != 0 &&
- strcmp (entry->d_name, "..") != 0)
+#if defined (HAVE_OPENDIR)
+ DIR *const dir = opendir (dirName);
+ if (dir == NULL)
+ error (WARNING | PERROR, "cannot recurse into directory \"%s\"",
+ dirName);
+ else
{
- vString *filePath;
- if (strcmp (dirName, ".") == 0)
- filePath = vStringNewInit (entry->d_name);
- else
- filePath = combinePathAndFile (dirName, entry->d_name);
- resize |= createTagsForEntry (vStringValue (filePath));
- vStringDelete (filePath);
+ struct dirent *entry;
+ verbose ("RECURSING into directory \"%s\"\n", dirName);
+ while ((entry = readdir (dir)) != NULL)
+ {
+ if (strcmp (entry->d_name, ".") != 0 &&
+ strcmp (entry->d_name, "..") != 0)
+ {
+ vString *filePath;
+ if (strcmp (dirName, ".") == 0)
+ filePath = vStringNewInit (entry->d_name);
+ else
+ filePath = combinePathAndFile (dirName, entry->d_name);
+ resize |= createTagsForEntry (vStringValue (filePath));
+ vStringDelete (filePath);
+ }
+ }
+ closedir (dir);
}
- }
- closedir (dir);
- }
#elif defined (AMIGA) || defined (MSDOS) || defined (WIN32)
- vString *const pattern = vStringNew ();
- verbose ("RECURSING into directory \"%s\"\n", dirName);
+ vString *const pattern = vStringNew ();
+ verbose ("RECURSING into directory \"%s\"\n", dirName);
# ifdef AMIGA
- if (*dirName != '\0' && strcmp (dirName, ".") != 0)
- {
- vStringCopyS (pattern, dirName);
- if (dirName [strlen (dirName) - 1] != '/')
- vStringPut (pattern, '/');
- }
- vStringCatS (pattern, "#?");
+ if (*dirName != '\0' && strcmp (dirName, ".") != 0)
+ {
+ vStringCopyS (pattern, dirName);
+ if (dirName [strlen (dirName) - 1] != '/')
+ vStringPut (pattern, '/');
+ }
+ vStringCatS (pattern, "#?");
# else
- vStringCopyS (pattern, dirName);
- vStringPut (pattern, OUTPUT_PATH_SEPARATOR);
- vStringCatS (pattern, "*.*");
+ vStringCopyS (pattern, dirName);
+ vStringPut (pattern, OUTPUT_PATH_SEPARATOR);
+ vStringCatS (pattern, "*.*");
# endif
- resize = createTagsForMatchingEntries (vStringValue (pattern));
- vStringDelete (pattern);
-#endif /* HAVE_OPENDIR */
- }
- return resize;
+ resize = createTagsForMatchingEntries (vStringValue (pattern));
+ vStringDelete (pattern);
+#endif /* HAVE_OPENDIR */
+ }
+ return resize;
}
static boolean createTagsForEntry (const char *const entryName)
{
- boolean resize = FALSE;
-
- Assert (entryName != NULL);
- if (excludedFile (entryName))
- verbose ("excluding \"%s\"\n", entryName);
- else if (isSymbolicLink (entryName) && ! Option.followLinks)
- verbose ("ignoring \"%s\" (symbolic link)\n", entryName);
- else if (! doesFileExist (entryName))
- error (WARNING | PERROR, "cannot open source file \"%s\"", entryName);
- else if (isDirectory (entryName))
- resize = recurseIntoDirectory (entryName);
- else if (! isNormalFile (entryName))
- verbose ("ignoring \"%s\" (special file)\n", entryName);
- else
- resize = parseFile (entryName);
-
- return resize;
+ boolean resize = FALSE;
+
+ Assert (entryName != NULL);
+ if (excludedFile (entryName))
+ verbose ("excluding \"%s\"\n", entryName);
+ else if (isSymbolicLink (entryName) && ! Option.followLinks)
+ verbose ("ignoring \"%s\" (symbolic link)\n", entryName);
+ else if (! doesFileExist (entryName))
+ error (WARNING | PERROR, "cannot open source file \"%s\"", entryName);
+ else if (isDirectory (entryName))
+ resize = recurseIntoDirectory (entryName);
+ else if (! isNormalFile (entryName))
+ verbose ("ignoring \"%s\" (special file)\n", entryName);
+ else
+ resize = parseFile (entryName);
+
+ return resize;
}
static boolean createTagsForArgs (cookedArgs* const args)
{
- boolean resize = FALSE;
+ boolean resize = FALSE;
- /* Generate tags for each argument on the command line.
- */
- while (! cArgOff (args))
- {
- const char *arg = cArgItem (args);
+ /* Generate tags for each argument on the command line.
+ */
+ while (! cArgOff (args))
+ {
+ const char *arg = cArgItem (args);
#if defined (MSDOS) || defined (WIN32)
- vString *const pattern = vStringNewInit (arg);
- char *patternS = vStringValue (pattern);
+ vString *const pattern = vStringNewInit (arg);
+ char *patternS = vStringValue (pattern);
- /* We must transform the "." and ".." forms into something that can
- * be expanded by the MSDOS/Windows functions.
- */
- if (Option.recurse &&
- (strcmp (patternS, ".") == 0 || strcmp (patternS, "..") == 0))
- {
- vStringPut (pattern, OUTPUT_PATH_SEPARATOR);
- vStringCatS (pattern, "*.*");
- }
- resize |= createTagsForMatchingEntries (patternS);
- vStringDelete (pattern);
+ /* We must transform the "." and ".." forms into something that can
+ * be expanded by the MSDOS/Windows functions.
+ */
+ if (Option.recurse &&
+ (strcmp (patternS, ".") == 0 || strcmp (patternS, "..") == 0))
+ {
+ vStringPut (pattern, OUTPUT_PATH_SEPARATOR);
+ vStringCatS (pattern, "*.*");
+ }
+ resize |= createTagsForMatchingEntries (patternS);
+ vStringDelete (pattern);
#else
- resize |= createTagsForEntry (arg);
+ resize |= createTagsForEntry (arg);
#endif
- cArgForth (args);
- parseOptions (args);
- }
- return resize;
+ cArgForth (args);
+ parseOptions (args);
+ }
+ return resize;
}
/* Read from an opened file a list of file names for which to generate tags.
*/
static boolean createTagsFromFileInput (FILE* const fp, const boolean filter)
{
- boolean resize = FALSE;
- if (fp != NULL)
- {
- cookedArgs* args = cArgNewFromLineFile (fp);
- parseOptions (args);
- while (! cArgOff (args))
+ boolean resize = FALSE;
+ if (fp != NULL)
{
- resize |= createTagsForEntry (cArgItem (args));
- if (filter)
- {
- if (Option.filterTerminator != NULL)
- fputs (Option.filterTerminator, stdout);
- fflush (stdout);
- }
- cArgForth (args);
- parseOptions (args);
+ cookedArgs* args = cArgNewFromLineFile (fp);
+ parseOptions (args);
+ while (! cArgOff (args))
+ {
+ resize |= createTagsForEntry (cArgItem (args));
+ if (filter)
+ {
+ if (Option.filterTerminator != NULL)
+ fputs (Option.filterTerminator, stdout);
+ fflush (stdout);
+ }
+ cArgForth (args);
+ parseOptions (args);
+ }
+ cArgDelete (args);
}
- cArgDelete (args);
- }
- return resize;
+ return resize;
}
/* Read from a named file a list of file names for which to generate tags.
*/
static boolean createTagsFromListFile (const char* const fileName)
{
- boolean resize;
- Assert (fileName != NULL);
- if (strcmp (fileName, "-") == 0)
- resize = createTagsFromFileInput (stdin, FALSE);
- else
- {
- FILE* const fp = g_fopen (fileName, "r");
- if (fp == NULL)
- error (FATAL | PERROR, "cannot open list file \"%s\"", fileName);
- resize = createTagsFromFileInput (fp, FALSE);
- fclose (fp);
- }
- return resize;
+ boolean resize;
+ Assert (fileName != NULL);
+ if (strcmp (fileName, "-") == 0)
+ resize = createTagsFromFileInput (stdin, FALSE);
+ else
+ {
+ FILE* const fp = g_fopen (fileName, "r");
+ if (fp == NULL)
+ error (FATAL | PERROR, "cannot open list file \"%s\"", fileName);
+ resize = createTagsFromFileInput (fp, FALSE);
+ fclose (fp);
+ }
+ return resize;
}
#if defined (HAVE_CLOCK)
# define CLOCK_AVAILABLE
# ifndef CLOCKS_PER_SEC
-# define CLOCKS_PER_SEC 1000000
+# define CLOCKS_PER_SEC 1000000
# endif
#elif defined (HAVE_TIMES)
# define CLOCK_AVAILABLE
-# define CLOCKS_PER_SEC 60
+# define CLOCKS_PER_SEC 60
static clock_t clock (void)
{
- struct tms buf;
+ struct tms buf;
- times (&buf);
- return (buf.tms_utime + buf.tms_stime);
+ times (&buf);
+ return (buf.tms_utime + buf.tms_stime);
}
#else
# define clock() (clock_t)0
#endif
static void printTotals (const clock_t *const timeStamps)
{
- const unsigned long totalTags = TagFile.numTags.added +
- TagFile.numTags.prev;
+ const unsigned long totalTags = TagFile.numTags.added +
+ TagFile.numTags.prev;
- fprintf (errout, "%ld file%s, %ld line%s (%ld kB) scanned",
- Totals.files, plural (Totals.files),
- Totals.lines, plural (Totals.lines),
- Totals.bytes/1024L);
+ fprintf (errout, "%ld file%s, %ld line%s (%ld kB) scanned",
+ Totals.files, plural (Totals.files),
+ Totals.lines, plural (Totals.lines),
+ Totals.bytes/1024L);
#ifdef CLOCK_AVAILABLE
- {
- const double interval = ((double) (timeStamps [1] - timeStamps [0])) /
- CLOCKS_PER_SEC;
-
- fprintf (errout, " in %.01f seconds", interval);
- if (interval != (double) 0.0)
- fprintf (errout, " (%lu kB/s)",
- (unsigned long) (Totals.bytes / interval) / 1024L);
- }
-#endif
- fputc ('\n', errout);
-
- fprintf (errout, "%lu tag%s added to tag file",
- TagFile.numTags.added, plural (TagFile.numTags.added));
- if (Option.append)
- fprintf (errout, " (now %lu tags)", totalTags);
- fputc ('\n', errout);
-
- if (totalTags > 0 && Option.sorted)
- {
- fprintf (errout, "%lu tag%s sorted", totalTags, plural (totalTags));
-#ifdef CLOCK_AVAILABLE
- fprintf (errout, " in %.02f seconds",
- ((double) (timeStamps [2] - timeStamps [1])) / CLOCKS_PER_SEC);
+ {
+ const double interval = ((double) (timeStamps [1] - timeStamps [0])) /
+ CLOCKS_PER_SEC;
+
+ fprintf (errout, " in %.01f seconds", interval);
+ if (interval != (double) 0.0)
+ fprintf (errout, " (%lu kB/s)",
+ (unsigned long) (Totals.bytes / interval) / 1024L);
+ }
#endif
fputc ('\n', errout);
- }
+
+ fprintf (errout, "%lu tag%s added to tag file",
+ TagFile.numTags.added, plural (TagFile.numTags.added));
+ if (Option.append)
+ fprintf (errout, " (now %lu tags)", totalTags);
+ fputc ('\n', errout);
+
+ if (totalTags > 0 && Option.sorted)
+ {
+ fprintf (errout, "%lu tag%s sorted", totalTags, plural (totalTags));
+#ifdef CLOCK_AVAILABLE
+ fprintf (errout, " in %.02f seconds",
+ ((double) (timeStamps [2] - timeStamps [1])) / CLOCKS_PER_SEC);
+#endif
+ fputc ('\n', errout);
+ }
#ifdef TM_DEBUG
- fprintf (errout, "longest tag line = %lu\n",
- (unsigned long) TagFile.max.line);
+ fprintf (errout, "longest tag line = %lu\n",
+ (unsigned long) TagFile.max.line);
#endif
}
static void makeTags (cookedArgs* args)
{
- clock_t timeStamps [3];
- boolean resize = FALSE;
- boolean files = (boolean)(! cArgOff (args) || Option.fileList != NULL
- || Option.filter);
+ clock_t timeStamps [3];
+ boolean resize = FALSE;
+ boolean files = (boolean)(! cArgOff (args) || Option.fileList != NULL
+ || Option.filter);
- if (! files && ! Option.recurse)
- error (FATAL, "No files specified. Try \"%s --help\".",
- getExecutableName ());
+ if (! files && ! Option.recurse)
+ error (FATAL, "No files specified. Try \"%s --help\".",
+ getExecutableName ());
#define timeStamp(n) timeStamps[(n)]=(Option.printTotals ? clock():(clock_t)0)
- if (! Option.filter)
- openTagFile ();
-
- timeStamp (0);
-
- if (! cArgOff (args))
- {
- verbose ("Reading command line arguments\n");
- resize = createTagsForArgs (args);
- }
- if (Option.fileList != NULL)
- {
- verbose ("Reading list file\n");
- resize = (boolean) (createTagsFromListFile (Option.fileList) || resize);
- }
- if (Option.filter)
- {
- verbose ("Reading filter input\n");
- resize = (boolean) (createTagsFromFileInput (stdin, TRUE) || resize);
- }
- if (! files && Option.recurse)
- resize = recurseIntoDirectory (".");
-
- timeStamp (1);
-
- if (! Option.filter)
- closeTagFile (resize);
-
- timeStamp (2);
-
- if (Option.printTotals)
- printTotals (timeStamps);
+ if (! Option.filter)
+ openTagFile ();
+
+ timeStamp (0);
+
+ if (! cArgOff (args))
+ {
+ verbose ("Reading command line arguments\n");
+ resize = createTagsForArgs (args);
+ }
+ if (Option.fileList != NULL)
+ {
+ verbose ("Reading list file\n");
+ resize = (boolean) (createTagsFromListFile (Option.fileList) || resize);
+ }
+ if (Option.filter)
+ {
+ verbose ("Reading filter input\n");
+ resize = (boolean) (createTagsFromFileInput (stdin, TRUE) || resize);
+ }
+ if (! files && Option.recurse)
+ resize = recurseIntoDirectory (".");
+
+ timeStamp (1);
+
+ if (! Option.filter)
+ closeTagFile (resize);
+
+ timeStamp (2);
+
+ if (Option.printTotals)
+ printTotals (timeStamps);
#undef timeStamp
}
/*
- * Start up code
+ * Start up code
*/
static void setExecutableName (const char *const path)
{
- ExecutableProgram = path;
- ExecutableName = baseFilename (path);
+ ExecutableProgram = path;
+ ExecutableName = baseFilename (path);
#ifdef VAXC
{
- /* remove filetype from executable name */
- char *p = strrchr (ExecutableName, '.');
- if (p != NULL)
- *p = '\0';
+ /* remove filetype from executable name */
+ char *p = strrchr (ExecutableName, '.');
+ if (p != NULL)
+ *p = '\0';
}
#endif
}
extern int ctags_main (int UNUSED argc, char **argv)
{
- cookedArgs *args;
+ cookedArgs *args;
#ifdef VMS
- extern int getredirection (int *ac, char ***av);
+ extern int getredirection (int *ac, char ***av);
- /* do wildcard expansion and I/O redirection */
- getredirection (&argc, &argv);
+ /* do wildcard expansion and I/O redirection */
+ getredirection (&argc, &argv);
#endif
#ifdef AMIGA
- /* This program doesn't work when started from the Workbench */
- if (argc == 0)
- exit (1);
+ /* This program doesn't work when started from the Workbench */
+ if (argc == 0)
+ exit (1);
#endif
#ifdef __EMX__
- _wildcard (&argc, &argv); /* expand wildcards in argument list */
+ _wildcard (&argc, &argv); /* expand wildcards in argument list */
#endif
#if defined (macintosh) && BUILD_MPW_TOOL == 0
- argc = ccommand (&argv);
+ argc = ccommand (&argv);
#endif
- setCurrentDirectory ();
- setExecutableName (*argv++);
+ setCurrentDirectory ();
+ setExecutableName (*argv++);
#ifdef HAVE_REGEX
- checkRegex ();
-#endif
-
- /* always excluded by default */
- processExcludeOption (NULL, "EIFGEN");
- processExcludeOption (NULL, "SCCS");
-
- args = cArgNewFromArgv (argv);
- previewFirstOption (args);
- testEtagsInvocation ();
- initializeParsing ();
- initOptions ();
- readOptionConfiguration ();
- verbose ("Reading initial options from command line\n");
- parseOptions (args);
- checkOptions ();
- makeTags (args);
-
- /* Clean up.
- */
- eFree (CurrentDirectory);
- freeList (&Excluded);
- cArgDelete (args);
- freeKeywordTable ();
- freeSourceFileResources ();
- freeTagFileResources ();
- freeOptionResources ();
- freeParserResources ();
+ checkRegex ();
+#endif
+
+ /* always excluded by default */
+ processExcludeOption (NULL, "EIFGEN");
+ processExcludeOption (NULL, "SCCS");
+
+ args = cArgNewFromArgv (argv);
+ previewFirstOption (args);
+ testEtagsInvocation ();
+ initializeParsing ();
+ initOptions ();
+ readOptionConfiguration ();
+ verbose ("Reading initial options from command line\n");
+ parseOptions (args);
+ checkOptions ();
+ makeTags (args);
+
+ /* Clean up.
+ */
+ eFree (CurrentDirectory);
+ freeList (&Excluded);
+ cArgDelete (args);
+ freeKeywordTable ();
+ freeSourceFileResources ();
+ freeTagFileResources ();
+ freeOptionResources ();
+ freeParserResources ();
#ifdef HAVE_REGEX
- freeRegexResources ();
+ freeRegexResources ();
#endif
- exit (0);
- return 0;
+ exit (0);
+ return 0;
}
#endif
/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */
void utils_warn(const char *msg)
{
- g_warning("%s", msg);
+ g_warning("%s", msg);
}
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/ctags.h
12 lines changed, 6 insertions(+), 6 deletions(-)
===================================================================
@@ -15,11 +15,11 @@
#ifndef PROGRAM_VERSION
# define PROGRAM_VERSION "5.0.1"
#endif
-#define PROGRAM_NAME "Exuberant Ctags"
-#define PROGRAM_URL "http://ctags.sourceforge.net"
-#define AUTHOR_NAME "Darren Hiebert"
-#define AUTHOR_EMAIL "darren at hiebert.com"
+#define PROGRAM_NAME "Exuberant Ctags"
+#define PROGRAM_URL "http://ctags.sourceforge.net"
+#define AUTHOR_NAME "Darren Hiebert"
+#define AUTHOR_EMAIL "darren at hiebert.com"
-#endif /* _CTAGS_H */
+#endif /* _CTAGS_H */
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/entry.c
458 lines changed, 229 insertions(+), 229 deletions(-)
===================================================================
@@ -11,19 +11,19 @@
/*
* INCLUDE FILES
*/
-#include "general.h" /* must always come first */
+#include "general.h" /* must always come first */
#include <string.h>
-#include <ctype.h> /* to define isspace () */
+#include <ctype.h> /* to define isspace () */
#include <errno.h>
#include <glib.h>
#include <glib/gstdio.h>
#if defined (HAVE_SYS_TYPES_H)
-# include <sys/types.h> /* to declare off_t on some hosts */
+# include <sys/types.h> /* to declare off_t on some hosts */
#endif
#if defined (HAVE_TYPES_H)
-# include <types.h> /* to declare off_t on some hosts */
+# include <types.h> /* to declare off_t on some hosts */
#endif
@@ -48,9 +48,9 @@
/*
* MACROS
*/
-#define PSEUDO_TAG_PREFIX "!_"
+#define PSEUDO_TAG_PREFIX "!_"
-#define includeExtensionFlags() (Option.tagFileFormat > 1)
+#define includeExtensionFlags() (Option.tagFileFormat > 1)
/*
* Portability defines
@@ -62,24 +62,24 @@
/* Hack for ridiculous practice of Microsoft Visual C++.
*/
#if defined (WIN32) && defined (_MSC_VER)
-# define chsize _chsize
-# define open _open
-# define close _close
-# define O_RDWR _O_RDWR
+# define chsize _chsize
+# define open _open
+# define close _close
+# define O_RDWR _O_RDWR
#endif
/*
* DATA DEFINITIONS
*/
tagFile TagFile = {
- NULL, /* tag file name */
- NULL, /* tag file directory (absolute) */
- NULL, /* file pointer */
- { 0, 0 }, /* numTags */
- { 0, 0, 0 }, /* max */
- { NULL, NULL, 0 }, /* etags */
- NULL /* vLine */
+ NULL, /* tag file name */
+ NULL, /* tag file directory (absolute) */
+ NULL, /* file pointer */
+ { 0, 0 }, /* numTags */
+ { 0, 0, 0 }, /* max */
+ { NULL, NULL, 0 }, /* etags */
+ NULL /* vLine */
};
static boolean TagsToStdout = FALSE;
@@ -101,13 +101,13 @@ extern int ftruncate (int fd, off_t length);
extern void freeTagFileResources (void)
{
- eFree (TagFile.directory);
- vStringDelete (TagFile.vLine);
+ eFree (TagFile.directory);
+ vStringDelete (TagFile.vLine);
}
extern const char *tagFileName (void)
{
- return TagFile.name;
+ return TagFile.name;
}
/*
@@ -116,126 +116,126 @@ extern const char *tagFileName (void)
static void rememberMaxLengths (const size_t nameLength, const size_t lineLength)
{
- if (nameLength > TagFile.max.tag)
- TagFile.max.tag = nameLength;
+ if (nameLength > TagFile.max.tag)
+ TagFile.max.tag = nameLength;
- if (lineLength > TagFile.max.line)
- TagFile.max.line = lineLength;
+ if (lineLength > TagFile.max.line)
+ TagFile.max.line = lineLength;
}
static void writePseudoTag (const char *const tagName,
- const char *const fileName,
- const char *const pattern)
+ const char *const fileName,
+ const char *const pattern)
{
- const int length = mio_printf (TagFile.mio, "%s%s\t%s\t/%s/\n",
- PSEUDO_TAG_PREFIX, tagName, fileName, pattern);
- ++TagFile.numTags.added;
- rememberMaxLengths (strlen (tagName), (size_t) length);
+ const int length = mio_printf (TagFile.mio, "%s%s\t%s\t/%s/\n",
+ PSEUDO_TAG_PREFIX, tagName, fileName, pattern);
+ ++TagFile.numTags.added;
+ rememberMaxLengths (strlen (tagName), (size_t) length);
}
static void addPseudoTags (void)
{
- if (! Option.xref)
- {
- char format [11];
- const char *formatComment = "unknown format";
-
- sprintf (format, "%u", Option.tagFileFormat);
-
- if (Option.tagFileFormat == 1)
- formatComment = "original ctags format";
- else if (Option.tagFileFormat == 2)
- formatComment =
- "extended format; --format=1 will not append ;\" to lines";
-
- writePseudoTag ("TAG_FILE_FORMAT", format, formatComment);
- writePseudoTag ("TAG_FILE_SORTED", Option.sorted ? "1":"0",
- "0=unsorted, 1=sorted");
- writePseudoTag ("TAG_PROGRAM_AUTHOR", AUTHOR_NAME, AUTHOR_EMAIL);
- writePseudoTag ("TAG_PROGRAM_NAME", PROGRAM_NAME, "");
- writePseudoTag ("TAG_PROGRAM_URL", PROGRAM_URL, "official site");
- writePseudoTag ("TAG_PROGRAM_VERSION", PROGRAM_VERSION, "");
- }
+ if (! Option.xref)
+ {
+ char format [11];
+ const char *formatComment = "unknown format";
+
+ sprintf (format, "%u", Option.tagFileFormat);
+
+ if (Option.tagFileFormat == 1)
+ formatComment = "original ctags format";
+ else if (Option.tagFileFormat == 2)
+ formatComment =
+ "extended format; --format=1 will not append ;\" to lines";
+
+ writePseudoTag ("TAG_FILE_FORMAT", format, formatComment);
+ writePseudoTag ("TAG_FILE_SORTED", Option.sorted ? "1":"0",
+ "0=unsorted, 1=sorted");
+ writePseudoTag ("TAG_PROGRAM_AUTHOR", AUTHOR_NAME, AUTHOR_EMAIL);
+ writePseudoTag ("TAG_PROGRAM_NAME", PROGRAM_NAME, "");
+ writePseudoTag ("TAG_PROGRAM_URL", PROGRAM_URL, "official site");
+ writePseudoTag ("TAG_PROGRAM_VERSION", PROGRAM_VERSION, "");
+ }
}
static void updateSortedFlag (const char *const line,
- MIO *const mio, MIOPos startOfLine)
+ MIO *const mio, MIOPos startOfLine)
{
- const char *const tab = strchr (line, '\t');
+ const char *const tab = strchr (line, '\t');
- if (tab != NULL)
- {
- const long boolOffset = tab - line + 1; /* where it should be */
-
- if (line [boolOffset] == '0' || line [boolOffset] == '1')
+ if (tab != NULL)
{
- MIOPos nextLine;
-
- if (mio_getpos (mio, &nextLine) == -1 || mio_setpos (mio, &startOfLine) == -1)
- error (WARNING, "Failed to update 'sorted' pseudo-tag");
- else
- {
- MIOPos flagLocation;
- int c, d;
-
- do
- c = mio_getc (mio);
- while (c != '\t' && c != '\n');
- mio_getpos (mio, &flagLocation);
- d = mio_getc (mio);
- if (c == '\t' && (d == '0' || d == '1') &&
- d != (int) Option.sorted)
+ const long boolOffset = tab - line + 1; /* where it should be */
+
+ if (line [boolOffset] == '0' || line [boolOffset] == '1')
{
- mio_setpos (mio, &flagLocation);
- mio_putc (mio, Option.sorted ? '1' : '0');
+ MIOPos nextLine;
+
+ if (mio_getpos (mio, &nextLine) == -1 || mio_setpos (mio, &startOfLine) == -1)
+ error (WARNING, "Failed to update 'sorted' pseudo-tag");
+ else
+ {
+ MIOPos flagLocation;
+ int c, d;
+
+ do
+ c = mio_getc (mio);
+ while (c != '\t' && c != '\n');
+ mio_getpos (mio, &flagLocation);
+ d = mio_getc (mio);
+ if (c == '\t' && (d == '0' || d == '1') &&
+ d != (int) Option.sorted)
+ {
+ mio_setpos (mio, &flagLocation);
+ mio_putc (mio, Option.sorted ? '1' : '0');
+ }
+ mio_setpos (mio, &nextLine);
+ }
}
- mio_setpos (mio, &nextLine);
- }
}
- }
}
/* Look through all line beginning with "!_TAG_FILE", and update those which
* require it.
*/
static long unsigned int updatePseudoTags (MIO *const mio)
{
- enum { maxClassLength = 20 };
- char class [maxClassLength + 1];
- unsigned long linesRead = 0;
- MIOPos startOfLine;
- size_t classLength;
- const char *line;
-
- sprintf (class, "%sTAG_FILE", PSEUDO_TAG_PREFIX);
- classLength = strlen (class);
- Assert (classLength < maxClassLength);
-
- mio_getpos (mio, &startOfLine);
- line = readLine (TagFile.vLine, mio);
- while (line != NULL && line [0] == class [0])
- {
- ++linesRead;
- if (strncmp (line, class, classLength) == 0)
+ enum { maxClassLength = 20 };
+ char class [maxClassLength + 1];
+ unsigned long linesRead = 0;
+ MIOPos startOfLine;
+ size_t classLength;
+ const char *line;
+
+ sprintf (class, "%sTAG_FILE", PSEUDO_TAG_PREFIX);
+ classLength = strlen (class);
+ Assert (classLength < maxClassLength);
+
+ mio_getpos (mio, &startOfLine);
+ line = readLine (TagFile.vLine, mio);
+ while (line != NULL && line [0] == class [0])
{
- char tab, classType [16];
-
- if (sscanf (line + classLength, "%15s%c", classType, &tab) == 2 &&
- tab == '\t')
- {
- if (strcmp (classType, "_SORTED") == 0)
- updateSortedFlag (line, mio, startOfLine);
- }
- mio_getpos (mio, &startOfLine);
+ ++linesRead;
+ if (strncmp (line, class, classLength) == 0)
+ {
+ char tab, classType [16];
+
+ if (sscanf (line + classLength, "%15s%c", classType, &tab) == 2 &&
+ tab == '\t')
+ {
+ if (strcmp (classType, "_SORTED") == 0)
+ updateSortedFlag (line, mio, startOfLine);
+ }
+ mio_getpos (mio, &startOfLine);
+ }
+ line = readLine (TagFile.vLine, mio);
}
- line = readLine (TagFile.vLine, mio);
- }
- while (line != NULL) /* skip to end of file */
- {
- ++linesRead;
- line = readLine (TagFile.vLine, mio);
- }
- return linesRead;
+ while (line != NULL) /* skip to end of file */
+ {
+ ++linesRead;
+ line = readLine (TagFile.vLine, mio);
+ }
+ return linesRead;
}
/*
@@ -246,116 +246,116 @@ static long unsigned int updatePseudoTags (MIO *const mio)
static boolean isTagFile (const char *const filename)
{
- boolean ok = FALSE; /* we assume not unless confirmed */
- MIO *const mio = mio_new_file_full (filename, "rb", g_fopen, fclose);
-
- if (mio == NULL && errno == ENOENT)
- ok = TRUE;
- else if (mio != NULL)
- {
- const char *line = readLine (TagFile.vLine, mio);
-
- if (line == NULL)
- ok = TRUE;
- mio_free (mio);
- }
- return ok;
+ boolean ok = FALSE; /* we assume not unless confirmed */
+ MIO *const mio = mio_new_file_full (filename, "rb", g_fopen, fclose);
+
+ if (mio == NULL && errno == ENOENT)
+ ok = TRUE;
+ else if (mio != NULL)
+ {
+ const char *line = readLine (TagFile.vLine, mio);
+
+ if (line == NULL)
+ ok = TRUE;
+ mio_free (mio);
+ }
+ return ok;
}
extern void copyBytes (MIO* const fromMio, MIO* const toMio, const long size)
{
- enum { BufferSize = 1000 };
- long toRead, numRead;
- char* buffer = xMalloc (BufferSize, char);
- long remaining = size;
- do
- {
- toRead = (0 < remaining && remaining < BufferSize) ?
- remaining : BufferSize;
- numRead = mio_read (fromMio, buffer, (size_t) 1, (size_t) toRead);
- if (mio_write (toMio, buffer, (size_t)1, (size_t)numRead) < (size_t)numRead)
- error (FATAL | PERROR, "cannot complete write");
- if (remaining > 0)
- remaining -= numRead;
- } while (numRead == toRead && remaining != 0);
- eFree (buffer);
+ enum { BufferSize = 1000 };
+ long toRead, numRead;
+ char* buffer = xMalloc (BufferSize, char);
+ long remaining = size;
+ do
+ {
+ toRead = (0 < remaining && remaining < BufferSize) ?
+ remaining : BufferSize;
+ numRead = mio_read (fromMio, buffer, (size_t) 1, (size_t) toRead);
+ if (mio_write (toMio, buffer, (size_t)1, (size_t)numRead) < (size_t)numRead)
+ error (FATAL | PERROR, "cannot complete write");
+ if (remaining > 0)
+ remaining -= numRead;
+ } while (numRead == toRead && remaining != 0);
+ eFree (buffer);
}
extern void copyFile (const char *const from, const char *const to, const long size)
{
- MIO* const fromMio = mio_new_file_full (from, "rb", g_fopen, fclose);
- if (fromMio == NULL)
- error (FATAL | PERROR, "cannot open file to copy");
- else
- {
- MIO* const toMio = mio_new_file_full (to, "wb", g_fopen, fclose);
- if (toMio == NULL)
- error (FATAL | PERROR, "cannot open copy destination");
+ MIO* const fromMio = mio_new_file_full (from, "rb", g_fopen, fclose);
+ if (fromMio == NULL)
+ error (FATAL | PERROR, "cannot open file to copy");
else
{
- copyBytes (fromMio, toMio, size);
- mio_free (toMio);
+ MIO* const toMio = mio_new_file_full (to, "wb", g_fopen, fclose);
+ if (toMio == NULL)
+ error (FATAL | PERROR, "cannot open copy destination");
+ else
+ {
+ copyBytes (fromMio, toMio, size);
+ mio_free (toMio);
+ }
+ mio_free (fromMio);
}
- mio_free (fromMio);
- }
}
extern void openTagFile (void)
{
- setDefaultTagFileName ();
- TagsToStdout = isDestinationStdout ();
-
- if (TagFile.vLine == NULL)
- TagFile.vLine = vStringNew ();
-
- /* Open the tags file.
- */
- if (TagsToStdout)
- {
- FILE *fp;
+ setDefaultTagFileName ();
+ TagsToStdout = isDestinationStdout ();
- fp = tempFile ("w", &TagFile.name);
- TagFile.mio = mio_new_fp (fp, fclose);
- }
- else
- {
- boolean fileExists;
+ if (TagFile.vLine == NULL)
+ TagFile.vLine = vStringNew ();
- setDefaultTagFileName ();
- TagFile.name = eStrdup (Option.tagFileName);
- fileExists = doesFileExist (TagFile.name);
- if (fileExists && ! isTagFile (TagFile.name))
- error (FATAL,
- "\"%s\" doesn't look like a tag file; I refuse to overwrite it.",
- TagFile.name);
-
- if (Option.append && fileExists)
+ /* Open the tags file.
+ */
+ if (TagsToStdout)
{
- TagFile.mio = mio_new_file_full (TagFile.name, "r+", g_fopen, fclose);
- if (TagFile.mio != NULL)
- {
- TagFile.numTags.prev = updatePseudoTags (TagFile.mio);
- mio_free (TagFile.mio);
- TagFile.mio = mio_new_file_full (TagFile.name, "a+", g_fopen, fclose);
- }
+ FILE *fp;
+
+ fp = tempFile ("w", &TagFile.name);
+ TagFile.mio = mio_new_fp (fp, fclose);
}
else
{
- TagFile.mio = mio_new_file_full (TagFile.name, "w", g_fopen, fclose);
- if (TagFile.mio != NULL)
- addPseudoTags ();
- }
+ boolean fileExists;
- if (TagFile.mio == NULL)
- {
- error (FATAL | PERROR, "cannot open tag file");
- exit (1);
+ setDefaultTagFileName ();
+ TagFile.name = eStrdup (Option.tagFileName);
+ fileExists = doesFileExist (TagFile.name);
+ if (fileExists && ! isTagFile (TagFile.name))
+ error (FATAL,
+ "\"%s\" doesn't look like a tag file; I refuse to overwrite it.",
+ TagFile.name);
+
+ if (Option.append && fileExists)
+ {
+ TagFile.mio = mio_new_file_full (TagFile.name, "r+", g_fopen, fclose);
+ if (TagFile.mio != NULL)
+ {
+ TagFile.numTags.prev = updatePseudoTags (TagFile.mio);
+ mio_free (TagFile.mio);
+ TagFile.mio = mio_new_file_full (TagFile.name, "a+", g_fopen, fclose);
+ }
+ }
+ else
+ {
+ TagFile.mio = mio_new_file_full (TagFile.name, "w", g_fopen, fclose);
+ if (TagFile.mio != NULL)
+ addPseudoTags ();
+ }
+
+ if (TagFile.mio == NULL)
+ {
+ error (FATAL | PERROR, "cannot open tag file");
+ exit (1);
+ }
}
- }
- if (TagsToStdout)
- TagFile.directory = eStrdup (CurrentDirectory);
- else
- TagFile.directory = absoluteDirname (TagFile.name);
+ if (TagsToStdout)
+ TagFile.directory = eStrdup (CurrentDirectory);
+ else
+ TagFile.directory = absoluteDirname (TagFile.name);
}
#ifdef USE_REPLACEMENT_TRUNCATE
@@ -364,15 +364,15 @@ extern void openTagFile (void)
*/
static int replacementTruncate (const char *const name, const long size)
{
- char *tempName = NULL;
- FILE *fp = tempFile ("w", &tempName);
- fclose (fp);
- copyFile (name, tempName, size);
- copyFile (tempName, name, WHOLE_FILE);
- remove (tempName);
- eFree (tempName);
-
- return 0;
+ char *tempName = NULL;
+ FILE *fp = tempFile ("w", &tempName);
+ fclose (fp);
+ copyFile (name, tempName, size);
+ copyFile (tempName, name, WHOLE_FILE);
+ remove (tempName);
+ eFree (tempName);
+
+ return 0;
}
#endif
@@ -385,31 +385,31 @@ static int replacementTruncate (const char *const name, const long size)
extern void makeTagEntry (const tagEntryInfo *const tag)
{
- Assert (tag->name != NULL);
- if (tag->name [0] == '\0')
- error (WARNING, "ignoring null tag in %s", vStringValue (File.name));
- else
- {
- int length = 0;
+ Assert (tag->name != NULL);
+ if (tag->name [0] == '\0')
+ error (WARNING, "ignoring null tag in %s", vStringValue (File.name));
+ else
+ {
+ int length = 0;
- if (NULL != TagEntryFunction)
- length = TagEntryFunction(tag, TagEntryUserData);
+ if (NULL != TagEntryFunction)
+ length = TagEntryFunction(tag, TagEntryUserData);
- ++TagFile.numTags.added;
- rememberMaxLengths (strlen (tag->name), (size_t) length);
- }
+ ++TagFile.numTags.added;
+ rememberMaxLengths (strlen (tag->name), (size_t) length);
+ }
}
extern void initTagEntry (tagEntryInfo *const e, const char *const name)
{
- Assert (File.source.name != NULL);
- memset (e, 0, sizeof (tagEntryInfo));
- e->lineNumberEntry = (boolean) (Option.locate == EX_LINENUM);
- e->lineNumber = getSourceLineNumber ();
- e->language = getSourceLanguageName ();
- e->filePosition = getInputFilePosition ();
- e->sourceFileName = getSourceFileTagPath ();
- e->name = name;
+ Assert (File.source.name != NULL);
+ memset (e, 0, sizeof (tagEntryInfo));
+ e->lineNumberEntry = (boolean) (Option.locate == EX_LINENUM);
+ e->lineNumber = getSourceLineNumber ();
+ e->language = getSourceLanguageName ();
+ e->filePosition = getInputFilePosition ();
+ e->sourceFileName = getSourceFileTagPath ();
+ e->name = name;
}
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/entry.h
70 lines changed, 35 insertions(+), 35 deletions(-)
===================================================================
@@ -13,7 +13,7 @@
/*
* INCLUDE FILES
*/
-#include "general.h" /* must always come first */
+#include "general.h" /* must always come first */
#include "mio.h"
#include "vstring.h"
@@ -30,48 +30,48 @@
/* Maintains the state of the tag file.
*/
typedef struct eTagFile {
- char *name;
- char *directory;
- MIO *mio;
- struct sNumTags { unsigned long added, prev; } numTags;
- struct sMax { size_t line, tag, file; } max;
- struct sEtags {
char *name;
+ char *directory;
MIO *mio;
- size_t byteCount;
- } etags;
- vString *vLine;
+ struct sNumTags { unsigned long added, prev; } numTags;
+ struct sMax { size_t line, tag, file; } max;
+ struct sEtags {
+ char *name;
+ MIO *mio;
+ size_t byteCount;
+ } etags;
+ vString *vLine;
} tagFile;
typedef struct sTagFields {
- unsigned int count; /* number of additional extension flags */
- const char *const *label; /* list of labels for extension flags */
- const char *const *value; /* list of values for extension flags */
+ unsigned int count; /* number of additional extension flags */
+ const char *const *label; /* list of labels for extension flags */
+ const char *const *value; /* list of values for extension flags */
} tagFields;
/* Information about the current tag candidate.
*/
typedef struct sTagEntryInfo {
- boolean lineNumberEntry;/* pattern or line number entry */
- unsigned long lineNumber; /* line number of tag */
- MIOPos filePosition; /* file position of line containing tag */
- const char* language; /* language of source file */
- boolean isFileScope; /* is tag visible only within source file? */
- boolean isFileEntry; /* is this just an entry for a file name? */
- boolean truncateLine; /* truncate tag line at end of tag name? */
- const char *sourceFileName; /* name of source file */
- const char *name; /* name of the tag */
- const char *kindName; /* kind of tag */
- char kind; /* single character representation of kind */
- struct {
- const char* access;
- const char* fileScope;
- const char* implementation;
- const char* inheritance;
- const char* scope [2]; /* value and key */
- const char *signature; /* Argument list for functions and macros with arguments */
- const char *varType;
- } extensionFields; /* list of extension fields*/
+ boolean lineNumberEntry;/* pattern or line number entry */
+ unsigned long lineNumber; /* line number of tag */
+ MIOPos filePosition; /* file position of line containing tag */
+ const char* language; /* language of source file */
+ boolean isFileScope; /* is tag visible only within source file? */
+ boolean isFileEntry; /* is this just an entry for a file name? */
+ boolean truncateLine; /* truncate tag line at end of tag name? */
+ const char *sourceFileName; /* name of source file */
+ const char *name; /* name of the tag */
+ const char *kindName; /* kind of tag */
+ char kind; /* single character representation of kind */
+ struct {
+ const char* access;
+ const char* fileScope;
+ const char* implementation;
+ const char* inheritance;
+ const char* scope [2]; /* value and key */
+ const char *signature; /* Argument list for functions and macros with arguments */
+ const char *varType;
+ } extensionFields; /* list of extension fields*/
} tagEntryInfo;
/*
@@ -93,6 +93,6 @@ extern void endEtagsFile (const char *const name);
extern void makeTagEntry (const tagEntryInfo *const tag);
extern void initTagEntry (tagEntryInfo *const e, const char *const name);
-#endif /* _ENTRY_H */
+#endif /* _ENTRY_H */
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/general.h
12 lines changed, 6 insertions(+), 6 deletions(-)
===================================================================
@@ -31,7 +31,7 @@
* to prevent warnings about unused variables.
*/
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__APPLE_CC__) || defined (__GNUG__))
-# define UNUSED __attribute__((unused))
+# define UNUSED __attribute__((unused))
# define PRINTF(s,f) __attribute__((format (printf, s, f)))
#else
# define UNUSED
@@ -43,9 +43,9 @@
* stdout instead.
*/
#if defined (MSDOS) || defined (WIN32)
-# define errout stdout
+# define errout stdout
#else
-# define errout stderr
+# define errout stderr
#endif
#if defined (__CYGWIN__)
@@ -204,7 +204,7 @@ int fnmatch(const char *pattern, const char *string, int flags);
/* fake debug statement macro */
#define DebugStatement(x) ;
-#define PrintStatus(x) ;
+#define PrintStatus(x) ;
/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */
void utils_warn(const char *msg);
#define Assert(x) if (!(x)) utils_warn("Assert(" #x ") failed!")
@@ -252,6 +252,6 @@ extern void *unlink (const char *);
extern char *getenv (const char *);
#endif
-#endif /* _GENERAL_H */
+#endif /* _GENERAL_H */
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/main.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -79,4 +79,4 @@ extern char* strstr (const char *str, const char *substr);
#endif /* _MAIN_H */
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/options.c
144 lines changed, 72 insertions(+), 72 deletions(-)
===================================================================
@@ -11,12 +11,12 @@
/*
* INCLUDE FILES
*/
-#include "general.h" /* must always come first */
+#include "general.h" /* must always come first */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h> /* to declare isspace () */
+#include <ctype.h> /* to declare isspace () */
#include "ctags.h"
#include "main.h"
@@ -26,9 +26,9 @@
#include <glib.h>
-#define CTAGS_ENVIRONMENT "CTAGS"
+#define CTAGS_ENVIRONMENT "CTAGS"
-#define CTAGS_FILE "tags"
+#define CTAGS_FILE "tags"
/* The following separators are permitted for list options.
@@ -39,14 +39,14 @@
#define IGNORE_SEPARATORS ", \t\n"
#ifndef DEFAULT_FILE_FORMAT
-# define DEFAULT_FILE_FORMAT 2
+# define DEFAULT_FILE_FORMAT 2
#endif
#if defined (MSDOS) || defined (WIN32) || defined (OS2) || defined (AMIGA) || defined (HAVE_OPENDIR)
# define RECURSE_SUPPORTED
#endif
-#define isCompoundOption(c) (boolean) (strchr ("fohiILpDb", (c)) != NULL)
+#define isCompoundOption(c) (boolean) (strchr ("fohiILpDb", (c)) != NULL)
@@ -55,53 +55,53 @@
*/
optionValues Option = {
- {
- FALSE, /* --extra=f */
- FALSE, /* --extra=q */
- TRUE, /* --file-scope */
- },
- {
- TRUE, /* -fields=a */
- TRUE, /* -fields=f */
- FALSE, /* -fields=m */
- TRUE, /* -fields=i */
- FALSE, /* -fields=k */
- TRUE, /* -fields=z */
- TRUE, /* -fields=K */
- FALSE, /* -fields=l */
- TRUE, /* -fields=n */
- TRUE, /* -fields=s */
- TRUE, /* -fields=P */
- TRUE /* -fields=A */
- },
- NULL, /* -I */
- FALSE, /* -a */
- FALSE, /* -B */
+ {
+ FALSE, /* --extra=f */
+ FALSE, /* --extra=q */
+ TRUE, /* --file-scope */
+ },
+ {
+ TRUE, /* -fields=a */
+ TRUE, /* -fields=f */
+ FALSE, /* -fields=m */
+ TRUE, /* -fields=i */
+ FALSE, /* -fields=k */
+ TRUE, /* -fields=z */
+ TRUE, /* -fields=K */
+ FALSE, /* -fields=l */
+ TRUE, /* -fields=n */
+ TRUE, /* -fields=s */
+ TRUE, /* -fields=P */
+ TRUE /* -fields=A */
+ },
+ NULL, /* -I */
+ FALSE, /* -a */
+ FALSE, /* -B */
#ifdef MACROS_USE_PATTERNS
- EX_PATTERN, /* -n, --excmd */
+ EX_PATTERN, /* -n, --excmd */
#else
- EX_MIX, /* -n, --excmd */
+ EX_MIX, /* -n, --excmd */
#endif
- FALSE, /* -R */
- TRUE, /* -u, --sort */
- FALSE, /* -V */
- FALSE, /* -x */
- NULL, /* -L */
- NULL, /* -o */
- NULL, /* -h */
- NULL, /* --etags-include */
- DEFAULT_FILE_FORMAT,/* --format */
- FALSE, /* --if0 */
- FALSE, /* --kind-long */
- LANG_AUTO, /* --lang */
- TRUE, /* --links */
- FALSE, /* --filter */
- NULL, /* --filter-terminator */
- FALSE, /* --qualified-tags */
- FALSE, /* --tag-relative */
- FALSE, /* --totals */
- FALSE, /* --line-directives */
- FALSE, /* --nest */
+ FALSE, /* -R */
+ TRUE, /* -u, --sort */
+ FALSE, /* -V */
+ FALSE, /* -x */
+ NULL, /* -L */
+ NULL, /* -o */
+ NULL, /* -h */
+ NULL, /* --etags-include */
+ DEFAULT_FILE_FORMAT,/* --format */
+ FALSE, /* --if0 */
+ FALSE, /* --kind-long */
+ LANG_AUTO, /* --lang */
+ TRUE, /* --links */
+ FALSE, /* --filter */
+ NULL, /* --filter-terminator */
+ FALSE, /* --qualified-tags */
+ FALSE, /* --tag-relative */
+ FALSE, /* --totals */
+ FALSE, /* --line-directives */
+ FALSE, /* --nest */
};
@@ -111,11 +111,11 @@ extern void verbose (const char *const format, ...)
extern void freeList (stringList** const pList)
{
- if (*pList != NULL)
- {
- stringListDelete (*pList);
- *pList = NULL;
- }
+ if (*pList != NULL)
+ {
+ stringListDelete (*pList);
+ *pList = NULL;
+ }
}
extern void setDefaultTagFileName (void)
@@ -128,17 +128,17 @@ extern void setDefaultTagFileName (void)
*/
extern const char *fileExtension (const char *const fileName)
{
- const char *extension;
- const char *pDelimiter = NULL;
+ const char *extension;
+ const char *pDelimiter = NULL;
- pDelimiter = strrchr (fileName, '.');
+ pDelimiter = strrchr (fileName, '.');
- if (pDelimiter == NULL)
- extension = "";
- else
- extension = pDelimiter + 1; /* skip to first char of extension */
+ if (pDelimiter == NULL)
+ extension = "";
+ else
+ extension = pDelimiter + 1; /* skip to first char of extension */
- return extension;
+ return extension;
}
/* Determines whether the specified file name is considered to be a header
@@ -147,7 +147,7 @@ extern const char *fileExtension (const char *const fileName)
*/
extern boolean isIncludeFile (const char *const fileName)
{
- return FALSE;
+ return FALSE;
}
/* tags_ignore is a NULL-terminated array of strings, read from ~/.config/geany/ignore.tags.
@@ -158,8 +158,8 @@ gchar **c_tags_ignore = NULL;
/* Determines whether or not "name" should be ignored, per the ignore list.
*/
extern boolean isIgnoreToken (const char *const name,
- boolean *const pIgnoreParens,
- const char **const replacement)
+ boolean *const pIgnoreParens,
+ const char **const replacement)
{
boolean result = FALSE;
@@ -217,11 +217,11 @@ extern boolean isIgnoreToken (const char *const name,
void addIgnoreListFromFile (const char *const fileName)
{
- stringList* tokens = stringListNewFromFile (fileName);
- if (Option.ignore == NULL)
- Option.ignore = tokens;
- else
- stringListCombine (Option.ignore, tokens);
+ stringList* tokens = stringListNewFromFile (fileName);
+ if (Option.ignore == NULL)
+ Option.ignore = tokens;
+ else
+ stringListCombine (Option.ignore, tokens);
}
@@ -233,4 +233,4 @@ void addIgnoreListFromFile (const char *const fileName)
#define initOptions
#define freeOptionResources
-/* vi:set tabstop=8 shiftwidth=4: */
+/* vi:set tabstop=4 shiftwidth=4: */
Modified: ctags/main/options.h
100 lines changed, 50 insertions(+), 50 deletions(-)
===================================================================
@@ -19,7 +19,7 @@
/*
* INCLUDE FILES
*/
-#include "general.h" /* must always come first */
+#include "general.h" /* must always come first */
#include <stdarg.h>
@@ -36,59 +36,59 @@
/* This stores the command line options.
*/
typedef struct sOptionValues {
- struct sInclude {
- boolean fileNames; /* include tags for source file names */
- boolean qualifiedTags; /* include tags for qualified class members */
- boolean fileScope; /* include tags of file scope only */
- } include;
- struct sExtFields { /* extension field content control */
- boolean access;
- boolean fileScope;
- boolean implementation;
- boolean inheritance;
- boolean kind;
- boolean kindKey;
- boolean kindLong;
- boolean language;
- boolean lineNumber;
- boolean scope;
- boolean filePosition; /* Write file position */
- boolean argList; /* Write function and macro argumentlist */
- } extensionFields;
- stringList* ignore; /* -I name of file containing tokens to ignore */
- boolean append; /* -a append to "tags" file */
- boolean backward; /* -B regexp patterns search backwards */
- enum eLocate {
- EX_MIX, /* line numbers for defines, patterns otherwise */
- EX_LINENUM, /* -n only line numbers in tag file */
- EX_PATTERN /* -N only patterns in tag file */
- } locate; /* --excmd EX command used to locate tag */
- boolean recurse; /* -R recurse into directories */
- boolean sorted; /* -u,--sort sort tags */
- boolean verbose; /* -V verbose */
- boolean xref; /* -x generate xref output instead */
- char *fileList; /* -L name of file containing names of files */
- char *tagFileName; /* -o name of tags file */
- stringList* headerExt; /* -h header extensions */
- stringList* etagsInclude;/* --etags-include list of TAGS files to include*/
- unsigned int tagFileFormat;/* --format tag file format (level) */
- boolean if0; /* --if0 examine code within "#if 0" branch */
- boolean kindLong; /* --kind-long */
- langType language; /* --lang specified language override */
- boolean followLinks; /* --link follow symbolic links? */
- boolean filter; /* --filter behave as filter: files in, tags out */
- char* filterTerminator; /* --filter-terminator string to output */
- boolean qualifiedTags; /* --qualified-tags include class-qualified tag */
- boolean tagRelative; /* --tag-relative file paths relative to tag file */
- boolean printTotals; /* --totals print cumulative statistics */
- boolean lineDirectives; /* --linedirectives process #line directives */
+ struct sInclude {
+ boolean fileNames; /* include tags for source file names */
+ boolean qualifiedTags; /* include tags for qualified class members */
+ boolean fileScope; /* include tags of file scope only */
+ } include;
+ struct sExtFields { /* extension field content control */
+ boolean access;
+ boolean fileScope;
+ boolean implementation;
+ boolean inheritance;
+ boolean kind;
+ boolean kindKey;
+ boolean kindLong;
+ boolean language;
+ boolean lineNumber;
+ boolean scope;
+ boolean filePosition; /* Write file position */
+ boolean argList; /* Write function and macro argumentlist */
+ } extensionFields;
+ stringList* ignore; /* -I name of file containing tokens to ignore */
+ boolean append; /* -a append to "tags" file */
+ boolean backward; /* -B regexp patterns search backwards */
+ enum eLocate {
+ EX_MIX, /* line numbers for defines, patterns otherwise */
+ EX_LINENUM, /* -n only line numbers in tag file */
+ EX_PATTERN /* -N only patterns in tag file */
+ } locate; /* --excmd EX command used to locate tag */
+ boolean recurse; /* -R recurse into directories */
+ boolean sorted; /* -u,--sort sort tags */
+ boolean verbose; /* -V verbose */
+ boolean xref; /* -x generate xref output instead */
+ char *fileList; /* -L name of file containing names of files */
+ char *tagFileName; /* -o name of tags file */
+ stringList* headerExt; /* -h header extensions */
+ stringList* etagsInclude;/* --etags-include list of TAGS files to include*/
+ unsigned int tagFileFormat;/* --format tag file format (level) */
+ boolean if0; /* --if0 examine code within "#if 0" branch */
+ boolean kindLong; /* --kind-long */
+ langType language; /* --lang specified language override */
+ boolean followLinks; /* --link follow symbolic links? */
+ boolean filter; /* --filter behave as filter: files in, tags out */
+ char* filterTerminator; /* --filter-terminator string to output */
+ boolean qualifiedTags; /* --qualified-tags include class-qualified tag */
+ boolean tagRelative; /* --tag-relative file paths relative to tag file */
+ boolean printTotals; /* --totals print cumulative statistics */
+ boolean lineDirectives; /* --linedirectives process #line directives */
boolean nestFunction; /* --nest Nest inside function blocks for tags */
} optionValues;
/*
* GLOBAL VARIABLES
*/
-extern CONST_OPTION optionValues Option;
+extern CONST_OPTION optionValues Option;
/*
* FUNCTION PROTOTYPES
@@ -106,6 +106,6 @@ extern void freeOpti@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list