Sync whitespace and comments in main

This commit is contained in:
Jiří Techet 2016-08-07 16:57:55 +02:00
parent 967b572240
commit ca65fa2236
25 changed files with 161 additions and 169 deletions

View File

@ -1,9 +1,8 @@
/* /*
* * Copyright (c) 1999-2002, Darren Hiebert
* Copyright (c) 1999-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions for reading command line arguments. * This module contains functions for reading command line arguments.
*/ */
@ -11,13 +10,14 @@
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "args.h" #include "args.h"
#include "debug.h"
#include "routines.h" #include "routines.h"
/* /*

View File

@ -1,19 +1,20 @@
/* /*
* * Copyright (c) 1999-2002, Darren Hiebert
* Copyright (c) 1999-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Defines external interface to command line argument reading. * Defines external interface to command line argument reading.
*/ */
#ifndef _ARGS_H #ifndef CTAGS_MAIN_ARGS_H
#define _ARGS_H #define CTAGS_MAIN_ARGS_H
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <stdio.h>
/* /*
* DATA DECLARATIONS * DATA DECLARATIONS
@ -53,6 +54,6 @@ extern void argSetLineMode (Arguments* const current);
extern void argForth (Arguments* const current); extern void argForth (Arguments* const current);
extern void argDelete (Arguments* const current); extern void argDelete (Arguments* const current);
#endif /* _ARGS_H */ #endif /* CTAGS_MAIN_ARGS_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -1,13 +1,15 @@
/* /*
* Copyright (c) 1996-2001, Darren Hiebert * Copyright (c) 1996-2002, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Program definitions * Program definitions
*/ */
#ifndef _CTAGS_H #ifndef CTAGS_MAIN_CTAGS_H
#define _CTAGS_H #define CTAGS_MAIN_CTAGS_H
#include "general.h"
/* /*
* MACROS * MACROS
@ -20,6 +22,6 @@
#define AUTHOR_NAME "Darren Hiebert" #define AUTHOR_NAME "Darren Hiebert"
#define AUTHOR_EMAIL "darren@hiebert.com" #define AUTHOR_EMAIL "darren@hiebert.com"
#endif /* _CTAGS_H */ #endif /* CTAGS_MAIN_CTAGS_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -1,9 +1,8 @@
/* /*
* * Copyright (c) 1996-2002, Darren Hiebert
* Copyright (c) 1996-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions for creating tag entries. * This module contains functions for creating tag entries.
*/ */
@ -11,19 +10,19 @@
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <string.h> #include <string.h>
#include <ctype.h> /* to define isspace () */ #include <ctype.h> /* to define isspace () */
#include <errno.h> #include <errno.h>
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#if defined (HAVE_SYS_TYPES_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 #endif
#if defined (HAVE_TYPES_H) #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 #endif
@ -159,14 +158,14 @@ static void addPseudoTags (void)
} }
} }
static void updateSortedFlag (const char *const line, static void updateSortedFlag (
MIO *const mio, MIOPos startOfLine) const char *const line, MIO *const mio, MIOPos startOfLine)
{ {
const char *const tab = strchr (line, '\t'); const char *const tab = strchr (line, '\t');
if (tab != NULL) if (tab != NULL)
{ {
const long boolOffset = tab - line + 1; /* where it should be */ const long boolOffset = tab - line + 1; /* where it should be */
if (line [boolOffset] == '0' || line [boolOffset] == '1') if (line [boolOffset] == '0' || line [boolOffset] == '1')
{ {
@ -231,7 +230,7 @@ static long unsigned int updatePseudoTags (MIO *const mio)
} }
line = readLineRaw (TagFile.vLine, mio); line = readLineRaw (TagFile.vLine, mio);
} }
while (line != NULL) /* skip to end of file */ while (line != NULL) /* skip to end of file */
{ {
++linesRead; ++linesRead;
line = readLineRaw (TagFile.vLine, mio); line = readLineRaw (TagFile.vLine, mio);

View File

@ -1,19 +1,18 @@
/* /*
* * Copyright (c) 1998-2002, Darren Hiebert
* Copyright (c) 1998-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* External interface to entry.c * External interface to entry.c
*/ */
#ifndef _ENTRY_H #ifndef CTAGS_MAIN_ENTRY_H
#define _ENTRY_H #define CTAGS_MAIN_ENTRY_H
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include "mio.h" #include "mio.h"
#include "vstring.h" #include "vstring.h"
@ -96,6 +95,6 @@ extern void endEtagsFile (const char *const name);
extern void makeTagEntry (const tagEntryInfo *const tag); extern void makeTagEntry (const tagEntryInfo *const tag);
extern void initTagEntry (tagEntryInfo *const e, const char *const name, const kindOption *kind); extern void initTagEntry (tagEntryInfo *const e, const char *const name, const kindOption *kind);
#endif /* _ENTRY_H */ #endif /* CTAGS_MAIN_ENTRY_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -1,19 +1,18 @@
/* /*
* * Copyright (c) 1998-2003, Darren Hiebert
* Copyright (c) 1998-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Provides the general (non-ctags-specific) environment assumed by all. * Provides the general (non-ctags-specific) environment assumed by all.
*/ */
#ifndef _GENERAL_H #ifndef CTAGS_MAIN_GENERAL_H
#define _GENERAL_H #define CTAGS_MAIN_GENERAL_H
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#ifdef HAVE_CONFIG_H #if defined (HAVE_CONFIG_H)
# include <config.h> # include <config.h>
#endif #endif
#ifdef macintosh #ifdef macintosh
@ -151,6 +150,6 @@ extern void *unlink (const char *);
extern char *getenv (const char *); extern char *getenv (const char *);
#endif #endif
#endif /* _GENERAL_H */ #endif /* CTAGS_MAIN_GENERAL_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -166,7 +166,7 @@ extern void cppEndStatement (void)
* directives and may emit a tag for #define directives. * directives and may emit a tag for #define directives.
*/ */
/* This puts a character back into the input queue for the source File. /* This puts a character back into the input queue for the input File.
* Up to two characters may be ungotten. * Up to two characters may be ungotten.
*/ */
extern void cppUngetc (const int c) extern void cppUngetc (const int c)

View File

@ -2,11 +2,11 @@
* Copyright (c) 2000-2003, Darren Hiebert * Copyright (c) 2000-2003, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions for applying regular expression matching. * This module contains functions for applying regular expression matching.
* *
* The code for utlizing the Gnu regex package with regards to processing the * The code for utilizing the Gnu regex package with regards to processing the
* regex option and checking for regex matches was adapted from routines in * regex option and checking for regex matches was adapted from routines in
* Gnu etags. * Gnu etags.
*/ */
@ -91,6 +91,7 @@ static int SetUpper = -1; /* upper language index in list */
* FUNCTION DEFINITIONS * FUNCTION DEFINITIONS
*/ */
static void clearPatternSet (const langType language) static void clearPatternSet (const langType language)
{ {
if (language <= SetUpper) if (language <= SetUpper)

View File

@ -71,7 +71,7 @@
/* /*
* MACROS * MACROS
*/ */
#define plural(value) (((unsigned long)(value) == 1L) ? "" : "s") #define plural(value) (((unsigned long)(value) == 1L) ? "" : "s")
/* /*
* DATA DEFINITIONS * DATA DEFINITIONS

View File

@ -3,7 +3,7 @@
* Copyright 2009-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> * Copyright 2009-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Defines external interface to scope nesting levels for tags. * Defines external interface to scope nesting levels for tags.
*/ */

View File

@ -3,12 +3,12 @@
* Copyright 2009-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> * Copyright 2009-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Defines external interface to scope nesting levels for tags. * Defines external interface to scope nesting levels for tags.
*/ */
#ifndef _NESTLEVEL_H #ifndef CTAGS_MAIN_NESTLEVEL_H
#define _NESTLEVEL_H #define CTAGS_MAIN_NESTLEVEL_H
/* /*
* INCLUDE FILES * INCLUDE FILES
@ -47,6 +47,6 @@ extern void nestingLevelsPush(NestingLevels *nls,
extern void nestingLevelsPop(NestingLevels *nls); extern void nestingLevelsPop(NestingLevels *nls);
extern NestingLevel *nestingLevelsGetCurrent(NestingLevels *nls); extern NestingLevel *nestingLevelsGetCurrent(NestingLevels *nls);
#endif /* _NESTLEVEL_H */ #endif /* CTAGS_MAIN_NESTLEVEL_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -1,9 +1,8 @@
/* /*
* * Copyright (c) 1996-2003, Darren Hiebert
* Copyright (c) 1996-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions to process command line options. * This module contains functions to process command line options.
*/ */
@ -11,12 +10,12 @@
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> /* to declare isspace () */ #include <ctype.h> /* to declare isspace () */
#include "ctags.h" #include "ctags.h"
#include "routines.h" #include "routines.h"
@ -28,7 +27,7 @@
#define CTAGS_ENVIRONMENT "CTAGS" #define CTAGS_ENVIRONMENT "CTAGS"
#define CTAGS_FILE "tags" #define CTAGS_FILE "tags"
/* The following separators are permitted for list options. /* The following separators are permitted for list options.
@ -39,14 +38,14 @@
#define IGNORE_SEPARATORS ", \t\n" #define IGNORE_SEPARATORS ", \t\n"
#ifndef DEFAULT_FILE_FORMAT #ifndef DEFAULT_FILE_FORMAT
# define DEFAULT_FILE_FORMAT 2 # define DEFAULT_FILE_FORMAT 2
#endif #endif
#if defined (WIN32) || defined (HAVE_OPENDIR) #if defined (WIN32) || defined (HAVE_OPENDIR)
# define RECURSE_SUPPORTED # define RECURSE_SUPPORTED
#endif #endif
#define isCompoundOption(c) (boolean) (strchr ("fohiILpDb", (c)) != NULL) #define isCompoundOption(c) (boolean) (strchr ("fohiILpDb", (c)) != NULL)

View File

@ -18,7 +18,7 @@
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <stdarg.h> #include <stdarg.h>
@ -88,7 +88,7 @@ typedef struct sOptionValues {
/* /*
* GLOBAL VARIABLES * GLOBAL VARIABLES
*/ */
extern CONST_OPTION optionValues Option; extern CONST_OPTION optionValues Option;
/* /*
* FUNCTION PROTOTYPES * FUNCTION PROTOTYPES
@ -106,6 +106,6 @@ extern void freeOptionResources (void);
void addIgnoreListFromFile (const char *const fileName); void addIgnoreListFromFile (const char *const fileName);
#endif /* _OPTIONS_H */ #endif /* CTAGS_MAIN_OPTIONS_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -1,18 +1,17 @@
/* /*
* * Copyright (c) 1996-2003, Darren Hiebert
* Copyright (c) 1996-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions for managing source languages and * This module contains functions for managing input languages and
* dispatching files to the appropriate language parser. * dispatching files to the appropriate language parser.
*/ */
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <string.h> #include <string.h>
@ -163,7 +162,7 @@ static vString* determineInterpreter (const char* const cmd)
{ {
vStringClear (interpreter); vStringClear (interpreter);
for ( ; isspace (*p) ; ++p) for ( ; isspace (*p) ; ++p)
; /* no-op */ ; /* no-op */
for ( ; *p != '\0' && ! isspace (*p) ; ++p) for ( ; *p != '\0' && ! isspace (*p) ; ++p)
vStringPut (interpreter, (int) *p); vStringPut (interpreter, (int) *p);
vStringTerminate (interpreter); vStringTerminate (interpreter);

View File

@ -1,21 +1,20 @@
/* /*
* * Copyright (c) 1998-2003, Darren Hiebert
* Copyright (c) 1998-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Private definitions for parsing support. * Private definitions for parsing support.
*/ */
#ifndef _PARSE_H #ifndef CTAGS_MAIN_PARSE_H
#define _PARSE_H #define CTAGS_MAIN_PARSE_H
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include "parsers.h" /* contains list of parsers */ #include "parsers.h" /* contains list of parsers */
#include "strlist.h" #include "strlist.h"
#include "entry.h" #include "entry.h"
@ -59,15 +58,15 @@ typedef struct {
typedef struct { typedef struct {
/* defined by parser */ /* defined by parser */
char* name; /* name of language */ char* name; /* name of language */
kindOption* kinds; /* tag kinds handled by parser */ kindOption* kinds; /* tag kinds handled by parser */
unsigned int kindCount; /* size of `kinds' list */ unsigned int kindCount; /* size of `kinds' list */
kindOption* fileKind; /* kind for overriding the default fileKind */ kindOption* fileKind; /* kind for overriding the default fileKind */
const char* const* extensions; /* list of default extensions */ const char *const *extensions; /* list of default extensions */
const char* const* patterns; /* list of default file name patterns */ const char *const *patterns; /* list of default file name patterns */
parserInitialize initialize; /* initialization routine, if needed */ parserInitialize initialize; /* initialization routine, if needed */
simpleParser parser; /* simple parser (common case) */ simpleParser parser; /* simple parser (common case) */
rescanParser parser2; /* rescanning parser (unusual case) */ rescanParser parser2; /* rescanning parser (unusual case) */
unsigned int method; /* See PARSE__... definitions above */ unsigned int method; /* See PARSE__... definitions above */
/* used internally */ /* used internally */
@ -157,6 +156,6 @@ extern tagEntryFunction TagEntryFunction;
extern void *TagEntryUserData; extern void *TagEntryUserData;
extern void setTagEntryFunction(tagEntryFunction entry_function, void *user_data); extern void setTagEntryFunction(tagEntryFunction entry_function, void *user_data);
#endif /* _PARSE_H */ #endif /* CTAGS_MAIN_PARSE_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -1,17 +1,16 @@
/* /*
* * Copyright (c) 2000-2003, Darren Hiebert
* Copyright (c) 2000-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* External interface to all language parsing modules. * External interface to all language parsing modules.
* *
* To add a new language parser, you need only modify this single source * To add a new language parser, you need only modify this single input
* file to add the name of the parser definition function. * file to add the name of the parser definition function.
*/ */
#ifndef _PARSERS_H #ifndef CTAGS_MAIN_PARSERS_H
#define _PARSERS_H #define CTAGS_MAIN_PARSERS_H
/* Add the name of any new parser definition function here */ /* Add the name of any new parser definition function here */
/* keep src/tagmanager/tm_parser.h in sync */ /* keep src/tagmanager/tm_parser.h in sync */
@ -68,6 +67,6 @@
ZephirParser, \ ZephirParser, \
PowerShellParser PowerShellParser
#endif /* _PARSERS_H */ #endif /* CTAGS_MAIN_PARSERS_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -258,7 +258,7 @@ extern boolean fileOpen (const char *const fileName, const langType language)
*/ */
if (File.mio != NULL) if (File.mio != NULL)
{ {
mio_free (File.mio); /* close any open source file */ mio_free (File.mio); /* close any open input file */
File.mio = NULL; File.mio = NULL;
} }
@ -365,8 +365,8 @@ static void fileNewline (void)
File.newLine = FALSE; File.newLine = FALSE;
File.input.lineNumber++; File.input.lineNumber++;
File.source.lineNumber++; File.source.lineNumber++;
DebugStatement ( if (Option.breakLine == File.lineNumber) lineBreak (); ) DebugStatement ( if (Option.breakLine == File.input.lineNumber) lineBreak (); )
DebugStatement ( debugPrintf (DEBUG_RAW, "%6ld: ", File.lineNumber); ) DebugStatement ( debugPrintf (DEBUG_RAW, "%6ld: ", File.input.lineNumber); )
} }
/* This function reads a single character from the stream, performing newline /* This function reads a single character from the stream, performing newline
@ -412,7 +412,7 @@ readnext:
if (next != NEWLINE) if (next != NEWLINE)
mio_ungetc (File.mio, next); mio_ungetc (File.mio, next);
c = NEWLINE; /* convert CR into newline */ c = NEWLINE; /* convert CR into newline */
File.newLine = TRUE; File.newLine = TRUE;
mio_getpos (File.mio, &StartOfLine); mio_getpos (File.mio, &StartOfLine);
} }

View File

@ -1,19 +1,18 @@
/* /*
* * Copyright (c) 1998-2002, Darren Hiebert
* Copyright (c) 1998-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* External interface to read.c * External interface to read.c
*/ */
#ifndef _READ_H #ifndef CTAGS_MAIN_READ_H
#define _READ_H #define CTAGS_MAIN_READ_H
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
@ -40,17 +39,15 @@
*/ */
enum eCharacters { enum eCharacters {
/* White space characters. /* white space characters */
*/ SPACE = ' ',
SPACE = ' ', NEWLINE = '\n',
NEWLINE = '\n', CRETURN = '\r',
CRETURN = '\r', FORMFEED = '\f',
FORMFEED = '\f', TAB = '\t',
TAB = '\t', VTAB = '\v',
VTAB = '\v',
/* Some hard to read characters. /* some hard to read characters */
*/
DOUBLE_QUOTE = '"', DOUBLE_QUOTE = '"',
SINGLE_QUOTE = '\'', SINGLE_QUOTE = '\'',
BACKSLASH = '\\', BACKSLASH = '\\',
@ -120,6 +117,6 @@ extern boolean bufferOpen (unsigned char *buffer, size_t buffer_size,
const char *const fileName, const langType language ); const char *const fileName, const langType language );
#define bufferClose fileClose #define bufferClose fileClose
#endif /* _READ_H */ #endif /* CTAGS_MAIN_READ_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -332,7 +332,7 @@ extern boolean isRecursiveLink (const char* const dirName)
char *const separator = strrchr (path, PATH_SEPARATOR); char *const separator = strrchr (path, PATH_SEPARATOR);
if (separator == NULL) if (separator == NULL)
break; break;
else if (separator == path) /* backed up to root directory */ else if (separator == path) /* backed up to root directory */
*(separator + 1) = '\0'; *(separator + 1) = '\0';
else else
*separator = '\0'; *separator = '\0';
@ -379,7 +379,7 @@ extern const char *baseFilename (const char *const filePath)
if (tail == NULL) if (tail == NULL)
tail = filePath; tail = filePath;
else else
++tail; /* step past last delimiter */ ++tail; /* step past last delimiter */
return tail; return tail;
} }
@ -473,7 +473,6 @@ extern char* absoluteFilename (const char *file)
{ {
char *slashp, *cp; char *slashp, *cp;
char *res = NULL; char *res = NULL;
if (isAbsolutePath (file)) if (isAbsolutePath (file))
res = eStrdup (file); res = eStrdup (file);
else else
@ -519,7 +518,7 @@ extern char* absoluteFilename (const char *file)
else else
{ {
#ifdef MSDOS_STYLE_PATH #ifdef MSDOS_STYLE_PATH
/* Canonicalize drive letter case. */ /* Canonicalize drive letter case. */
if (res [1] == ':' && islower (res [0])) if (res [1] == ':' && islower (res [0]))
res [0] = toupper (res [0]); res [0] = toupper (res [0]);
#endif #endif
@ -572,11 +571,11 @@ extern char* relativeFilename (const char *file, const char *dir)
while (*fp++ == *dp++) while (*fp++ == *dp++)
continue; continue;
fp--; fp--;
dp--; /* back to the first differing char */ dp--; /* back to the first differing char */
do do
{ /* look at the equal chars until '/' */ { /* look at the equal chars until '/' */
if (fp == absdir) if (fp == absdir)
return absdir; /* first char differs, give up */ return absdir; /* first char differs, give up */
fp--; fp--;
dp--; dp--;
} while (*fp != '/'); } while (*fp != '/');

View File

@ -1,9 +1,8 @@
/* /*
* * Copyright (c) 1996-2002, Darren Hiebert
* Copyright (c) 1996-2001, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions to sort the tag entries. * This module contains functions to sort the tag entries.
*/ */
@ -11,10 +10,10 @@
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#if defined (HAVE_STDLIB_H) #if defined (HAVE_STDLIB_H)
# include <stdlib.h> /* to declare malloc () */ # include <stdlib.h> /* to declare malloc () */
#endif #endif
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -124,8 +123,8 @@ static int compareTags (const void *const one, const void *const two)
return strcmp (line1, line2); return strcmp (line1, line2);
} }
static void writeSortedTags (char **const table, const size_t numTags, static void writeSortedTags (
const boolean toStdout) char **const table, const size_t numTags, const boolean toStdout)
{ {
MIO *mio; MIO *mio;
size_t i; size_t i;
@ -186,7 +185,7 @@ extern void internalSortTags (const boolean toStdout)
break; break;
} }
else if (*line == '\0' || strcmp (line, "\n") == 0) else if (*line == '\0' || strcmp (line, "\n") == 0)
; /* ignore blank lines */ ; /* ignore blank lines */
else else
{ {
const size_t stringSize = strlen (line) + 1; const size_t stringSize = strlen (line) + 1;

View File

@ -1,18 +1,18 @@
/* /*
* Copyright (c) 1998-2001, Darren Hiebert * Copyright (c) 1998-2002, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* External interface to sort.c * External interface to sort.c
*/ */
#ifndef _SORT_H #ifndef CTAGS_MAIN_SORT_H
#define _SORT_H #define CTAGS_MAIN_SORT_H
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
/* /*
* FUNCTION PROTOTYPES * FUNCTION PROTOTYPES
@ -25,6 +25,6 @@ extern void externalSortTags (const boolean toStdout);
extern void internalSortTags (const boolean toStdout); extern void internalSortTags (const boolean toStdout);
#endif #endif
#endif /* _SORT_H */ #endif /* CTAGS_MAIN_SORT_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -2,7 +2,7 @@
* Copyright (c) 1999-2002, Darren Hiebert * Copyright (c) 1999-2002, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions managing resizable string lists. * This module contains functions managing resizable string lists.
*/ */

View File

@ -2,12 +2,12 @@
* Copyright (c) 1999-2002, Darren Hiebert * Copyright (c) 1999-2002, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Defines external interface to resizable string lists. * Defines external interface to resizable string lists.
*/ */
#ifndef _STRLIST_H #ifndef CTAGS_MAIN_STRLIST_H
#define _STRLIST_H #define CTAGS_MAIN_STRLIST_H
/* /*
* INCLUDE FILES * INCLUDE FILES
@ -47,6 +47,6 @@ extern boolean stringListExtensionMatched (const stringList* const list, const c
extern boolean stringListFileMatched (const stringList* const list, const char* const str); extern boolean stringListFileMatched (const stringList* const list, const char* const str);
extern void stringListPrint (const stringList *const current); extern void stringListPrint (const stringList *const current);
#endif /* _STRLIST_H */ #endif /* CTAGS_MAIN_STRLIST_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */

View File

@ -1,9 +1,8 @@
/* /*
*
* Copyright (c) 1998-2002, Darren Hiebert * Copyright (c) 1998-2002, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* This module contains functions supporting resizeable strings. * This module contains functions supporting resizeable strings.
*/ */
@ -11,12 +10,13 @@
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#include <limits.h> /* to define INT_MAX */ #include <limits.h> /* to define INT_MAX */
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "debug.h"
#include "routines.h" #include "routines.h"
#include "vstring.h" #include "vstring.h"
@ -60,7 +60,7 @@ extern void vStringTruncate (vString *const string, const size_t length)
string->length = length; string->length = length;
vStringTerminate (string); vStringTerminate (string);
DebugStatement ( memset (string->buffer + string->length, 0, DebugStatement ( memset (string->buffer + string->length, 0,
string->size - string->length); ) string->size - string->length); )
} }
extern void vStringClear (vString *const string) extern void vStringClear (vString *const string)
@ -134,7 +134,7 @@ extern vString *vStringNewInit (const char *const s)
} }
extern void vStringNCatS ( extern void vStringNCatS (
vString *const string, const char *const s, const size_t length) vString *const string, const char *const s, const size_t length)
{ {
const char *p = s; const char *p = s;
size_t remain = length; size_t remain = length;
@ -204,7 +204,7 @@ extern void vStringCopyS (vString *const string, const char *const s)
} }
extern void vStringNCopyS ( extern void vStringNCopyS (
vString *const string, const char *const s, const size_t length) vString *const string, const char *const s, const size_t length)
{ {
vStringClear (string); vStringClear (string);
vStringNCatS (string, s, length); vStringNCatS (string, s, length);

View File

@ -2,20 +2,20 @@
* Copyright (c) 1998-2002, Darren Hiebert * Copyright (c) 1998-2002, Darren Hiebert
* *
* This source code is released for free distribution under the terms of the * This source code is released for free distribution under the terms of the
* GNU General Public License. * GNU General Public License version 2 or (at your option) any later version.
* *
* Provides the external interface for resizeable strings. * Provides the external interface for resizeable strings.
*/ */
#ifndef _VSTRING_H #ifndef CTAGS_MAIN_VSTRING_H
#define _VSTRING_H #define CTAGS_MAIN_VSTRING_H
/* /*
* INCLUDE FILES * INCLUDE FILES
*/ */
#include "general.h" /* must always come first */ #include "general.h" /* must always come first */
#if defined(HAVE_STDLIB_H) #if defined(HAVE_STDLIB_H)
# include <stdlib.h> /* to define size_t */ # include <stdlib.h> /* to define size_t */
#endif #endif
/* /*
@ -26,33 +26,33 @@
#endif #endif
#ifdef VSTRING_PUTC_MACRO #ifdef VSTRING_PUTC_MACRO
#define vStringPut(s,c) \ #define vStringPut(s,c) \
(void)(((s)->length + 1 == (s)->size ? vStringAutoResize (s) : 0), \ (void)(((s)->length + 1 == (s)->size ? vStringAutoResize (s) : 0), \
((s)->buffer [(s)->length] = (c)), \ ((s)->buffer [(s)->length] = (c)), \
((c) == '\0' ? 0 : ((s)->buffer [++(s)->length] = '\0'))) ((c) == '\0' ? 0 : ((s)->buffer [++(s)->length] = '\0')))
#endif #endif
#define vStringValue(vs) ((vs)->buffer) #define vStringValue(vs) ((vs)->buffer)
#define vStringItem(vs,i) ((vs)->buffer[i]) #define vStringItem(vs,i) ((vs)->buffer[i])
#define vStringLast(vs) ((vs)->buffer[(vs)->length - 1]) #define vStringLast(vs) ((vs)->buffer[(vs)->length - 1])
#define vStringLength(vs) ((vs)->length) #define vStringLength(vs) ((vs)->length)
#define vStringSize(vs) ((vs)->size) #define vStringSize(vs) ((vs)->size)
#define vStringCat(vs,s) vStringCatS((vs), vStringValue((s))) #define vStringCat(vs,s) vStringCatS((vs), vStringValue((s)))
#define vStringNCat(vs,s,l) vStringNCatS((vs), vStringValue((s)), (l)) #define vStringNCat(vs,s,l) vStringNCatS((vs), vStringValue((s)), (l))
#define vStringCopy(vs,s) vStringCopyS((vs), vStringValue((s))) #define vStringCopy(vs,s) vStringCopyS((vs), vStringValue((s)))
#define vStringNCopy(vs,s,l) vStringNCopyS((vs), vStringValue((s)), (l)) #define vStringNCopy(vs,s,l) vStringNCopyS((vs), vStringValue((s)), (l))
#define vStringChar(vs,i) ((vs)->buffer[i]) #define vStringChar(vs,i) ((vs)->buffer[i])
#define vStringTerminate(vs) vStringPut(vs, '\0') #define vStringTerminate(vs) vStringPut(vs, '\0')
#define vStringLower(vs) toLowerString((vs)->buffer) #define vStringLower(vs) toLowerString((vs)->buffer)
#define vStringUpper(vs) toUpperString((vs)->buffer) #define vStringUpper(vs) toUpperString((vs)->buffer)
/* /*
* DATA DECLARATIONS * DATA DECLARATIONS
*/ */
typedef struct sVString { typedef struct sVString {
size_t length; /* size of buffer used */ size_t length; /* size of buffer used */
size_t size; /* allocated size of buffer */ size_t size; /* allocated size of buffer */
char * buffer; /* location of buffer */ char *buffer; /* location of buffer */
} vString; } vString;
/* /*
@ -81,6 +81,6 @@ extern void vStringTruncate (vString *const string, const size_t length);
extern vString *vStringNewOwn (char *s); extern vString *vStringNewOwn (char *s);
#endif /* _VSTRING_H */ #endif /* CTAGS_MAIN_VSTRING_H */
/* vi:set tabstop=4 shiftwidth=4: */ /* vi:set tabstop=4 shiftwidth=4: */