summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-11-24 20:50:59 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-11-24 20:50:59 +0000
commitd475e8040a76eb7776eb5ed8f3f3edc0f417f6c7 (patch)
treee377c6a035918a2ef81c2655946a11b27513e253 /src
parent1de5cce82d9fac333fba971bd5c19547c4d22abe (diff)
Removed tabs from files.
Added @version lines to various header files. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1170 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r--src/IO/IOMethods.c18
-rw-r--r--src/comm/CactusDefaultComm.c48
-rw-r--r--src/comm/Reduction.c14
-rw-r--r--src/include/CactusCommFunctions.h5
-rw-r--r--src/include/CactusIOFunctions.h5
-rw-r--r--src/include/CactusMainDefaults.h6
-rw-r--r--src/include/CactusMainFunctions.h3
-rw-r--r--src/include/CactusRegister.h5
-rw-r--r--src/include/CactusTimers.h6
-rw-r--r--src/include/OverloadMacros.h2
-rw-r--r--src/include/ParameterBindings.h7
-rw-r--r--src/include/RegisterKeyedFunction.h14
-rw-r--r--src/include/SKBinTree.h9
-rw-r--r--src/include/cctk.h8
-rw-r--r--src/include/cctk_GHExtensions.h10
-rw-r--r--src/include/cctk_Groups.h10
-rw-r--r--src/include/cctk_Misc.h10
-rw-r--r--src/include/cctk_ParameterFunctions.h2
-rw-r--r--src/include/cctk_Reduction.h22
-rw-r--r--src/include/cctk_WarnLevel.h9
-rw-r--r--src/include/cctki_schedule.h16
-rw-r--r--src/include/getopt.h39
-rw-r--r--src/include/gnu_regex.h102
-rw-r--r--src/include/rfrConstants.h22
-rw-r--r--src/main/ActiveThorns.c80
-rw-r--r--src/main/Banner.c4
-rw-r--r--src/main/CactusDefaultEvolve.c30
-rw-r--r--src/main/CactusDefaultShutdown.c19
-rw-r--r--src/main/CommandLine.c6
-rw-r--r--src/main/ConfigData.c4
-rw-r--r--src/main/Coord.c24
-rw-r--r--src/main/GHExtensions.c18
-rw-r--r--src/main/Groups.c116
-rw-r--r--src/main/Parameters.c88
-rw-r--r--src/main/ProcessCommandLine.c54
-rw-r--r--src/main/ProcessEnvironment.c18
-rw-r--r--src/main/ProcessParameterDatabase.c6
-rw-r--r--src/main/RecordImplementation.c38
-rw-r--r--src/main/WarnLevel.c20
-rw-r--r--src/schedule/Schedule.h8
-rw-r--r--src/schedule/ScheduleCreater.c92
-rw-r--r--src/schedule/ScheduleSorter.c28
-rw-r--r--src/util/BinaryTree.c20
-rw-r--r--src/util/BinaryTree.h10
-rw-r--r--src/util/CactusTimers.c16
-rw-r--r--src/util/File.c7
-rw-r--r--src/util/Misc.c78
-rw-r--r--src/util/ParseFile.c376
-rw-r--r--src/util/RegisterKeyedFunction.c6
-rw-r--r--src/util/SKBinTree.c26
-rw-r--r--src/util/StoreHandledData.c70
-rw-r--r--src/util/StoreKeyedData.c6
-rw-r--r--src/util/StoreNamedData.c6
-rw-r--r--src/util/getopt.c548
-rw-r--r--src/util/getopt1.c118
-rw-r--r--src/util/gnu_regex.c1558
56 files changed, 1952 insertions, 1938 deletions
diff --git a/src/IO/IOMethods.c b/src/IO/IOMethods.c
index 0c39257e..d592a1de 100644
--- a/src/IO/IOMethods.c
+++ b/src/IO/IOMethods.c
@@ -717,7 +717,7 @@ void FMODIFIER FORTRAN_NAME(CCTK_OutputVarByMethod)(int *ierr, cGH *GH, TWO_FORT
@returntype int
@returndesc
0 = Trigger says don't output me this iteration
- 1 = Trigger says output me this iteration
+ 1 = Trigger says output me this iteration
@endreturndesc
@version $Header$
@@ -738,7 +738,7 @@ int CCTKi_rfrTriggerSaysGo(cGH *GH, int variable)
/* Check if it is time to output this variable for this method*/
flag = method->TimeToOutput(GH, variable);
if (flag)
- return 1;
+ return 1;
}
else
{
@@ -761,9 +761,9 @@ int CCTKi_rfrTriggerSaysGo(cGH *GH, int variable)
@enddesc
@calls Util_GetHandledData
CCTK_FullName
- CCTK_VarName
+ CCTK_VarName
IOMethod->TimeToOutput
- IOMethod->OutputVarAs
+ IOMethod->OutputVarAs
@history
@endhistory
@@ -785,8 +785,8 @@ int CCTKi_rfrTriggerSaysGo(cGH *GH, int variable)
@returndesc
0 = This should never happen, since at least
one IO method should have been found by
- CCTKi_rfrTriggerSaysGo
- >0 = Number of IO methods called for output for
+ CCTKi_rfrTriggerSaysGo
+ >0 = Number of IO methods called for output for
this variable
@endreturndesc
@@ -817,9 +817,9 @@ int CCTKi_rfrTriggerAction(void *GH, int variable)
/* Check if it is time to output this variable for this method*/
if (method->TimeToOutput(GH, variable))
{
- /* And if so do call the output routine for the method */
- method->TriggerOutput(GH,variable);
- nmethods++;
+ /* And if so do call the output routine for the method */
+ method->TriggerOutput(GH,variable);
+ nmethods++;
}
}
else
diff --git a/src/comm/CactusDefaultComm.c b/src/comm/CactusDefaultComm.c
index f01e4af8..47eba601 100644
--- a/src/comm/CactusDefaultComm.c
+++ b/src/comm/CactusDefaultComm.c
@@ -27,19 +27,19 @@ extern char MPI_Active;
#ifdef MPI
#define CACTUS_MPI_ERROR(xf) do {int errcode; \
if((errcode = xf) != MPI_SUCCESS) \
- { \
- char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \
- int resultlen; \
- MPI_Error_string(errcode, mpi_error_string, &resultlen);\
- fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \
+ { \
+ char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \
+ int resultlen; \
+ MPI_Error_string(errcode, mpi_error_string, &resultlen);\
+ fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \
#xf, errcode, mpi_error_string); \
- fprintf(stderr, "At line %d of file %s\n", \
- __LINE__, __FILE__); \
- } \
- } while (0)
+ fprintf(stderr, "At line %d of file %s\n", \
+ __LINE__, __FILE__); \
+ } \
+ } while (0)
#endif
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/*@@
@@ -119,20 +119,20 @@ cGH *CactusDefaultSetupGH(tFleshConfig *config, int convergence_level)
{
for(variable = 0; variable < n_variables; variable++)
{
- ntimelevels = CCTK_NumTimeLevelsFromVarI(variable);
-
- thisGH->data[variable] = (void **)malloc(ntimelevels*sizeof(void *));
- if(thisGH->data[variable])
- {
- for(level = 0; level < ntimelevels; level++)
- {
- thisGH->data[variable][level] = NULL;
- }
- }
- else
- {
- break;
- }
+ ntimelevels = CCTK_NumTimeLevelsFromVarI(variable);
+
+ thisGH->data[variable] = (void **)malloc(ntimelevels*sizeof(void *));
+ if(thisGH->data[variable])
+ {
+ for(level = 0; level < ntimelevels; level++)
+ {
+ thisGH->data[variable][level] = NULL;
+ }
+ }
+ else
+ {
+ break;
+ }
}
}
diff --git a/src/comm/Reduction.c b/src/comm/Reduction.c
index 1256fcdb..af5ca2a3 100644
--- a/src/comm/Reduction.c
+++ b/src/comm/Reduction.c
@@ -651,7 +651,7 @@ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalScalar)(int *fortran_return,
@author Gerd Lanfermann
@desc
Interface to the migthy CCTK_Reduce for
- reduction of local 1D arrays.
+ reduction of local 1D arrays.
@enddesc
@calls
@calledby
@@ -663,12 +663,12 @@ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalScalar)(int *fortran_return,
int CCTK_ReduceLocalArray1D (cGH *GH, int proc, int operation_handle,
- void *in_array1d, void *out_array1d, int num_in_array1d,
- int data_type)
+ void *in_array1d, void *out_array1d, int num_in_array1d,
+ int data_type)
{
return (CCTK_ReduceArray (GH, proc, operation_handle,
- num_in_array1d, data_type, out_array1d,
- 1, 1, data_type, num_in_array1d, in_array1d));
+ num_in_array1d, data_type, out_array1d,
+ 1, 1, data_type, num_in_array1d, in_array1d));
}
void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalArray1D)(int *fortran_return,
@@ -677,12 +677,12 @@ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalArray1D)(int *fortran_return,
int *operation_handle,
void *in_array1d,
void *out_array1d,
- int *num_in_array1d,
+ int *num_in_array1d,
int *data_type)
{
*fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle,
*num_in_array1d, *data_type, out_array1d,
- 1, 1, *data_type, *num_in_array1d,
+ 1, 1, *data_type, *num_in_array1d,
in_array1d);
}
diff --git a/src/include/CactusCommFunctions.h b/src/include/CactusCommFunctions.h
index 3f4962ed..9d65a05b 100644
--- a/src/include/CactusCommFunctions.h
+++ b/src/include/CactusCommFunctions.h
@@ -5,9 +5,8 @@
@desc
Overloadable communication functions
@enddesc
+ @version $Header$
@@*/
-
-/* $Id$ */
#ifndef _CACTUSCOMMFUNCTIONS_H_
#define _CACTUSCOMMFUNCTIONS_H_
@@ -29,7 +28,7 @@ extern "C" {
#undef OVERLOADABLE
#ifdef __cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/CactusIOFunctions.h b/src/include/CactusIOFunctions.h
index a86fecd5..e9e131a7 100644
--- a/src/include/CactusIOFunctions.h
+++ b/src/include/CactusIOFunctions.h
@@ -5,9 +5,8 @@
@desc
Overloadable IO functions
@enddesc
+ @version $Header$
@@*/
-
-/* $Header$ */
#ifndef _CACTUSIOFUNCTIONS_H_
#define _CACTUSIOFUNCTIONS_H_
@@ -29,7 +28,7 @@ extern "C" {
#undef OVERLOADABLE
#ifdef __cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/CactusMainDefaults.h b/src/include/CactusMainDefaults.h
index 3cfb48ea..9668f28d 100644
--- a/src/include/CactusMainDefaults.h
+++ b/src/include/CactusMainDefaults.h
@@ -5,11 +5,9 @@
@desc
Prototypes for default functions.
@enddesc
+ @version $Header$
@@*/
-
-/* $Id$ */
-
#ifndef _CACTUSMAINDEFAULTS_H_
#define _CACTUSMAINDEFAULTS_H_
@@ -22,7 +20,7 @@ int CactusDefaultEvolve(tFleshConfig *);
int CactusDefaultShutdown(tFleshConfig *);
#ifdef __cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/CactusMainFunctions.h b/src/include/CactusMainFunctions.h
index 1fd4762c..431ff407 100644
--- a/src/include/CactusMainFunctions.h
+++ b/src/include/CactusMainFunctions.h
@@ -5,6 +5,7 @@
@desc
Main registerable functions.
@enddesc
+ @version $Header$
@@*/
#ifndef _CACTUSMAINFUNCTIONS_H_
@@ -25,7 +26,7 @@ extern "C" {
#undef OVERLOADABLE
#ifdef __cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/CactusRegister.h b/src/include/CactusRegister.h
index c5c0e27d..0bf5d05c 100644
--- a/src/include/CactusRegister.h
+++ b/src/include/CactusRegister.h
@@ -5,10 +5,9 @@
@desc
Functions used to register things in cactus.
@enddesc
+ @version $Header$
@@*/
-/* $Id$ */
-
#ifndef _CACTUS_REGISTRY_H_
#define _CACTUS_REGISTRY_H_
@@ -21,7 +20,7 @@ int RegisterMainFunction(int key, int (*func)(tFleshConfig *));
int SetupMainFunctions(void);
#ifdef __cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/CactusTimers.h b/src/include/CactusTimers.h
index b817222c..04172fa6 100644
--- a/src/include/CactusTimers.h
+++ b/src/include/CactusTimers.h
@@ -5,11 +5,9 @@
@desc
Timer stuff
@enddesc
+ @version $Header$
@@*/
-
-/* $Id$ */
-
#ifndef _CACTUSTIMERS_H_
#define _CACTUSTIMERS_H_
@@ -75,7 +73,7 @@ t_TimerInfo *CCTK_TimerCreateInfo(void);
void CCTK_TimerDestroyInfo(t_TimerInfo *info);
#ifdef __cplusplus
- }
+ }
#endif
#define INITIALISATION 0
diff --git a/src/include/OverloadMacros.h b/src/include/OverloadMacros.h
index 53b96a9a..eb2ba190 100644
--- a/src/include/OverloadMacros.h
+++ b/src/include/OverloadMacros.h
@@ -43,7 +43,7 @@ int CCTK_Overload##name(RETURN_TYPE (*func)(ARGUMENTS)) \
{ \
char *message = malloc( (200+strlen(#name))*sizeof(char) ); \
sprintf(message, \
- "Warning: Attempted to overload function %s twice\n",\
+ "Warning: Attempted to overload function %s twice\n",\
#name); \
CCTK_Warn(1,__LINE__,__FILE__,"Cactus",message); \
free(message); \
diff --git a/src/include/ParameterBindings.h b/src/include/ParameterBindings.h
index d1b590a8..c1b055df 100644
--- a/src/include/ParameterBindings.h
+++ b/src/include/ParameterBindings.h
@@ -5,6 +5,7 @@
@desc
Defines for parameter stuff
@enddesc
+ @version $Header$
@@*/
#ifndef _PARAMETERBINDINGS_H_
@@ -16,15 +17,15 @@ extern "C" {
#endif
int ParameterCreate(const char *name, /* The parameter name */
- const char *thorn, /* The thorn */
- const char *type, /* The parameter type */
+ const char *thorn, /* The thorn */
+ const char *type, /* The parameter type */
const char *scope, /* The scoping block */
int steerable, /* Is it steerable ? */
const char *description, /* The description */
const char *defval, /* The default value */
void *datapointer, /* The actual data */
int n_ranges, /* How many allowed ranges it has */
- ...);
+ ...);
int ParameterAddRange(const char *implementation,
const char *name,
diff --git a/src/include/RegisterKeyedFunction.h b/src/include/RegisterKeyedFunction.h
index 60fdbeac..5be1fdde 100644
--- a/src/include/RegisterKeyedFunction.h
+++ b/src/include/RegisterKeyedFunction.h
@@ -5,11 +5,9 @@
@desc
Header file for keyed function registration.
@enddesc
+ @version $Header$
@@*/
-/* $Id$ */
-
-
#ifndef _REGISTERKEYEDFUNCTION_H_
#define _REGISTERKEYEDFUNCTION_H_
@@ -21,13 +19,13 @@ extern "C" {
#endif
int RegisterKeyedFunction(void (*array[])(),
- int min, int max,
- int key, void (*func)());
+ int min, int max,
+ int key, void (*func)());
void (**(CreateKeyedFunctionArray(int size)))();
#ifdef __cplusplus
- }
+}
#endif
/*****************************************************/
@@ -35,8 +33,8 @@ void (**(CreateKeyedFunctionArray(int size)))();
/* Possible return codes. */
enum RegisterKeyedFunctionErrors {REG_KEYED_FUNCTION_SUCCESS,
- REG_KEYED_FUNCTION_ALREADY_ASSIGNED,
- REG_KEYED_FUNCTION_RANGE_ERROR};
+ REG_KEYED_FUNCTION_ALREADY_ASSIGNED,
+ REG_KEYED_FUNCTION_RANGE_ERROR};
/*****************************************************/
diff --git a/src/include/SKBinTree.h b/src/include/SKBinTree.h
index 2de16657..f4775e5a 100644
--- a/src/include/SKBinTree.h
+++ b/src/include/SKBinTree.h
@@ -5,6 +5,7 @@
@desc
Prototypes and data definitions for binary tree routines.
@enddesc
+ @version $Header$
@@*/
#ifndef _SKBINTREE_H_
@@ -26,9 +27,9 @@ extern "C" {
#endif
t_sktree *SKTreeStoreData(t_sktree *root,
- t_sktree *subtree,
- const char *key,
- void *data);
+ t_sktree *subtree,
+ const char *key,
+ void *data);
int SKTreeTraverseInorder(t_sktree *root, int (*process)(void *, void *), void *info);
@@ -43,7 +44,7 @@ t_sktree *SKTreeFindNode(t_sktree *root, const char *key);
t_sktree *SKTreeFindFirst(t_sktree *root);
#ifdef _cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/cctk.h b/src/include/cctk.h
index ea5008e2..77dd3099 100644
--- a/src/include/cctk.h
+++ b/src/include/cctk.h
@@ -5,7 +5,7 @@
@desc
Main include file for the CCTK. All thorns should include this...
@enddesc
- @version $Id$
+ @version $Header$
@@*/
#ifndef _CCTK_H_
@@ -43,7 +43,7 @@
INTEGER cctk_bbox(2*cctk_dim)&&\
CCTK_REAL cctk_delta_time, cctk_time&&\
CCTK_REAL cctk_delta_space(cctk_dim)&&\
- CCTK_REAL cctk_origin_space(cctk_dim)&&\
+ CCTK_REAL cctk_origin_space(cctk_dim)&&\
INTEGER cctk_levfac(cctk_dim)&&\
INTEGER cctk_convlevel&&\
INTEGER cctk_nghostzones(cctk_dim)&&\
@@ -137,7 +137,7 @@
(xGH)->cctk_bbox,\
&((xGH)->cctk_delta_time), \
&((xGH)->cctk_time), (xGH)->cctk_delta_space,\
- (xGH)->cctk_origin_space,\
+ (xGH)->cctk_origin_space,\
(xGH)->cctk_levfac,\
&((xGH)->cctk_convlevel),\
(xGH)->cctk_nghostzones,\
@@ -147,7 +147,7 @@
int *,\
int *,int *, int *, int *,int *,int *,\
CCTK_REAL *, CCTK_REAL *, CCTK_REAL *,\
- CCTK_REAL *,\
+ CCTK_REAL *,\
int *,\
int *,\
int *,\
diff --git a/src/include/cctk_GHExtensions.h b/src/include/cctk_GHExtensions.h
index 99569477..1fc0bfb9 100644
--- a/src/include/cctk_GHExtensions.h
+++ b/src/include/cctk_GHExtensions.h
@@ -3,9 +3,9 @@
@date Fri Jan 15 14:15:20 1999
@author Tom Goodale
@desc
-
+ Prototypes for functions dealing with GH extensions.
@enddesc
- @version $Id$
+ @version $Header$
@@*/
#ifndef _GHEXTENSIONS_H_
@@ -18,15 +18,15 @@ extern "C" {
int CCTK_RegisterGHExtension(const char *name);
int CCTK_RegisterGHExtensionSetupGH(int handle,
- void *(*func)(tFleshConfig *, int, cGH *));
+ void *(*func)(tFleshConfig *, int, cGH *));
int CCTK_RegisterGHExtensionInitGH(int handle, int (*func)(cGH *));
int CCTK_RegisterGHExtensionrfrTraverseGH(int handle, int (*func)(cGH *, int));
int CCTKi_SetupGHExtensions(tFleshConfig *config,
- int convergence_level,
- cGH *GH);
+ int convergence_level,
+ cGH *GH);
int CCTKi_InitGHExtensions(cGH *GH);
diff --git a/src/include/cctk_Groups.h b/src/include/cctk_Groups.h
index e726ae32..4e058da5 100644
--- a/src/include/cctk_Groups.h
+++ b/src/include/cctk_Groups.h
@@ -44,11 +44,11 @@ int CCTK_VarTypeNumber(const char *type);
int CCTK_GroupScopeNumber(const char *type);
int CCTK_GroupData(int group,
- int *gtype,
- int *vtype,
- int *dim,
- int *n_variables,
- int *n_timelevels);
+ int *gtype,
+ int *vtype,
+ int *dim,
+ int *n_variables,
+ int *n_timelevels);
char *CCTK_VarName(int varnum);
diff --git a/src/include/cctk_Misc.h b/src/include/cctk_Misc.h
index d6506dd6..b0b41771 100644
--- a/src/include/cctk_Misc.h
+++ b/src/include/cctk_Misc.h
@@ -5,7 +5,7 @@
@desc
header file for miscellaneous routines.
@enddesc
- @version $Id$
+ @version $Header$
@@*/
#ifndef _MISC_H_
@@ -29,16 +29,16 @@ int Util_IntInRangeList(int inval, int n_elements, ...);
int Util_DoubleInRangeList(double inval, int n_elements, ...);
int CCTK_SetDoubleInRangeList(CCTK_REAL *data, const char *value,
- int n_elements, ...);
+ int n_elements, ...);
int CCTK_SetIntInRangeList(CCTK_INT *data, const char *value,
- int n_elements, ...);
+ int n_elements, ...);
int CCTK_SetKeywordInRangeList(char **data, const char *value,
- int n_elements, ...);
+ int n_elements, ...);
int CCTK_SetString(char **data, const char *value);
int CCTK_SetBoolean(CCTK_INT *data, const char *value);
#ifdef __cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/cctk_ParameterFunctions.h b/src/include/cctk_ParameterFunctions.h
index 59f6f90d..6f25631c 100644
--- a/src/include/cctk_ParameterFunctions.h
+++ b/src/include/cctk_ParameterFunctions.h
@@ -58,7 +58,7 @@ typedef struct RANGE
struct RANGE *next;
char *range;
char *origin;
- int active;
+ int active;
char *description;
} t_range;
diff --git a/src/include/cctk_Reduction.h b/src/include/cctk_Reduction.h
index 7cb83153..63716314 100644
--- a/src/include/cctk_Reduction.h
+++ b/src/include/cctk_Reduction.h
@@ -5,11 +5,9 @@
@desc
Header file for using reduction operators
@enddesc
+ @version $Header$
@@*/
-/* $Id$ */
-
-
#ifndef _CCTK_REDUCTION_H_
#define _CCTK_REDUCTION_H_
@@ -18,7 +16,7 @@ extern "C" {
#endif
#define REDUCTION_OPERATOR_REGISTER_ARGLIST \
- cGH *, \
+ cGH *, \
int, \
int, \
int, \
@@ -39,12 +37,12 @@ extern "C" {
int outType
int CCTK_Reduce(cGH *GH,
- int proc,
- int operation_handle,
- int num_out_vals,
- int type_out_vals,
- void *out_vals,
- int num_in_fields, ...);
+ int proc,
+ int operation_handle,
+ int num_out_vals,
+ int type_out_vals,
+ void *out_vals,
+ int num_in_fields, ...);
int CCTK_ReductionHandle(const char *reduction);
@@ -63,7 +61,7 @@ int CCTK_ReduceLocalScalar (cGH *GH, int proc, int operation_handle,
int CCTK_ReduceLocalArray1D (cGH *GH, int proc, int operation_handle,
void *in_array1d, void *out_array1d,
- int num_in_array1d, int data_type);
+ int num_in_array1d, int data_type);
int CCTK_ReduceArray(cGH *GH,
@@ -78,7 +76,7 @@ int CCTK_ReduceArray(cGH *GH,
... );
#ifdef __cplusplus
- }
+}
#endif
#endif
diff --git a/src/include/cctk_WarnLevel.h b/src/include/cctk_WarnLevel.h
index 64f3c718..d4c1d58d 100644
--- a/src/include/cctk_WarnLevel.h
+++ b/src/include/cctk_WarnLevel.h
@@ -5,6 +5,7 @@
@desc
Header for the warning functions.
@enddesc
+ @version $Header$
@@*/
#ifndef _CCTK_WARNLEVEL_H_
@@ -15,10 +16,10 @@ extern "C" {
#endif
void CCTK_Warn(int level,
- int line,
- const char *file,
- const char *thorn,
- const char *message);
+ int line,
+ const char *file,
+ const char *thorn,
+ const char *message);
void CCTK_VWarn(int level,
int line,
const char *file,
diff --git a/src/include/cctki_schedule.h b/src/include/cctki_schedule.h
index 2310c852..b709807c 100644
--- a/src/include/cctki_schedule.h
+++ b/src/include/cctki_schedule.h
@@ -32,19 +32,19 @@ extern "C" {
/* Routines to create items */
t_sched_modifier *CCTKi_ScheduleAddModifier(t_sched_modifier *orig,
- const char *modifier,
- const char *argument);
+ const char *modifier,
+ const char *argument);
int CCTKi_ScheduleFunction(const char *gname,
- const char *fname,
- void *func,
- t_sched_modifier *modifiers,
- void *attributes);
+ const char *fname,
+ void *func,
+ t_sched_modifier *modifiers,
+ void *attributes);
int CCTKi_ScheduleGroup(const char *gname,
- const char *thisname,
+ const char *thisname,
t_sched_modifier *modifiers,
- void *attributes);
+ void *attributes);
/* Routine to sort the groups - must be called before traversal. */
int CCTKi_ScheduleSortAllGroups(void);
diff --git a/src/include/getopt.h b/src/include/getopt.h
index 59bc2443..67eb5d7e 100644
--- a/src/include/getopt.h
+++ b/src/include/getopt.h
@@ -1,3 +1,12 @@
+ /*@@
+ @header getopt.h
+ @date 1989
+ @author GNU
+ @desc
+ GNU getop stuff
+ @enddesc
+ @version $Header$
+ @@*/
/* Declarations for getopt.
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
@@ -20,7 +29,7 @@
#ifndef _GETOPT_H
#define _GETOPT_H 1
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
@@ -61,9 +70,9 @@ extern int optopt;
zero.
The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
+ no_argument (or 0) if the option does not take an argument,
+ required_argument (or 1) if the option requires an argument,
+ optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
@@ -78,7 +87,7 @@ extern int optopt;
struct option
{
-#if __STDC__
+#if __STDC__
const char *name;
#else
char *name;
@@ -92,9 +101,9 @@ struct option
/* Names for the values of the `has_arg' field of `struct option'. */
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
#if __STDC__
#if defined(__GNU_LIBRARY__)
@@ -106,16 +115,16 @@ extern int getopt (int argc, char *const *argv, const char *shortopts);
extern int getopt ();
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
+ const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
+ const char *shortopts,
+ const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
+ const char *shortopts,
+ const struct option *longopts, int *longind,
+ int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
@@ -124,7 +133,7 @@ extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* not __STDC__ */
-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif
diff --git a/src/include/gnu_regex.h b/src/include/gnu_regex.h
index f84716b9..f7707b9b 100644
--- a/src/include/gnu_regex.h
+++ b/src/include/gnu_regex.h
@@ -1,11 +1,11 @@
/*@@
@header gnu_regex.h
- @date Tue May 25 17:20:09 1999
- @author Tom Goodale
+ @date 1985
+ @author GNU
@desc
GNU regular expression library.
@enddesc
- @version $Id$
+ @version $Header$
@@*/
/* Definitions for data structures and routines for the regular
@@ -157,27 +157,27 @@ extern reg_syntax_t re_syntax_options;
/* [[[begin syntaxes]]] */
#define RE_SYNTAX_EMACS 0
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
+#define RE_SYNTAX_AWK \
+ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \
+ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_UNMATCHED_RIGHT_PAREN_ORD)
-#define RE_SYNTAX_POSIX_AWK \
+#define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
+#define RE_SYNTAX_GREP \
+ (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
+ | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
| RE_NEWLINE_ALT)
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
+#define RE_SYNTAX_EGREP \
+ (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
+ | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
| RE_NO_BK_VBAR)
-#define RE_SYNTAX_POSIX_EGREP \
+#define RE_SYNTAX_POSIX_EGREP \
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
@@ -186,32 +186,32 @@ extern reg_syntax_t re_syntax_options;
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
+#define _RE_SYNTAX_POSIX_COMMON \
+ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
-#define RE_SYNTAX_POSIX_BASIC \
+#define RE_SYNTAX_POSIX_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
+#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
+#define RE_SYNTAX_POSIX_EXTENDED \
+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
+ | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
| RE_UNMATCHED_RIGHT_PAREN_ORD)
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
+#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \
+ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* [[[end syntaxes]]] */
/* Maximum number of duplicates an interval can allow. Some systems
@@ -260,28 +260,28 @@ extern reg_syntax_t re_syntax_options;
`re_error_msg' table in regex.c. */
typedef enum
{
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
+ REG_NOERROR = 0, /* Success. */
+ REG_NOMATCH, /* Didn't find a match (for regexec). */
/* POSIX regcomp return error codes. (In the order listed in the
standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_ESUBREG, /* Invalid back reference. */
- REG_EBRACK, /* Unmatched left bracket. */
- REG_EPAREN, /* Parenthesis imbalance. */
- REG_EBRACE, /* Unmatched \{. */
- REG_BADBR, /* Invalid contents of \{\}. */
- REG_ERANGE, /* Invalid range end. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
+ REG_BADPAT, /* Invalid pattern. */
+ REG_ECOLLATE, /* Not implemented. */
+ REG_ECTYPE, /* Invalid character class name. */
+ REG_EESCAPE, /* Trailing backslash. */
+ REG_ESUBREG, /* Invalid back reference. */
+ REG_EBRACK, /* Unmatched left bracket. */
+ REG_EPAREN, /* Parenthesis imbalance. */
+ REG_EBRACE, /* Unmatched \{. */
+ REG_BADBR, /* Invalid contents of \{\}. */
+ REG_ERANGE, /* Invalid range end. */
+ REG_ESPACE, /* Ran out of memory. */
+ REG_BADRPT, /* No preceding re for repetition op. */
/* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
+ REG_EEND, /* Premature end. */
+ REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
+ REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
} reg_errcode_t;
/* This data structure represents a compiled pattern. Before calling
@@ -293,16 +293,16 @@ typedef enum
struct re_pattern_buffer
{
/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
+ /* Space that holds the compiled pattern. It is declared as
`unsigned char *' because its elements are
sometimes used as array indexes. */
unsigned char *buffer;
- /* Number of bytes to which `buffer' points. */
+ /* Number of bytes to which `buffer' points. */
unsigned long allocated;
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
+ /* Number of bytes actually used in `buffer'. */
+ unsigned long used;
/* Syntax setting with which the pattern was compiled. */
reg_syntax_t syntax;
@@ -318,7 +318,7 @@ struct re_pattern_buffer
when it is matched. */
char *translate;
- /* Number of subexpressions found by the compiler. */
+ /* Number of subexpressions found by the compiler. */
size_t re_nsub;
/* Zero if this pattern cannot match the empty string, one else.
diff --git a/src/include/rfrConstants.h b/src/include/rfrConstants.h
index fb407dbe..0a8eb8d4 100644
--- a/src/include/rfrConstants.h
+++ b/src/include/rfrConstants.h
@@ -5,9 +5,11 @@
@desc
@enddesc
+ @version $Header$
@@*/
-/* $Id$ */
+#ifndef _RFRCONSTANTS_H
+#define _RFRCONSTANTS_H
/* Be careful changing ordering. Look at tree in rfrInitialize before you do! */
#define CCTK_PARAMCHECK 0
@@ -46,17 +48,19 @@ extern "C"
#endif
int rfrInitTree(void **rfr_top,
- int (*StorageOn)(void *, int),
- int (*StorageOff)(void *, int),
- int (*CommunicationOn)(void *, int),
- int (*CommunicationOff)(void *, int),
- int (*Triggerable)(int),
- int (*TriggerSaysGo)(void *, int),
- int (*TriggerAction)(void *, int),
- int (*CallFunc)(void *, int, void *));
+ int (*StorageOn)(void *, int),
+ int (*StorageOff)(void *, int),
+ int (*CommunicationOn)(void *, int),
+ int (*CommunicationOff)(void *, int),
+ int (*Triggerable)(int),
+ int (*TriggerSaysGo)(void *, int),
+ int (*TriggerAction)(void *, int),
+ int (*CallFunc)(void *, int, void *));
void rfrPrintDescs(void *rfr_top, void *data, int when, char *tag, char *spacing);
#ifdef __cplusplus
}
#endif
+
+#endif /* _RFRCONSTANTS_H */
diff --git a/src/main/ActiveThorns.c b/src/main/ActiveThorns.c
index 4356a555..8ade276c 100644
--- a/src/main/ActiveThorns.c
+++ b/src/main/ActiveThorns.c
@@ -82,31 +82,31 @@ int CCTKi_RegisterThorn(const char *name, const char *imp)
if(thorn->implementation)
{
- /* Fill out data for the thorn. */
- strcpy(thorn->implementation, imp);
- thorn->active = 0;
+ /* Fill out data for the thorn. */
+ strcpy(thorn->implementation, imp);
+ thorn->active = 0;
- /* Store the data in the tree */
- temp = SKTreeStoreData(thornlist, thornlist, name, thorn);
+ /* Store the data in the tree */
+ temp = SKTreeStoreData(thornlist, thornlist, name, thorn);
- if(!thornlist) thornlist = temp;
+ if(!thornlist) thornlist = temp;
- if(temp)
- {
+ if(temp)
+ {
- /* Register the implementation */
- CCTK_RegisterImp(imp, name);
+ /* Register the implementation */
+ CCTK_RegisterImp(imp, name);
- retval = 0;
- }
- else
- {
- retval = -4;
- }
+ retval = 0;
+ }
+ else
+ {
+ retval = -4;
+ }
}
else
{
- retval = -3;
+ retval = -3;
}
}
else
@@ -168,11 +168,11 @@ static int CCTK_RegisterImp(const char *name, const char *thorn)
if(temp)
{
- retval = 0;
+ retval = 0;
}
else
{
- retval = -3;
+ retval = -3;
}
}
else
@@ -234,27 +234,27 @@ int CCTKi_ActivateThorn(const char *name)
if(!thorn->active)
{
- if(!imp->active)
- {
- /* Activate the thorn. */
- printf("Success -> active implementation %s\n", thorn->implementation);
- thorn->active = 1;
- imp->active = 1;
- /* Remember which thorn activated this imp. */
- imp->activating_thorn = (char *)malloc(sizeof(char)*(strlen(name)+1));
- strcpy(imp->activating_thorn, name);
- retval = 0;
- }
- else
- {
- printf("Failure -> Implementation %s already activated by %s\n", thorn->implementation, imp->activating_thorn);
- retval = -4;
- }
+ if(!imp->active)
+ {
+ /* Activate the thorn. */
+ printf("Success -> active implementation %s\n", thorn->implementation);
+ thorn->active = 1;
+ imp->active = 1;
+ /* Remember which thorn activated this imp. */
+ imp->activating_thorn = (char *)malloc(sizeof(char)*(strlen(name)+1));
+ strcpy(imp->activating_thorn, name);
+ retval = 0;
+ }
+ else
+ {
+ printf("Failure -> Implementation %s already activated by %s\n", thorn->implementation, imp->activating_thorn);
+ retval = -4;
+ }
}
else
{
- printf("Failure -> Thorn %s already active\n", name);
- retval = -3;
+ printf("Failure -> Thorn %s already active\n", name);
+ retval = -3;
}
}
else
@@ -667,7 +667,7 @@ int CCTK_ImplementationThornList (const char *imp, char ***list, int *n_items)
int retval;
t_sktree *node;
t_sktree *thornlist;
- int alloc_size = 0;
+ int alloc_size = 0;
/* FIXME */
#define _MY_THORN_JUNK_SIZE 10
@@ -679,13 +679,13 @@ int CCTK_ImplementationThornList (const char *imp, char ***list, int *n_items)
thornlist = (t_sktree*) CCTK_ImpThornList (imp);
- /* got thornlist? */
+ /* got thornlist? */
if (thornlist)
{
/* then we can start allocatin list */
alloc_size += _MY_THORN_JUNK_SIZE;
*list = (char **) malloc (alloc_size * sizeof (char *));
-
+
/* success? */
if (! (*list))
{
diff --git a/src/main/Banner.c b/src/main/Banner.c
index 5e4261d5..a4fc99ef 100644
--- a/src/main/Banner.c
+++ b/src/main/Banner.c
@@ -160,8 +160,8 @@ void CCTK_PrintBanners(void)
{
if (banner_strings[i])
{
- printf("--------------------------------------------------------------------------------\n");
- printf("%s\n",banner_strings[i]);
+ printf("--------------------------------------------------------------------------------\n");
+ printf("%s\n",banner_strings[i]);
}
}
printf("--------------------------------------------------------------------------------\n");
diff --git a/src/main/CactusDefaultEvolve.c b/src/main/CactusDefaultEvolve.c
index ef1751e9..34bde167 100644
--- a/src/main/CactusDefaultEvolve.c
+++ b/src/main/CactusDefaultEvolve.c
@@ -19,23 +19,23 @@
#include "CactusIOFunctions.h"
-static char *rcsid="$Id$";
+static char *rcsid="$Header$";
/* Define some macros for convenience. */
#define ForallConvLevels(iteration, conv_level) { \
int factor = 1; \
- for(conv_level = 0 ; \
- conv_level < config->nGHs; \
- conv_level++) \
- { \
- if(iteration%factor == 0) \
- {
+ for(conv_level = 0 ; \
+ conv_level < config->nGHs; \
+ conv_level++) \
+ { \
+ if(iteration%factor == 0) \
+ {
#define EndForallConvLevels \
- }; \
- factor *=2; \
- }; \
+ }; \
+ factor *=2; \
+ }; \
}
/* Quick stuff for testing purposes. */
@@ -150,7 +150,7 @@ int CactusDefaultEvolve(tFleshConfig *config)
CCTK_PRINTSEPARATOR
printf("In CactusDefaultEvolve\n----------------------\n");
printf(" Advancing iteration %d = %d + 1\n",iteration+1,
- iteration);
+ iteration);
CCTK_PRINTSEPARATOR
#endif
@@ -186,7 +186,7 @@ int CactusDefaultEvolve(tFleshConfig *config)
ForallConvLevels(iteration, convergence_level)
{
CCTK_rfrTraverse(config->GH[convergence_level],CCTK_ANALYSIS);
- CCTK_OutputGH(config->GH[convergence_level]);
+ CCTK_OutputGH(config->GH[convergence_level]);
}
EndForallConvLevels;
@@ -247,7 +247,7 @@ int CCTK_StepGH(cGH *GH)
CCTK_PRINTSEPARATOR
printf("In CCTK_StepGH\n--------------\n");
printf(" Advancing GH->iteration to %lu = %lu + 1\n",(GH->cctk_iteration+1),
- GH->cctk_iteration);
+ GH->cctk_iteration);
CCTK_PRINTSEPARATOR
#endif
@@ -262,7 +262,7 @@ int CCTK_StepGH(cGH *GH)
CCTK_PRINTSEPARATOR
printf("In CCTK_StepGH\n--------------\n");
printf(" Advancing GH->cctk_time %f = %f + %f\n",GH->cctk_time+GH->cctk_delta_time,
- GH->cctk_time,GH->cctk_delta_time);
+ GH->cctk_time,GH->cctk_delta_time);
CCTK_PRINTSEPARATOR
#endif
@@ -389,7 +389,7 @@ void TerminationStepper(cGH *GH) {
#ifdef MPI
MPI_Allreduce(&cactus_terminate,&cactus_terminate_global,1,
- MPI_INT,MPI_LOR,GH->PUGH_COMM_WORLD);
+ MPI_INT,MPI_LOR,GH->PUGH_COMM_WORLD);
#endif
#endif
if (cactus_terminate_global) {
diff --git a/src/main/CactusDefaultShutdown.c b/src/main/CactusDefaultShutdown.c
index 123582b1..f09206ad 100644
--- a/src/main/CactusDefaultShutdown.c
+++ b/src/main/CactusDefaultShutdown.c
@@ -19,6 +19,7 @@
#include "mpi.h"
#endif
+static char *rcsid = "$Header$";
#ifdef MPI
extern char MPI_Active;
@@ -27,16 +28,16 @@ extern char MPI_Active;
#ifdef MPI
#define CACTUS_MPI_ERROR(xf) do {int errcode; \
if((errcode = xf) != MPI_SUCCESS) \
- { \
- char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \
- int resultlen; \
- MPI_Error_string(errcode, mpi_error_string, &resultlen);\
- fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \
+ { \
+ char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \
+ int resultlen; \
+ MPI_Error_string(errcode, mpi_error_string, &resultlen);\
+ fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \
#xf, errcode, mpi_error_string); \
- fprintf(stderr, "At line %d of file %s\n", \
- __LINE__, __FILE__); \
- } \
- } while (0)
+ fprintf(stderr, "At line %d of file %s\n", \
+ __LINE__, __FILE__); \
+ } \
+ } while (0)
#endif
/*@@
diff --git a/src/main/CommandLine.c b/src/main/CommandLine.c
index bf93f163..b761ce76 100644
--- a/src/main/CommandLine.c
+++ b/src/main/CommandLine.c
@@ -280,7 +280,7 @@ void CCTKi_CommandLineVersion(void)
version = (const char *)CCTK_FullVersion();
printf("%s: Version %s. Compiled on %s at %s\n", argv[0], version,
- compileDate(), compileTime());
+ compileDate(), compileTime());
exit(1);
}
@@ -315,8 +315,8 @@ void CCTKi_CommandLineHelp(void)
printf("-O, -describe-all-parameters : describes all the parameters.\n");
printf("-o, -describe-parameter <paramname> : describe the given parameter.\n");
printf("-x, -test-parameters [nprocs] : does a quick test of the parameter file\n"
- " pretending to be on nprocs processors, \n"
- " or 1 if not given.\n");
+ " pretending to be on nprocs processors, \n"
+ " or 1 if not given.\n");
printf("-W, -warning-level <n> : Sets the warning level to n.\n");
printf("-E, -error-level <n> : Sets the error level to n.\n");
printf("-r, -redirect-stdout : Redirects standard output to files.\n");
diff --git a/src/main/ConfigData.c b/src/main/ConfigData.c
index f3d495bd..b919ad31 100644
--- a/src/main/ConfigData.c
+++ b/src/main/ConfigData.c
@@ -12,7 +12,7 @@
#include "cctk_Flesh.h"
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/*@@
@routine CCTKi_AddGH
@@ -47,7 +47,7 @@ int CCTKi_AddGH(tFleshConfig *config, int convergence_level, cGH *GH)
config->GH = temp;
for(i=config->nGHs; i<convergence_level+1;i++)
{
- config->GH[i] = NULL;
+ config->GH[i] = NULL;
}
config->nGHs=convergence_level+1;
}
diff --git a/src/main/Coord.c b/src/main/Coord.c
index bc29f0bf..cbac174a 100644
--- a/src/main/Coord.c
+++ b/src/main/Coord.c
@@ -36,7 +36,7 @@ typedef struct COORD_RANGE
cGH *GH;
- struct Coordprops *props; /* Coordinate data */
+ struct Coordprops *props; /* Coordinate data */
CCTK_REAL lower; /* Lower range */
CCTK_REAL upper; /* Upper range */
@@ -58,7 +58,7 @@ int CCTKi_CoordHande(const char *name);
@author Gabrielle Allen
@desc
Register a GF as a coordinate with a name, and index
- and a direction
+ and a direction
@enddesc
@calls Util_GetHandle, Util_NewHandle, CCTK_Warn
@@ -200,7 +200,7 @@ void FMODIFIER FORTRAN_NAME(CCTK_RegisterCoordI)(int *handle, int *dir, int *ind
@@*/
int CCTK_RegisterCoord(int dir, const char *gfname,
- const char *coordname)
+ const char *coordname)
{
int retval;
@@ -233,7 +233,7 @@ void FMODIFIER FORTRAN_NAME(CCTK_RegisterCoord)(int *handle, int *dir, TWO_FORTS
int CCTK_RegisterCoordRange(cGH *GH, CCTK_REAL min, CCTK_REAL max,
- const char *coordname)
+ const char *coordname)
{
coord_range *newguy;
@@ -276,7 +276,7 @@ int CCTKi_CoordHandle(const char *name)
if (coord)
{
if (CCTK_Equals(name,(const char *)coord->name))
- return handle;
+ return handle;
}
else
{
@@ -302,7 +302,7 @@ struct Coordprops *CCTKi_CoordData(const char *name)
if (coord)
{
if (CCTK_Equals(name,(const char *)coord->name))
- return coord;
+ return coord;
}
else
{
@@ -328,7 +328,7 @@ int CCTK_CoordIndex(const char *name)
if (coord)
{
if (CCTK_Equals(name,(const char *)coord->name))
- return coord->index;
+ return coord->index;
}
else
{
@@ -362,7 +362,7 @@ CCTK_REAL CCTK_CoordOrigin(const char *name)
if (coord)
{
if (CCTK_Equals(name,(const char *)coord->name))
- return coord->origin;
+ return coord->origin;
}
else
{
@@ -408,10 +408,10 @@ int CCTK_CoordRange(cGH *GH, CCTK_REAL *lower, CCTK_REAL *upper, const char *nam
void FMODIFIER FORTRAN_NAME(CCTK_CoordRange)(int *ierr,
- cGH *GH,
- CCTK_REAL *lower,
- CCTK_REAL *upper,
- ONE_FORTSTRING_ARG)
+ cGH *GH,
+ CCTK_REAL *lower,
+ CCTK_REAL *upper,
+ ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE(name)
*ierr = CCTK_CoordRange (GH,lower,upper,name);
diff --git a/src/main/GHExtensions.c b/src/main/GHExtensions.c
index c61679eb..87a1c737 100644
--- a/src/main/GHExtensions.c
+++ b/src/main/GHExtensions.c
@@ -19,7 +19,7 @@
#include "StoreHandledData.h"
#include "cctk_WarnLevel.h"
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/* Local data holding info on extensions..*/
@@ -146,7 +146,7 @@ int CCTK_RegisterGHExtension(const char *name)
@@*/
int CCTK_RegisterGHExtensionSetupGH(int handle,
- void *(*func)(tFleshConfig *, int, cGH *))
+ void *(*func)(tFleshConfig *, int, cGH *))
{
int return_code;
struct GHExtension *extension;
@@ -259,8 +259,8 @@ int CCTK_RegisterGHExtensionrfrTraverseGH(int handle, int (*func)(cGH *, int))
@@*/
int CCTKi_SetupGHExtensions(tFleshConfig *config,
- int convergence_level,
- cGH *GH)
+ int convergence_level,
+ cGH *GH)
{
int return_code;
int handle;
@@ -275,11 +275,11 @@ int CCTKi_SetupGHExtensions(tFleshConfig *config,
{
for(handle = 0; handle < num_extensions; handle++)
{
- /* Call the SetupGH routines for each extension. */
- extension = (struct GHExtension *)Util_GetHandledData(GHExtensions, handle);
- GH->extensions[handle] = extension->SetupGH(config,
- convergence_level,
- GH);
+ /* Call the SetupGH routines for each extension. */
+ extension = (struct GHExtension *)Util_GetHandledData(GHExtensions, handle);
+ GH->extensions[handle] = extension->SetupGH(config,
+ convergence_level,
+ GH);
}
return_code = 0;
}
diff --git a/src/main/Groups.c b/src/main/Groups.c
index f5e02efb..551f026f 100644
--- a/src/main/Groups.c
+++ b/src/main/Groups.c
@@ -60,8 +60,8 @@ typedef struct
int stagger;
- /* size[dim] */
- CCTK_INT *size;
+ /* *size[dim] - pointers to parameter data*/
+ CCTK_INT **size;
/* variables[n_variables] */
cVariableDefinition *variables;
@@ -137,7 +137,7 @@ int CCTK_GroupIndex(const char *fullgroupname)
for(group_num = 0; group_num < n_groups; group_num++)
{
if(CCTK_Equals(imp2, groups[group_num].implementation) &&
- CCTK_Equals(group2, groups[group_num].name)) break;
+ CCTK_Equals(group2, groups[group_num].name)) break;
}
if (group_num < n_groups)
@@ -245,9 +245,9 @@ int CCTKi_CreateGroup(const char *gname, const char *thorn, const char *imp,
sprintf(fullname,"%s::%s",imp,gname);
printf("Created implementation group %s\n",fullname);
printf(" CCTK_GroupIndex(%s) = %d\n",fullname,
- CCTK_GroupIndex(fullname));
+ CCTK_GroupIndex(fullname));
printf(" CCTK_GroupName(%d) = %s\n",CCTK_GroupIndex(fullname),
- CCTK_GroupName(CCTK_GroupIndex(fullname)));
+ CCTK_GroupName(CCTK_GroupIndex(fullname)));
free(fullname);
}
#endif
@@ -263,9 +263,9 @@ int CCTKi_CreateGroup(const char *gname, const char *thorn, const char *imp,
sprintf(fullname,"%s::%s",thorn,gname);
printf("Created thorn group %s\n",fullname);
printf(" CCTK_GroupIndex(%s) = %d\n",fullname,
- CCTK_GroupIndex(fullname));
+ CCTK_GroupIndex(fullname));
printf(" CCTK_GroupName(%d) = %s\n",CCTK_GroupIndex(fullname),
- CCTK_GroupName(CCTK_GroupIndex(fullname)));
+ CCTK_GroupName(CCTK_GroupIndex(fullname)));
free(fullname);
}
#endif
@@ -297,11 +297,11 @@ int CCTKi_CreateGroup(const char *gname, const char *thorn, const char *imp,
if(group->variables[variable].name)
{
- strcpy(group->variables[variable].name, variable_name);
+ strcpy(group->variables[variable].name, variable_name);
}
else
{
- break;
+ break;
}
}
@@ -357,7 +357,7 @@ static cGroupDefinition *CCTKi_SetupGroup(const char *implementation,
const char *fullname2;
fullname1 = (char *) malloc( (strlen(implementation)+strlen(name)+2)
- *sizeof(const char *));
+ *sizeof(const char *));
sprintf(fullname1,"%s::%s",implementation,name);
fullname2 = (const char *)fullname1;
@@ -380,43 +380,43 @@ static cGroupDefinition *CCTKi_SetupGroup(const char *implementation,
temp_int = (int *)realloc(group_of_variable, (total_variables+n_variables)*sizeof(int));
if(groups[n_groups].implementation &&
- groups[n_groups].name &&
- groups[n_groups].variables &&
- temp_int)
+ groups[n_groups].name &&
+ groups[n_groups].variables &&
+ temp_int)
{
- /* Fill in the data structures. */
- group_of_variable = temp_int;
-
- strcpy(groups[n_groups].implementation, implementation);
- strcpy(groups[n_groups].name, name);
-
- groups[n_groups].number = n_groups;
-
- groups[n_groups].n_variables = n_variables;
-
- /* Fill in global variable numbers. */
- for(variable = 0; variable < n_variables; variable++)
- {
- groups[n_groups].variables[variable].number = total_variables;
-
- group_of_variable[total_variables] = n_groups;
-
- total_variables++;
- }
-
- n_groups++;
+ /* Fill in the data structures. */
+ group_of_variable = temp_int;
+
+ strcpy(groups[n_groups].implementation, implementation);
+ strcpy(groups[n_groups].name, name);
+
+ groups[n_groups].number = n_groups;
+
+ groups[n_groups].n_variables = n_variables;
+
+ /* Fill in global variable numbers. */
+ for(variable = 0; variable < n_variables; variable++)
+ {
+ groups[n_groups].variables[variable].number = total_variables;
+
+ group_of_variable[total_variables] = n_groups;
+
+ total_variables++;
+ }
+
+ n_groups++;
}
else
{
- /* Memory allocation failed, so free any which may have been allocated. */
- free(groups[n_groups].implementation);
- groups[n_groups].implementation = NULL;
+ /* Memory allocation failed, so free any which may have been allocated. */
+ free(groups[n_groups].implementation);
+ groups[n_groups].implementation = NULL;
- free(groups[n_groups].name);
- groups[n_groups].name = NULL;
+ free(groups[n_groups].name);
+ groups[n_groups].name = NULL;
- free(groups[n_groups].variables);
- groups[n_groups].variables = NULL;
+ free(groups[n_groups].variables);
+ groups[n_groups].variables = NULL;
}
}
@@ -487,16 +487,16 @@ int CCTK_VarIndex(const char *variable_name)
varname = realvarname;
for (gnum = 0; gnum < n_groups; gnum++)
- {
+ {
for(variable=0; variable<groups[gnum].n_variables;variable++)
{
- if(CCTK_Equals(varname, groups[gnum].variables[variable].name)
- && CCTK_Equals(impname,groups[gnum].implementation))
- {
- retval = groups[gnum].variables[variable].number;
- break;
- }
+ if(CCTK_Equals(varname, groups[gnum].variables[variable].name)
+ && CCTK_Equals(impname,groups[gnum].implementation))
+ {
+ retval = groups[gnum].variables[variable].number;
+ break;
+ }
}
}
@@ -505,7 +505,7 @@ int CCTK_VarIndex(const char *variable_name)
{
message = (char *)malloc( (100+strlen(variable_name))*sizeof(char) );
sprintf(message,"Full name %s in wrong format in CCTK_VarNum",
- variable_name);
+ variable_name);
CCTK_WARN(2,message);
if (message) free(message);
retval = -3;
@@ -645,10 +645,10 @@ char *CCTK_GroupNameFromVarI(int var)
{
group_num = group_of_variable[var];
retval = (char *)malloc( ( strlen(groups[group_num].name)
- + strlen(groups[group_num].implementation) + 3)
- * sizeof(char) );
+ + strlen(groups[group_num].implementation) + 3)
+ * sizeof(char) );
sprintf(retval,"%s::%s",groups[group_num].implementation,
- groups[group_num].name);
+ groups[group_num].name);
}
return retval;
@@ -950,11 +950,11 @@ void FMODIFIER FORTRAN_NAME(CCTK_GroupScopeNumber)(int *number,ONE_FORTSTRING_A
@@*/
int CCTK_GroupData(int group,
- int *gtype,
- int *vtype,
- int *dim,
- int *n_variables,
- int *n_timelevels)
+ int *gtype,
+ int *vtype,
+ int *dim,
+ int *n_variables,
+ int *n_timelevels)
{
int return_code;
@@ -1058,7 +1058,7 @@ char *CCTK_GroupName(int group)
else
{
name = (char *)malloc((strlen(groups[group].implementation)
- +strlen(groups[group].name)+3)*sizeof(char));
+ +strlen(groups[group].name)+3)*sizeof(char));
if (name)
{
sprintf(name, "%s::%s",groups[group].implementation, groups[group].name);
diff --git a/src/main/Parameters.c b/src/main/Parameters.c
index f13d0531..6a3c6698 100644
--- a/src/main/Parameters.c
+++ b/src/main/Parameters.c
@@ -42,8 +42,8 @@ int STR_cmpi(const char *string1, const char *string2);
*/
typedef struct PARAM
{
- t_param_prop* props;
- void* data;
+ t_param_prop* props;
+ void* data;
} t_param;
@@ -54,9 +54,9 @@ typedef struct PARAM
*/
typedef struct PARAMLIST
{
- t_param* param;
- struct PARAMLIST* last;
- struct PARAMLIST* next;
+ t_param* param;
+ struct PARAMLIST* last;
+ struct PARAMLIST* next;
} t_paramlist;
@@ -67,7 +67,7 @@ typedef struct PARAMLIST
*/
typedef struct PARAMTREENODE
{
- t_paramlist* paramlist;
+ t_paramlist* paramlist;
} t_paramtreenode;
@@ -76,52 +76,52 @@ static t_param *ParameterFind(const char *name,
int scope);
static t_param *ParameterNew(const char *thorn,
- const char *name,
- const char *type,
- const char *scope,
- int steerable,
- const char *description,
- const char *defval,
- void *data);
-
-static int ParameterCheck (const char *thorn,
- const char *name,
- const char *type,
- const char *scope,
- int steerable,
- const char *description,
- const char *defval,
- void *data);
-
-static void *ParameterGetSimple (t_param *param,
- int *type);
-
-static int ParameterSetSimple (t_param *param, const char *value);
+ const char *name,
+ const char *type,
+ const char *scope,
+ int steerable,
+ const char *description,
+ const char *defval,
+ void *data);
+
+static int ParameterCheck (const char *thorn,
+ const char *name,
+ const char *type,
+ const char *scope,
+ int steerable,
+ const char *description,
+ const char *defval,
+ void *data);
+
+static void *ParameterGetSimple (t_param *param,
+ int *type);
+
+static int ParameterSetSimple (t_param *param, const char *value);
static t_paramtreenode *ParameterPTreeNodeFind(t_sktree *tree,
- const char *name);
+ const char *name);
static t_sktree *ParameterPTreeNodeAdd(t_sktree **tree,
- const char *name,
- t_paramtreenode *new_node);
+ const char *name,
+ t_paramtreenode *new_node);
-static int ParameterGetScope (const char *scope);
-static int ParameterGetType (const char *type);
+static int ParameterGetScope (const char *scope);
+static int ParameterGetType (const char *type);
-static int ParameterInsert (t_sktree **tree,
- t_param *newparam);
+static int ParameterInsert (t_sktree **tree,
+ t_param *newparam);
-static int ParameterPrintSimple (t_param *param,
- const char *format,
- FILE *file);
+static int ParameterPrintSimple (t_param *param,
+ const char *format,
+ FILE *file);
-static int ParameterExtend (t_param *param,
- const char *range_origin,
- const char *range,
- const char *range_description);
+static int ParameterExtend (t_param *param,
+ const char *range_origin,
+ const char *range,
+ const char *range_description);
static int ParameterListAddParam(t_paramlist **paramlist,
- t_param *newparam);
+ t_param *newparam);
static int ParameterSetKeyword (t_param *param, const char *value);
@@ -1559,8 +1559,8 @@ static int ParameterSetReal(t_param *param, const char *value)
for (p=0;p<strlen(temp);p++)
{
if (temp[p] == 'E' ||
- temp[p] == 'd' ||
- temp[p] == 'D')
+ temp[p] == 'd' ||
+ temp[p] == 'D')
{
temp[p] = 'e';
break;
diff --git a/src/main/ProcessCommandLine.c b/src/main/ProcessCommandLine.c
index 05f2f9f5..347302f9 100644
--- a/src/main/ProcessCommandLine.c
+++ b/src/main/ProcessCommandLine.c
@@ -53,40 +53,40 @@ int ProcessCommandLine(int *inargc, char ***inargv, tFleshConfig *ConfigData)
{
struct option long_options[] =
{
- {"help", no_argument, NULL, 'h'},
- {"describe-all-parameters", optional_argument, NULL, 'O'},
- {"describe-parameter", required_argument, NULL, 'o'},
- {"test-parameters", optional_argument, NULL, 'x'},
- {"warning-level", required_argument, NULL, 'W'},
- {"error-level", required_argument, NULL, 'E'},
- {"redirect-stdout", no_argument, NULL, 'r'},
- {"list-thorns", no_argument, NULL, 'T'},
- {"test-thorn-compiled", required_argument, NULL, 't'},
- {"version", no_argument, NULL, 'v'},
- {0, 0, 0, 0}
+ {"help", no_argument, NULL, 'h'},
+ {"describe-all-parameters", optional_argument, NULL, 'O'},
+ {"describe-parameter", required_argument, NULL, 'o'},
+ {"test-parameters", optional_argument, NULL, 'x'},
+ {"warning-level", required_argument, NULL, 'W'},
+ {"error-level", required_argument, NULL, 'E'},
+ {"redirect-stdout", no_argument, NULL, 'r'},
+ {"list-thorns", no_argument, NULL, 'T'},
+ {"test-thorn-compiled", required_argument, NULL, 't'},
+ {"version", no_argument, NULL, 'v'},
+ {0, 0, 0, 0}
};
c = getopt_long_only (argc, argv, "hO::o:x::W:E:rTt:v",
- long_options, &option_index);
+ long_options, &option_index);
if (c == -1)
- break;
+ break;
switch (c)
{
- case 't': CCTKi_CommandLineTestThornCompiled(optarg); break;
- case 'O': CCTKi_CommandLineDescribeAllParameters(optarg); break;
- case 'o': CCTKi_CommandLineDescribeParameter(optarg); break;
- case 'x': CCTKi_CommandLineTestParameters(optarg); break;
- case 'W': CCTKi_CommandLineWarningLevel(optarg); break;
- case 'E': CCTKi_CommandLineErrorLevel(optarg); break;
- case 'r': CCTKi_CommandLineRedirectStdout(); break;
- case 'T': CCTKi_CommandLineListThorns(); break;
- case 'v': CCTKi_CommandLineVersion(); break;
- case 'h':
- case '?':
- CCTKi_CommandLineHelp(); break;
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
+ case 't': CCTKi_CommandLineTestThornCompiled(optarg); break;
+ case 'O': CCTKi_CommandLineDescribeAllParameters(optarg); break;
+ case 'o': CCTKi_CommandLineDescribeParameter(optarg); break;
+ case 'x': CCTKi_CommandLineTestParameters(optarg); break;
+ case 'W': CCTKi_CommandLineWarningLevel(optarg); break;
+ case 'E': CCTKi_CommandLineErrorLevel(optarg); break;
+ case 'r': CCTKi_CommandLineRedirectStdout(); break;
+ case 'T': CCTKi_CommandLineListThorns(); break;
+ case 'v': CCTKi_CommandLineVersion(); break;
+ case 'h':
+ case '?':
+ CCTKi_CommandLineHelp(); break;
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
}
}
diff --git a/src/main/ProcessEnvironment.c b/src/main/ProcessEnvironment.c
index 3da36cef..0b040b1b 100644
--- a/src/main/ProcessEnvironment.c
+++ b/src/main/ProcessEnvironment.c
@@ -19,16 +19,16 @@
#ifdef MPI
#define CACTUS_MPI_ERROR(xf) do {int errcode; \
if((errcode = xf) != MPI_SUCCESS) \
- { \
- char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \
- int resultlen; \
- MPI_Error_string(errcode, mpi_error_string, &resultlen);\
- fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \
+ { \
+ char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \
+ int resultlen; \
+ MPI_Error_string(errcode, mpi_error_string, &resultlen);\
+ fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \
#xf, errcode, mpi_error_string); \
- fprintf(stderr, "At line %d of file %s\n", \
- __LINE__, __FILE__); \
- } \
- } while (0)
+ fprintf(stderr, "At line %d of file %s\n", \
+ __LINE__, __FILE__); \
+ } \
+ } while (0)
#endif
#include "cctk_Flesh.h"
diff --git a/src/main/ProcessParameterDatabase.c b/src/main/ProcessParameterDatabase.c
index 42327f6b..c75ee5f6 100644
--- a/src/main/ProcessParameterDatabase.c
+++ b/src/main/ProcessParameterDatabase.c
@@ -13,10 +13,10 @@
#include "ParameterData.h"
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
int ParseFile(FILE *ifp,
- int (*set_function)(const char *, const char *));
+ int (*set_function)(const char *, const char *));
/*@@
@@ -47,7 +47,7 @@ int ProcessParameterDatabase(tFleshConfig *ConfigData)
else
{
fprintf(stderr, "Unable to open parameter file '%s'\n",
- ConfigData->parameter_file_name);
+ ConfigData->parameter_file_name);
retval = 1;
}
diff --git a/src/main/RecordImplementation.c b/src/main/RecordImplementation.c
index 1acf1d3a..b5bdf9f1 100644
--- a/src/main/RecordImplementation.c
+++ b/src/main/RecordImplementation.c
@@ -13,6 +13,8 @@
#include "StoreNamedData.h"
+static char *rcsid = "$Header$";
+
typedef struct
{
int n_thorns;
@@ -37,7 +39,7 @@ static pNamedData *implementation_data = NULL;
@@*/
int CCTK_RecordImplementation(const char *implementation,
- const char *thorn)
+ const char *thorn)
{
int retval;
char **temp;
@@ -54,12 +56,12 @@ int CCTK_RecordImplementation(const char *implementation,
data->thornlist[data->n_thorns-1] = (char *)malloc((strlen(thorn)+1)*sizeof(char));
if(data->thornlist[data->n_thorns-1])
{
- strcpy(data->thornlist[data->n_thorns-1], thorn);
- retval = 0;
+ strcpy(data->thornlist[data->n_thorns-1], thorn);
+ retval = 0;
}
else
{
- retval = 4;
+ retval = 4;
}
}
else
@@ -77,23 +79,23 @@ int CCTK_RecordImplementation(const char *implementation,
data->thornlist = (char **)malloc(sizeof(char *));
if(data->thornlist)
{
- data->thornlist[0] = (char *)malloc((strlen(thorn)+1)*sizeof(char));
- if(data->thornlist[0])
- {
- strcpy(data->thornlist[0], thorn);
- data->n_thorns = 1;
- StoreNamedData(&implementation_data,implementation, data);
- retval = 0;
- }
- else
- {
- retval = 4;
- }
+ data->thornlist[0] = (char *)malloc((strlen(thorn)+1)*sizeof(char));
+ if(data->thornlist[0])
+ {
+ strcpy(data->thornlist[0], thorn);
+ data->n_thorns = 1;
+ StoreNamedData(&implementation_data,implementation, data);
+ retval = 0;
+ }
+ else
+ {
+ retval = 4;
+ }
}
else
{
- fprintf(stderr, "Unable to allocate memory for new thorn %s\n", thorn);
- retval = 3;
+ fprintf(stderr, "Unable to allocate memory for new thorn %s\n", thorn);
+ retval = 3;
}
}
else
diff --git a/src/main/WarnLevel.c b/src/main/WarnLevel.c
index 30ec2667..29f3ec50 100644
--- a/src/main/WarnLevel.c
+++ b/src/main/WarnLevel.c
@@ -362,9 +362,9 @@ void CCTKi_FinaliseParamWarn(void)
else
{
if (param_errors==1)
- fprintf(stderr, "\nThere was 1 parameter warning\n\n");
+ fprintf(stderr, "\nThere was 1 parameter warning\n\n");
else
- fprintf(stderr, "\nThere were %d parameter warnings\n\n",param_errors);
+ fprintf(stderr, "\nThere were %d parameter warnings\n\n",param_errors);
fflush(stderr);
}
@@ -418,17 +418,17 @@ void FMODIFIER FORTRAN_NAME(CCTK_VInfo)(int format_number, ...)
{
if(*format_string != '%')
{
- message[current_place] = *format_string;
- current_place++;
- if(current_place >= message_length)
- {
- message = (char *)realloc(message, message_length*2);
- message_length *=2;
- }
+ message[current_place] = *format_string;
+ current_place++;
+ if(current_place >= message_length)
+ {
+ message = (char *)realloc(message, message_length*2);
+ message_length *=2;
+ }
}
else
{
-
+
}
}
diff --git a/src/schedule/Schedule.h b/src/schedule/Schedule.h
index 36c868f6..330e294a 100644
--- a/src/schedule/Schedule.h
+++ b/src/schedule/Schedule.h
@@ -25,10 +25,10 @@ signed char **CCTKi_ScheduleCreateArray(int size);
void CCTKi_ScheduleDestroyArray(int size, signed char **array);
int CCTKi_ScheduleAddRow(int size,
- signed char **array,
- int *order,
- int item,
- int *thisorders);
+ signed char **array,
+ int *order,
+ int item,
+ int *thisorders);
int CCTKi_ScheduleSort(int size, signed char **array, int *order);
diff --git a/src/schedule/ScheduleCreater.c b/src/schedule/ScheduleCreater.c
index 2c1fd6be..a0d80e05 100644
--- a/src/schedule/ScheduleCreater.c
+++ b/src/schedule/ScheduleCreater.c
@@ -19,8 +19,8 @@
static int ScheduleCreateGroup(const char *name);
static t_sched_item *ScheduleCreateItem(const char *name,
- t_sched_modifier *modifiers,
- void *attributes);
+ t_sched_modifier *modifiers,
+ void *attributes);
static int ScheduleAddItem(int ghandle, t_sched_item *item);
@@ -29,7 +29,7 @@ static int ScheduleSortGroup(t_sched_group *group);
static t_sched_modifier_type ScheduleTranslateModifierType(const char *modifier);
static int ScheduleItemNumber(t_sched_group *group,
- const char *name);
+ const char *name);
static int ScheduleSetupWhiles(t_sched_item *item);
@@ -103,10 +103,10 @@ t_sched_modifier *CCTKi_ScheduleAddModifier(t_sched_modifier *orig,
@@*/
int CCTKi_ScheduleFunction(const char *gname,
- const char *fname,
- void *func,
- t_sched_modifier *modifiers,
- void *attributes)
+ const char *fname,
+ void *func,
+ t_sched_modifier *modifiers,
+ void *attributes)
{
int retcode;
int handle;
@@ -158,9 +158,9 @@ int CCTKi_ScheduleFunction(const char *gname,
@@*/
int CCTKi_ScheduleGroup(const char *gname,
- const char *thisname,
- t_sched_modifier *modifiers,
- void *attributes)
+ const char *thisname,
+ t_sched_modifier *modifiers,
+ void *attributes)
{
int retcode;
int handle;
@@ -238,12 +238,12 @@ int CCTKi_ScheduleSortAllGroups(void)
if(errcode)
{
- fprintf(stderr,
- "Error while dorting group '%s' - %d remaining unsorted routines.\n",
- gdata->name,
- -errcode);
+ fprintf(stderr,
+ "Error while dorting group '%s' - %d remaining unsorted routines.\n",
+ gdata->name,
+ -errcode);
- n_errors += -errcode;
+ n_errors += -errcode;
}
}
}
@@ -298,19 +298,19 @@ static int ScheduleCreateGroup(const char *name)
if(this_group->name)
{
- strcpy(this_group->name, name);
+ strcpy(this_group->name, name);
- this_group->order = NULL;
- this_group->n_scheditems = 0;
- this_group->scheditems = NULL;
- retcode = Util_NewHandle(&schedule_groups, name, (void *)this_group);
- n_schedule_groups++;
+ this_group->order = NULL;
+ this_group->n_scheditems = 0;
+ this_group->scheditems = NULL;
+ retcode = Util_NewHandle(&schedule_groups, name, (void *)this_group);
+ n_schedule_groups++;
}
else
{
- free(this_group);
+ free(this_group);
- retcode = -2;
+ retcode = -2;
}
}
else
@@ -509,7 +509,7 @@ static int ScheduleSortGroup(t_sched_group *group)
{
if(modifier->type == sched_while)
{
- continue;
+ continue;
}
number = ScheduleItemNumber(group, modifier->argument);
@@ -518,18 +518,18 @@ static int ScheduleSortGroup(t_sched_group *group)
#endif
if(number >= 0 && number < group->n_scheditems)
{
- switch(modifier->type)
- {
- case sched_before : mod = -1; break;
- case sched_after : mod = 1; break;
- default :
- mod = 0;
- }
+ switch(modifier->type)
+ {
+ case sched_before : mod = -1; break;
+ case sched_after : mod = 1; break;
+ default :
+ mod = 0;
+ }
#ifdef DEBUG_SCHEDULAR
- printf("Modifier is %d\n", mod);
+ printf("Modifier is %d\n", mod);
#endif
- thisorders[number] = mod;
+ thisorders[number] = mod;
}
}
@@ -676,22 +676,22 @@ static int ScheduleSetupWhiles(t_sched_item *item)
if(temp)
{
- item->whiles = temp;
-
- temp[item->n_whiles-1] = (char *)malloc((strlen(modifier->argument)+1)*sizeof(char));
- if(temp[item->n_whiles-1])
- {
- strcpy(temp[item->n_whiles-1], modifier->argument);
- }
- else
- {
- item->n_whiles--;
- retval--;
- }
+ item->whiles = temp;
+
+ temp[item->n_whiles-1] = (char *)malloc((strlen(modifier->argument)+1)*sizeof(char));
+ if(temp[item->n_whiles-1])
+ {
+ strcpy(temp[item->n_whiles-1], modifier->argument);
+ }
+ else
+ {
+ item->n_whiles--;
+ retval--;
+ }
}
else
{
- retval--;
+ retval--;
}
}
}
diff --git a/src/schedule/ScheduleSorter.c b/src/schedule/ScheduleSorter.c
index 56dad523..bd13f337 100644
--- a/src/schedule/ScheduleSorter.c
+++ b/src/schedule/ScheduleSorter.c
@@ -45,7 +45,7 @@ int CCTKi_ScheduleSort(int size, signed char **array, int *order)
{
for(column = row+1; column < size ; column++)
{
- if(array[row][column] > 0) break;
+ if(array[row][column] > 0) break;
}
if(column < size && array[row][column] > 0) break;
}
@@ -65,7 +65,7 @@ int CCTKi_ScheduleSort(int size, signed char **array, int *order)
{
for(column = row+1; column <size ; column++)
{
- if(array[row][column] > 0) retval -= 1;
+ if(array[row][column] > 0) retval -= 1;
}
}
@@ -87,10 +87,10 @@ int CCTKi_ScheduleSort(int size, signed char **array, int *order)
@@*/
int CCTKi_ScheduleAddRow(int size,
- signed char **array,
- int *order,
- int item,
- int *thisorders)
+ signed char **array,
+ int *order,
+ int item,
+ int *thisorders)
{
int retval;
@@ -151,7 +151,7 @@ signed char **CCTKi_ScheduleCreateArray(int size)
/* Free already allocated memory */
for(i--; i >=0; i--)
{
- free(array[i]);
+ free(array[i]);
}
free(array);
array = NULL;
@@ -165,7 +165,7 @@ signed char **CCTKi_ScheduleCreateArray(int size)
{
for(j=0; j < size; j++)
{
- array[i][j] = 0;
+ array[i][j] = 0;
}
}
}
@@ -353,18 +353,18 @@ int main(int argc, char *argv[])
{
if(i==j)
{
- array[i][i]=0;
+ array[i][i]=0;
}
else
{
- val = (signed char)((int)(weight*rand()/(RAND_MAX+1.0))-2);
+ val = (signed char)((int)(weight*rand()/(RAND_MAX+1.0))-2);
- /* Normalise */
- if(val) val /= abs(val);
+ /* Normalise */
+ if(val) val /= abs(val);
- array[i][j] = val;
- array[j][i] = -val;
+ array[i][j] = val;
+ array[j][i] = -val;
}
}
}
diff --git a/src/util/BinaryTree.c b/src/util/BinaryTree.c
index 93464561..ceab4dac 100644
--- a/src/util/BinaryTree.c
+++ b/src/util/BinaryTree.c
@@ -13,7 +13,7 @@
#include "BinaryTree.h"
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/*@@
@@ -47,14 +47,14 @@ t_tree *TreeStoreData(t_tree *root, t_tree *subtree, void *data, int (*compare)(
if(root)
{
- if((order = compare(data, root->data)) < 0)
- {
- root->left = subtree;
- }
- else
- {
- root->right = subtree;
- }
+ if((order = compare(data, root->data)) < 0)
+ {
+ root->left = subtree;
+ }
+ else
+ {
+ root->right = subtree;
+ }
}
}
}
@@ -143,7 +143,7 @@ int TreeTraversePreorder(t_tree *root, int (*process)(void *, void *), void *inf
return terminate;
}
-
+
/*@@
@routine TreeTraversePostorder
@date Mon Oct 5 11:05:54 1998
diff --git a/src/util/BinaryTree.h b/src/util/BinaryTree.h
index f4dce162..33e02b62 100644
--- a/src/util/BinaryTree.h
+++ b/src/util/BinaryTree.h
@@ -5,11 +5,16 @@
@desc
Prototypes and data definitions for binary tree routines.
@enddesc
+ @version $Header$
@@*/
#ifndef _BINARYTREE_H_
#define _BINARYTREE_H_
+#ifdef _cplusplus
+extern "C" {
+#endif
+
typedef struct T_TREE
{
struct T_TREE *left;
@@ -19,9 +24,6 @@ typedef struct T_TREE
void *data;
} t_tree;
-#ifdef _cplusplus
-extern "C" {
-#endif
t_tree *TreeStoreData(t_tree *root, t_tree *subtree, void *data, int (*compare)(const void *, const void *));
@@ -36,7 +38,7 @@ void TreePrintNodes(t_tree *root, int depth, void (*print_node)(void *, int));
t_tree *TreeFindNode(t_tree *root, void *data, int (*compare)(const void *, const void *));
#ifdef _cplusplus
- }
+ }
#endif
#endif
diff --git a/src/util/CactusTimers.c b/src/util/CactusTimers.c
index e0cb9eac..dda34503 100644
--- a/src/util/CactusTimers.c
+++ b/src/util/CactusTimers.c
@@ -118,16 +118,16 @@ int CCTK_TimerCreate(const char *name)
if(timer->data)
{
- /* Store the data structure for this timer */
- this_timer = Util_NewHandle(&timers, name, timer);
+ /* Store the data structure for this timer */
+ this_timer = Util_NewHandle(&timers, name, timer);
- /* Create the timer info for this timer */
- for(handle = 0; handle < n_timertypes; handle++)
- {
- funcs = (t_TimerFuncs *)Util_GetHandledData(handles, handle);
+ /* Create the timer info for this timer */
+ for(handle = 0; handle < n_timertypes; handle++)
+ {
+ funcs = (t_TimerFuncs *)Util_GetHandledData(handles, handle);
- timer->data[handle] = funcs->create(this_timer);
- }
+ timer->data[handle] = funcs->create(this_timer);
+ }
retval = this_timer;
}
else
diff --git a/src/util/File.c b/src/util/File.c
index b3adf8a6..99bed2c4 100644
--- a/src/util/File.c
+++ b/src/util/File.c
@@ -16,6 +16,8 @@
#include "cctk_FortranString.h"
#include "StoreHandledData.h"
+static char *rcsid = "$Header$";
+
static cHandledData *DirNames = NULL;
/*@@
@@ -43,7 +45,6 @@ int CCTK_mkdir(char *dir)
if (handle < 0)
{
-
/* New directory name */
handle = Util_NewHandle(&DirNames, dir, NULL);
@@ -70,8 +71,8 @@ int CCTK_mkdir(char *dir)
free(message);
/*** FIXME: not sure what a successfull system call look like
- across all architecures - ignore for now
- and set zero for Cactus success ***/
+ across all architecures - ignore for now
+ and set zero for Cactus success ***/
retval = system(command);
retval = 0;
diff --git a/src/util/Misc.c b/src/util/Misc.c
index d1159889..f4ca28e2 100644
--- a/src/util/Misc.c
+++ b/src/util/Misc.c
@@ -28,10 +28,12 @@
#include "cctk_FortranString.h"
#include "cctk_WarnLevel.h"
+static char *rcsid = "$Header";
+
int CCTK_RegexMatch(const char *string,
- const char *pattern,
- const int nmatch,
- regmatch_t *pmatch);
+ const char *pattern,
+ const int nmatch,
+ regmatch_t *pmatch);
/*@@
@routine Util_SplitString
@@ -145,8 +147,8 @@ int CCTK_Equals(const char *string1, const char *string2)
{
if(tolower(string1[position]) != tolower(string2[position]))
{
- retval = 0;
- break;
+ retval = 0;
+ break;
}
}
}
@@ -252,7 +254,7 @@ int Util_InList(const char *string1, int n_elements, ...)
return retval;
}
-
+
/*@@
@routine Util_IntInRange
@@ -294,17 +296,17 @@ int Util_IntInRange(int inval, const char *range)
*/
if((matched = CCTK_RegexMatch(range,
- "(\\[|\\()?([^]):]*):?([^]):]*)?:?([^]):]*)?(\\]|\\))?",
- 6, pmatch)) != 0)
+ "(\\[|\\()?([^]):]*):?([^]):]*)?:?([^]):]*)?(\\]|\\))?",
+ 6, pmatch)) != 0)
{
/* First work out if the range is closed at the lower end. */
if(pmatch[1].rm_so != -1)
{
switch(range[pmatch[1].rm_so])
{
- case '(' : start_closed = 0; break;
- case '[' :
- default : start_closed = 1;
+ case '(' : start_closed = 0; break;
+ case '[' :
+ default : start_closed = 1;
}
}
else
@@ -337,7 +339,7 @@ int Util_IntInRange(int inval, const char *range)
/* No end range given, so use the largest integer available. */
end = INT_MAX;
}
-
+
/* Next find the step of the range */
if(pmatch[4].rm_so != -1 && (pmatch[4].rm_eo-pmatch[4].rm_so > 0))
{
@@ -354,9 +356,9 @@ int Util_IntInRange(int inval, const char *range)
{
switch(range[pmatch[5].rm_so])
{
- case ')' : end_closed = 0; break;
- case ']' :
- default : end_closed = 1;
+ case ')' : end_closed = 0; break;
+ case ']' :
+ default : end_closed = 1;
}
}
else
@@ -420,17 +422,17 @@ int Util_DoubleInRange(double inval, const char *range)
*/
if((matched = CCTK_RegexMatch(range,
- "(\\[|\\()?([^]):]*):?([^]):]*)?:?([^]):]*)?(\\]|\\))?",
- 6, pmatch)) != 0)
+ "(\\[|\\()?([^]):]*):?([^]):]*)?:?([^]):]*)?(\\]|\\))?",
+ 6, pmatch)) != 0)
{
/* First work out if the range is closed at the lower end. */
if(pmatch[1].rm_so != -1)
{
switch(range[pmatch[1].rm_so])
{
- case '(' : start_closed = 0; break;
- case '[' :
- default : start_closed = 1;
+ case '(' : start_closed = 0; break;
+ case '[' :
+ default : start_closed = 1;
}
}
else
@@ -464,7 +466,7 @@ int Util_DoubleInRange(double inval, const char *range)
end = FLT_MAX;
}
-#if 0
+#if 0
/* Next find the step of the range */
if(pmatch[4].rm_so != -1 && (pmatch[4].rm_eo-pmatch[4].rm_so > 0))
{
@@ -482,9 +484,9 @@ int Util_DoubleInRange(double inval, const char *range)
{
switch(range[pmatch[5].rm_so])
{
- case ')' : end_closed = 0; break;
- case ']' :
- default : end_closed = 1;
+ case ')' : end_closed = 0; break;
+ case ']' :
+ default : end_closed = 1;
}
}
else
@@ -494,7 +496,7 @@ int Util_DoubleInRange(double inval, const char *range)
if(inval > start /*+ !start_closed */&&
inval < end /* - !end_closed */ /* &&
- ! ((inval-start) % step)*/)
+ ! ((inval-start) % step)*/)
{
retval = 1;
}
@@ -615,7 +617,7 @@ int Util_DoubleInRangeList(double inval, int n_elements, ...)
@@*/
int CCTK_SetDoubleInRangeList(CCTK_REAL *data, const char *value,
- int n_elements, ...)
+ int n_elements, ...)
{
int retval;
char temp[1001];
@@ -637,8 +639,8 @@ int CCTK_SetDoubleInRangeList(CCTK_REAL *data, const char *value,
for (p=0;p<strlen(temp);p++)
{
if (temp[p] == 'E' ||
- temp[p] == 'd' ||
- temp[p] == 'D')
+ temp[p] == 'd' ||
+ temp[p] == 'D')
{
temp[p] = 'e';
break;
@@ -683,7 +685,7 @@ int CCTK_SetDoubleInRangeList(CCTK_REAL *data, const char *value,
@@*/
int CCTK_SetIntInRangeList(CCTK_INT *data, const char *value,
- int n_elements, ...)
+ int n_elements, ...)
{
int retval;
int arg;
@@ -735,7 +737,7 @@ int CCTK_SetIntInRangeList(CCTK_INT *data, const char *value,
@@*/
int CCTK_SetKeywordInRangeList(char **data, const char *value,
- int n_elements, ...)
+ int n_elements, ...)
{
int retval;
int arg;
@@ -760,12 +762,12 @@ int CCTK_SetKeywordInRangeList(char **data, const char *value,
*data = (char *)malloc((strlen(value)+1)*sizeof(char));
if(*data)
{
- strcpy(*data, value);
- retval = 0;
+ strcpy(*data, value);
+ retval = 0;
}
else
{
- retval =-1;
+ retval =-1;
}
break;
}
@@ -793,7 +795,7 @@ int CCTK_SetKeywordInRangeList(char **data, const char *value,
@@*/
int CCTK_SetStringInRegexList(char **data, const char *value,
- int n_elements, ...)
+ int n_elements, ...)
{
int retval;
int arg;
@@ -941,9 +943,9 @@ int CCTK_SetBoolean(CCTK_INT *data, const char *value)
@@*/
int CCTK_RegexMatch(const char *string,
- const char *pattern,
- const int nmatch,
- regmatch_t *pmatch)
+ const char *pattern,
+ const int nmatch,
+ regmatch_t *pmatch)
{
int status;
regex_t re;
@@ -984,7 +986,7 @@ void FORTRAN_NAME(CCTK_FortranString)(CCTK_INT *nchar, char **cstring,ONE_FORTST
char *message;
message = (char *)malloc( (200+strlen(*cstring))*sizeof(char) );
sprintf(message,"Cannot output %s to char* of length %d",
- *cstring,cctk_strlen1);
+ *cstring,cctk_strlen1);
CCTK_Warn (1,__LINE__,__FILE__,"Cactus",message);
free(message);
*nchar = -1;
diff --git a/src/util/ParseFile.c b/src/util/ParseFile.c
index 604f6380..089a874a 100644
--- a/src/util/ParseFile.c
+++ b/src/util/ParseFile.c
@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <assert.h>
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/* Local definitions and functions */
#ifndef WIN32
@@ -40,9 +40,9 @@ static void removeSpaces(char *stripMe);
syntax we allow is
<ul>
<li>a = b
- <li>a,b,c = d,e,f
- <li># rest of the line is ignored
- <li>x = "string value"
+ <li>a,b,c = d,e,f
+ <li># rest of the line is ignored
+ <li>x = "string value"
</ul>
So it is easy to parse
<p>
@@ -55,13 +55,13 @@ static void removeSpaces(char *stripMe);
@hdate Tue Jan 12 16:41:36 1999 @hauthor Tom Goodale
@hdesc Moved to CCTK.
Changed to pass data to arbitrary function.
- Changed to take a file descriptor rather than a filename.
+ Changed to take a file descriptor rather than a filename.
@endhistory
@@*/
int ParseFile(FILE *ifp,
- int (*set_function)(const char *, const char *))
+ int (*set_function)(const char *, const char *))
{
/* Buffers for parsing from the file */
char tokens[BUF_SZ], value[BUF_SZ];
@@ -93,8 +93,8 @@ int ParseFile(FILE *ifp,
{
if(intoken)
{
- fprintf(stderr, "Parse error at line %d. No value supplied.\n", lineno);
- intoken = 0;
+ fprintf(stderr, "Parse error at line %d. No value supplied.\n", lineno);
+ intoken = 0;
}
lineno ++;
@@ -111,7 +111,7 @@ int ParseFile(FILE *ifp,
CheckBuf(intoken,lineno);
}
-
+
/* Start of a new token */
if (c != ' ' && c != '\n' && !inval && !intoken)
{
@@ -124,189 +124,189 @@ int ParseFile(FILE *ifp,
{
if (intoken)
{
- unsigned int ll;
- tokens[intoken] = '\0'; /* Very important! */
- intoken = 0;
- inval = 0;
- removeSpaces(tokens);
- ntokens = 1;
- for (ll=0;ll < strlen(tokens); ll++)
- if (tokens[ll] == ',') ntokens++;
+ unsigned int ll;
+ tokens[intoken] = '\0'; /* Very important! */
+ intoken = 0;
+ inval = 0;
+ removeSpaces(tokens);
+ ntokens = 1;
+ for (ll=0;ll < strlen(tokens); ll++)
+ if (tokens[ll] == ',') ntokens++;
#ifdef DEBUG
- printf ("New token! >>%s<<\n",tokens);
- printf ("%d token elements\n",ntokens);
+ printf ("New token! >>%s<<\n",tokens);
+ printf ("%d token elements\n",ntokens);
#endif
- /* Scan ahead to the beginning of the value
- * and check if the value is a string or
- * not. UNLIKE shalfs parser, this one DOES
- * strip quotes off of the strings. Bye bye
- * to StripQuotes routines...
- */
- while ((c = fgetc(ifp)) == ' ' || c == '\n' || c == '\t');
- if (c == '"')
- {
- /* Just handle the damn thing. */
- int p = 0;
- if (ntokens > 1)
- {
- fprintf (stderr, "%s%s%s\n",
- "WARNING: Multiple string ",
- "tokens not supported for ",
- tokens);
- fprintf(stderr, "This is a fatal error");
- return 1;
- }
- while ((c = fgetc(ifp)) != '"')
- {
- /* Make an important decision NOT to include
- * line feeds in the string parameters
- */
- if (c != '\n') value[p++] = c;
- if (c == '\n')
- {
- printf ("%sWarning:%s Quoted string contains newline for token %s\n",
- BOLDON, BOLDOFF, tokens);
- printf ("This could indicated a parameter file error or missing quote\n");
- }
- CheckBuf(p,lineno);
- }
- value[p] = '\0';
+ /* Scan ahead to the beginning of the value
+ * and check if the value is a string or
+ * not. UNLIKE shalfs parser, this one DOES
+ * strip quotes off of the strings. Bye bye
+ * to StripQuotes routines...
+ */
+ while ((c = fgetc(ifp)) == ' ' || c == '\n' || c == '\t');
+ if (c == '"')
+ {
+ /* Just handle the damn thing. */
+ int p = 0;
+ if (ntokens > 1)
+ {
+ fprintf (stderr, "%s%s%s\n",
+ "WARNING: Multiple string ",
+ "tokens not supported for ",
+ tokens);
+ fprintf(stderr, "This is a fatal error");
+ return 1;
+ }
+ while ((c = fgetc(ifp)) != '"')
+ {
+ /* Make an important decision NOT to include
+ * line feeds in the string parameters
+ */
+ if (c != '\n') value[p++] = c;
+ if (c == '\n')
+ {
+ printf ("%sWarning:%s Quoted string contains newline for token %s\n",
+ BOLDON, BOLDOFF, tokens);
+ printf ("This could indicated a parameter file error or missing quote\n");
+ }
+ CheckBuf(p,lineno);
+ }
+ value[p] = '\0';
#ifdef DEBUG
- printf ("String %s -> %s\n",
- tokens,value);
+ printf ("String %s -> %s\n",
+ tokens,value);
#endif
- set_function(tokens,value);
-
-
- }
- else
- {
- int p = 0;
- value[p++] = c;
- if (ntokens == 1)
- {
- /* Simple case. We have an int
- or a double which contain no
- spaces! */
- c = fgetc(ifp);
- while (!(c==' ' || c=='\t' || c == '\n' || c == EOF))
- {
- value[p++] = c;
- CheckBuf(p,lineno);
- c = fgetc(ifp);
- }
- value[p] = '\0';
+ set_function(tokens,value);
+
+
+ }
+ else
+ {
+ int p = 0;
+ value[p++] = c;
+ if (ntokens == 1)
+ {
+ /* Simple case. We have an int
+ or a double which contain no
+ spaces! */
+ c = fgetc(ifp);
+ while (!(c==' ' || c=='\t' || c == '\n' || c == EOF))
+ {
+ value[p++] = c;
+ CheckBuf(p,lineno);
+ c = fgetc(ifp);
+ }
+ value[p] = '\0';
#ifdef DEBUG
- printf ("Parsed %d characters\n", p);
- printf("Float/Int: %s -> %s\n", tokens,value);
+ printf ("Parsed %d characters\n", p);
+ printf("Float/Int: %s -> %s\n", tokens,value);
#endif
- set_function(tokens,value);
-
- }
- else
- {
- /* Harder case of multiple tokens */
- int ncommas = 0;
- int p=0, i;
- char subtoken[BUF_SZ], subvalue[BUF_SZ];
- int pt, pv;
-
- value[p++] = c;
- /* OK, since we only have numbers in the
- old input stream, we can go along getting
- ntokens-1 commas, stripping spaces, and
- make a nice little string.
- */
- c = fgetc(ifp);
- while (ncommas < ntokens-1 && c != EOF)
- {
- if (!(c == ' ' || c == '\t' || c == '\n'))
- {
- value[p++] = c;
- CheckBuf(p,lineno);
- }
- if (c == ',') ncommas ++;
- c = fgetc(ifp);
- }
- if (c == ' ' || c == '\t')
- {
- /* Great now strip out the spaces */
- while((c = fgetc(ifp)) == ' ' || c=='\t' || c == '\n');
- }
-
- /* And tack the rest on */
- value[p++] = c;
- CheckBuf(p,lineno);
-
- c = fgetc(ifp);
- while (c != ' ' && c != '\t' && c != '\n' && c != EOF)
- {
- value[p++] = c;
- CheckBuf(p,lineno);
- c = fgetc(ifp);
- }
- value[p] = '\0';
+ set_function(tokens,value);
+
+ }
+ else
+ {
+ /* Harder case of multiple tokens */
+ int ncommas = 0;
+ int p=0, i;
+ char subtoken[BUF_SZ], subvalue[BUF_SZ];
+ int pt, pv;
+
+ value[p++] = c;
+ /* OK, since we only have numbers in the
+ old input stream, we can go along getting
+ ntokens-1 commas, stripping spaces, and
+ make a nice little string.
+ */
+ c = fgetc(ifp);
+ while (ncommas < ntokens-1 && c != EOF)
+ {
+ if (!(c == ' ' || c == '\t' || c == '\n'))
+ {
+ value[p++] = c;
+ CheckBuf(p,lineno);
+ }
+ if (c == ',') ncommas ++;
+ c = fgetc(ifp);
+ }
+ if (c == ' ' || c == '\t')
+ {
+ /* Great now strip out the spaces */
+ while((c = fgetc(ifp)) == ' ' || c=='\t' || c == '\n');
+ }
+
+ /* And tack the rest on */
+ value[p++] = c;
+ CheckBuf(p,lineno);
+
+ c = fgetc(ifp);
+ while (c != ' ' && c != '\t' && c != '\n' && c != EOF)
+ {
+ value[p++] = c;
+ CheckBuf(p,lineno);
+ c = fgetc(ifp);
+ }
+ value[p] = '\0';
#ifdef DEBUG
- printf("Comma list: %s -> %s\n",
- tokens,value);
+ printf("Comma list: %s -> %s\n",
+ tokens,value);
#endif
- /* So parse out the tokens */
- pt = 0;
- pv = 0;
- for (i=0;i<ncommas;i++)
- {
- p = 0;
- while (tokens[pt] != ',')
- {
- subtoken[p++] = tokens[pt++];
- CheckBuf(p,lineno);
- }
- subtoken[p] = '\0';
- p = 0;
- while (value[pv] != ',')
- {
- subvalue[p++] = value[pv++];
- CheckBuf(p,lineno);
- }
- subvalue[p] = '\0';
-
- set_function(subtoken,subvalue);
+ /* So parse out the tokens */
+ pt = 0;
+ pv = 0;
+ for (i=0;i<ncommas;i++)
+ {
+ p = 0;
+ while (tokens[pt] != ',')
+ {
+ subtoken[p++] = tokens[pt++];
+ CheckBuf(p,lineno);
+ }
+ subtoken[p] = '\0';
+ p = 0;
+ while (value[pv] != ',')
+ {
+ subvalue[p++] = value[pv++];
+ CheckBuf(p,lineno);
+ }
+ subvalue[p] = '\0';
+
+ set_function(subtoken,subvalue);
#ifdef DEBUG
- printf("Setting sub-token %s -> %s\n",
- subtoken, subvalue);
+ printf("Setting sub-token %s -> %s\n",
+ subtoken, subvalue);
#endif
- /* Now remeber we are sitting on a comma
- * in both our input strings, so bump by one
- */
- pv ++; pt ++;
- }
- /* And OK, so now we have one parameter left
- * so lets handle that
- */
- p = 0;
- while (tokens[pt] != '\0')
- {
- subtoken[p++] = tokens[pt++];
- CheckBuf(p,lineno);
- }
- subtoken[p] = '\0';
- p = 0;
- while (value[pv] != '\0')
- {
- subvalue[p++] = value[pv++];
- CheckBuf(p,lineno);
- }
- subvalue[p] = '\0';
-
- set_function(subtoken,subvalue);
- }
- }
+ /* Now remeber we are sitting on a comma
+ * in both our input strings, so bump by one
+ */
+ pv ++; pt ++;
+ }
+ /* And OK, so now we have one parameter left
+ * so lets handle that
+ */
+ p = 0;
+ while (tokens[pt] != '\0')
+ {
+ subtoken[p++] = tokens[pt++];
+ CheckBuf(p,lineno);
+ }
+ subtoken[p] = '\0';
+ p = 0;
+ while (value[pv] != '\0')
+ {
+ subvalue[p++] = value[pv++];
+ CheckBuf(p,lineno);
+ }
+ subvalue[p] = '\0';
+
+ set_function(subtoken,subvalue);
+ }
+ }
}
else
{
- fprintf (stderr, "Parser failed at = on line %d\n",
- lineno);
+ fprintf (stderr, "Parser failed at = on line %d\n",
+ lineno);
}
}
}
@@ -327,7 +327,7 @@ static void CheckBuf(int p, int l)
{
if (p >= BUF_SZ) {
fprintf(stderr,"WARNING: Parser buffer overflow on line %d\n",
- l);
+ l);
fprintf(stderr,"This indicates either an incorrect parm file or\n");
fprintf(stderr,"the need to recompile doParse.C with a bigger\n");
fprintf(stderr,"BUF_SZ parm.\n");
@@ -356,15 +356,15 @@ static void CheckBuf(int p, int l)
static void removeSpaces(char *stripMe)
{
- char *s;
- unsigned int i,j;
- s = (char *)malloc((strlen(stripMe)+2)*sizeof(char));
- strcpy(s,stripMe);
- for (i=0,j=0;i<strlen(s);i++)
- if (s[i] != ' ' && s[i] != '\t' && s[i] != '\n')
- stripMe[j++] = s[i];
- stripMe[j] = '\0';
- free(s);
+ char *s;
+ unsigned int i,j;
+ s = (char *)malloc((strlen(stripMe)+2)*sizeof(char));
+ strcpy(s,stripMe);
+ for (i=0,j=0;i<strlen(s);i++)
+ if (s[i] != ' ' && s[i] != '\t' && s[i] != '\n')
+ stripMe[j++] = s[i];
+ stripMe[j] = '\0';
+ free(s);
}
diff --git a/src/util/RegisterKeyedFunction.c b/src/util/RegisterKeyedFunction.c
index 10e42ad7..efef0594 100644
--- a/src/util/RegisterKeyedFunction.c
+++ b/src/util/RegisterKeyedFunction.c
@@ -10,7 +10,7 @@
#include <stdlib.h>
#include "RegisterKeyedFunction.h"
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/*@@
@routine RegisterKeyedFunction
@@ -27,8 +27,8 @@ static char *rcsid = "$Id$";
@@*/
int RegisterKeyedFunction(void (*array[])(),
- int min, int max,
- int key, void (*func)())
+ int min, int max,
+ int key, void (*func)())
{
int return_code;
diff --git a/src/util/SKBinTree.c b/src/util/SKBinTree.c
index a01a1058..70441ada 100644
--- a/src/util/SKBinTree.c
+++ b/src/util/SKBinTree.c
@@ -20,7 +20,7 @@ int STR_cmpi(const char *string1, const char *string2);
#define STR_CMP(a,b) STR_cmpi(a,b)
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/*@@
@routine SKTreeStoreData
@@ -59,10 +59,10 @@ t_sktree *SKTreeStoreData(t_sktree *root, t_sktree *subtree,
strcpy(newsubtree->key, key);
if(root)
{
- if((order = STR_CMP(key, root->key)) < 0)
- {
- root->left = newsubtree;
- newsubtree->next = root;
+ if((order = STR_CMP(key, root->key)) < 0)
+ {
+ root->left = newsubtree;
+ newsubtree->next = root;
newsubtree->last = root->last;
if(newsubtree->last)
{
@@ -70,17 +70,17 @@ t_sktree *SKTreeStoreData(t_sktree *root, t_sktree *subtree,
}
/* printf("Added %s, NEXT: %s\n", newsubtree->key, root->key); */
- }
- else
- {
- root->right = newsubtree;
- newsubtree->next = root->next;
+ }
+ else
+ {
+ root->right = newsubtree;
+ newsubtree->next = root->next;
newsubtree->last = root;
- root->next = newsubtree;
+ root->next = newsubtree;
/*printf("Added %s, NEXT: %s\n", newsubtree->key, newsubtree->next ? newsubtree->next->key : "(none)");*/
/*printf("Modified %s NEXT\n", root->key);*/
- }
+ }
}
}
@@ -171,7 +171,7 @@ int SKTreeTraversePreorder(t_sktree *root, int (*process)(void *, void *), void
return terminate;
}
-
+
/*@@
@routine SKTreeTraversePostorder
@date Mon Oct 5 11:05:54 1998
diff --git a/src/util/StoreHandledData.c b/src/util/StoreHandledData.c
index c3894e37..13a8de7c 100644
--- a/src/util/StoreHandledData.c
+++ b/src/util/StoreHandledData.c
@@ -13,7 +13,7 @@
#include "StoreHandledData.h"
-static char *rcsid="$Id$";
+static char *rcsid="$Header$";
/* Purely internal definitions. */
@@ -73,31 +73,31 @@ int Util_NewHandle(cHandledData **storage, const char *name, void *data)
{
if(!(temp = (void *)realloc((*storage)->array, ((*storage)->array_size+1)*sizeof(cHandleStorage))))
{
- /* Failed to allocate memory for new array element. */
-
- return_code = -2;
+ /* Failed to allocate memory for new array element. */
+
+ return_code = -2;
}
else
{
- (*storage)->array = temp;
-
- /* Fill in data in array. */
- (*storage)->array[(*storage)->array_size].in_use = TRUE;
- (*storage)->array[(*storage)->array_size].data = data;
- (*storage)->array[(*storage)->array_size].name = (char *)malloc((strlen(name)+1)*sizeof(char));
-
- if((*storage)->array[(*storage)->array_size].name)
- {
- strcpy((*storage)->array[(*storage)->array_size].name, name);
- }
-
- return_code = (*storage)->array_size;
-
- /* Increase array size counter. */
- (*storage)->array_size++;
-
- /* Record position of first unused array element. */
- (*storage)->first_unused = (*storage)->array_size;
+ (*storage)->array = temp;
+
+ /* Fill in data in array. */
+ (*storage)->array[(*storage)->array_size].in_use = TRUE;
+ (*storage)->array[(*storage)->array_size].data = data;
+ (*storage)->array[(*storage)->array_size].name = (char *)malloc((strlen(name)+1)*sizeof(char));
+
+ if((*storage)->array[(*storage)->array_size].name)
+ {
+ strcpy((*storage)->array[(*storage)->array_size].name, name);
+ }
+
+ return_code = (*storage)->array_size;
+
+ /* Increase array size counter. */
+ (*storage)->array_size++;
+
+ /* Record position of first unused array element. */
+ (*storage)->first_unused = (*storage)->array_size;
}
}
else
@@ -106,23 +106,23 @@ int Util_NewHandle(cHandledData **storage, const char *name, void *data)
if((*storage)->array[(*storage)->first_unused].in_use == TRUE)
{
- /* The pointers have become corrupted in some fashion.
- *
- * Could write a repair function, but probably safer to just
- * produce an error.
- */
- return_code = -2;
+ /* The pointers have become corrupted in some fashion.
+ *
+ * Could write a repair function, but probably safer to just
+ * produce an error.
+ */
+ return_code = -2;
}
else
{
- /* Fill in data in array. */
- (*storage)->array[(*storage)->first_unused].in_use = TRUE;
- (*storage)->array[(*storage)->first_unused].data = data;
+ /* Fill in data in array. */
+ (*storage)->array[(*storage)->first_unused].in_use = TRUE;
+ (*storage)->array[(*storage)->first_unused].data = data;
- return_code = (*storage)->first_unused;
+ return_code = (*storage)->first_unused;
- /* Change pointer to first unused array element. */
- (*storage)->first_unused = FindNextUnused(*storage, (*storage)->first_unused);
+ /* Change pointer to first unused array element. */
+ (*storage)->first_unused = FindNextUnused(*storage, (*storage)->first_unused);
}
}
}
diff --git a/src/util/StoreKeyedData.c b/src/util/StoreKeyedData.c
index a4aad14d..278792ba 100644
--- a/src/util/StoreKeyedData.c
+++ b/src/util/StoreKeyedData.c
@@ -13,7 +13,7 @@
#include <stdlib.h>
#include "StoreKeyedData.h"
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/*@@
@@ -144,8 +144,8 @@ void *GetKeyedData(pKeyedData *storage, int key)
/* Compare the key */
if(current->key == key)
{
- return_val = current->data;
- break;
+ return_val = current->data;
+ break;
};
};
};
diff --git a/src/util/StoreNamedData.c b/src/util/StoreNamedData.c
index 67bf1faa..ebbd723c 100644
--- a/src/util/StoreNamedData.c
+++ b/src/util/StoreNamedData.c
@@ -15,7 +15,7 @@
#include "StoreNamedData.h"
-static char *rcsid = "$Id$";
+static char *rcsid = "$Header$";
/*@@
@@ -156,8 +156,8 @@ void *GetNamedData(pNamedData *list, const char *name)
/* Compare the name */
if(!strcmp(current->name, name))
{
- return_val = current->data;
- break;
+ return_val = current->data;
+ break;
};
};
};
diff --git a/src/util/getopt.c b/src/util/getopt.c
index bbbfae44..bc5b54f1 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -4,7 +4,7 @@
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94
- Free Software Foundation, Inc.
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -67,11 +67,11 @@ char * getenv(const char *);
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
+#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
-#endif /* GNU C library. */
+#endif /* GNU C library. */
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
@@ -169,13 +169,13 @@ static enum
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
-#ifdef __GNU_LIBRARY__
+#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
-#define my_index strchr
+#define my_index strchr
#else
/* Avoid depending on library functions or files
@@ -191,7 +191,7 @@ my_index (str, chr)
while (*str)
{
if (*str == chr)
- return (char *) str;
+ return (char *) str;
str++;
}
return 0;
@@ -246,37 +246,37 @@ exchange (argv)
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
+ {
+ /* Bottom segment is the short one. */
+ int len = middle - bottom;
+ register int i;
+
+ /* Swap it with the top part of the top segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[top - (middle - bottom) + i];
+ argv[top - (middle - bottom) + i] = tem;
+ }
+ /* Exclude the moved bottom segment from further swapping. */
+ top -= len;
+ }
else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
+ {
+ /* Top segment is the short one. */
+ int len = top - middle;
+ register int i;
+
+ /* Swap it with the bottom part of the bottom segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[middle + i];
+ argv[middle + i] = tem;
+ }
+ /* Exclude the moved top segment from further swapping. */
+ bottom += len;
+ }
}
/* Update records for the slots the non-options now occupy. */
@@ -396,70 +396,70 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
/* Advance to the next ARGV-element. */
if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
+ {
+ /* If we have just processed some options following some non-options,
+ exchange them so that the options come first. */
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (last_nonopt != optind)
+ first_nonopt = optind;
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
+ /* Skip any additional non-options
+ and extend the range of non-options previously skipped. */
- while (optind < argc
- && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
- optind++;
- last_nonopt = optind;
- }
+ while (optind < argc
+ && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
+ optind++;
+ last_nonopt = optind;
+ }
/* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
+ Skip it like a null option,
+ then exchange with previous non-options as if it were an option,
+ then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
+ {
+ optind++;
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (first_nonopt == last_nonopt)
+ first_nonopt = optind;
+ last_nonopt = argc;
- optind = argc;
- }
+ optind = argc;
+ }
/* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
+ and back over any non-options that we skipped and permuted. */
if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return EOF;
- }
+ {
+ /* Set the next-arg-index to point at the non-options
+ that we previously skipped, so the caller will digest them. */
+ if (first_nonopt != last_nonopt)
+ optind = first_nonopt;
+ return EOF;
+ }
/* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
+ either stop the scan or describe it to the caller and pass it by. */
if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
- {
- if (ordering == REQUIRE_ORDER)
- return EOF;
- optarg = argv[optind++];
- return 1;
- }
+ {
+ if (ordering == REQUIRE_ORDER)
+ return EOF;
+ optarg = argv[optind++];
+ return 1;
+ }
/* We have found another option-ARGV-element.
- Skip the initial punctuation. */
+ Skip the initial punctuation. */
nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
+ + (longopts != NULL && argv[optind][1] == '-'));
}
/* Decode the current option-ARGV-element. */
@@ -479,7 +479,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (longopts != NULL
&& (argv[optind][1] == '-'
- || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+ || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
{
char *nameend;
const struct option *p;
@@ -490,117 +490,117 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
int option_index;
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
+ /* Do nothing. */ ;
/* Test all long options for either exact match
- or abbreviated matches. */
+ or abbreviated matches. */
for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if (nameend - nextchar == (int) strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
+ if (!strncmp (p->name, nextchar, nameend - nextchar))
+ {
+ if (nameend - nextchar == (int) strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, "%s: option `%s' is ambiguous\n",
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return '?';
- }
+ {
+ if (opterr)
+ fprintf (stderr, "%s: option `%s' is ambiguous\n",
+ argv[0], argv[optind]);
+ nextchar += strlen (nextchar);
+ optind++;
+ return '?';
+ }
if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- "%s: option `--%s' doesn't allow an argument\n",
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- "%s: option `%c%s' doesn't allow an argument\n",
- argv[0], argv[optind - 1][0], pfound->name);
- }
- nextchar += strlen (nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr, "%s: option `%s' requires an argument\n",
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
+ {
+ option_index = indfound;
+ optind++;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ "%s: option `--%s' doesn't allow an argument\n",
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ "%s: option `%c%s' doesn't allow an argument\n",
+ argv[0], argv[optind - 1][0], pfound->name);
+ }
+ nextchar += strlen (nextchar);
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf (stderr, "%s: option `%s' requires an argument\n",
+ argv[0], argv[optind - 1]);
+ nextchar += strlen (nextchar);
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen (nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
/* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
+ or the option starts with '--' or is not a valid short
+ option, then it's an error.
+ Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
- || my_index (optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, "%s: unrecognized option `--%s'\n",
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf (stderr, "%s: unrecognized option `%c%s'\n",
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- return '?';
- }
+ || my_index (optstring, *nextchar) == NULL)
+ {
+ if (opterr)
+ {
+ if (argv[optind][1] == '-')
+ /* --option */
+ fprintf (stderr, "%s: unrecognized option `--%s'\n",
+ argv[0], nextchar);
+ else
+ /* +option or -option */
+ fprintf (stderr, "%s: unrecognized option `%c%s'\n",
+ argv[0], argv[optind][0], nextchar);
+ }
+ nextchar = (char *) "";
+ optind++;
+ return '?';
+ }
}
/* Look at and handle the next short option-character. */
@@ -615,61 +615,61 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (temp == NULL || c == ':')
{
- if (opterr)
- {
- if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
- else
- fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c);
- }
- optopt = c;
- return '?';
+ if (opterr)
+ {
+ if (posixly_correct)
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
+ else
+ fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c);
+ }
+ optopt = c;
+ return '?';
}
if (temp[1] == ':')
{
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = NULL;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: option requires an argument -- %c\n",
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
+ if (temp[2] == ':')
+ {
+ /* This is an option that accepts an argument optionally. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ optind++;
+ }
+ else
+ optarg = NULL;
+ nextchar = NULL;
+ }
+ else
+ {
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, "%s: option requires an argument -- %c\n",
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+ nextchar = NULL;
+ }
}
return c;
}
@@ -682,12 +682,12 @@ getopt (argc, argv, optstring)
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
+ (const struct option *) 0,
+ (int *) 0,
+ 0);
}
-#endif /* _LIBC or not __GNU_LIBRARY__. */
+#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
@@ -708,51 +708,51 @@ main (argc, argv)
c = getopt (argc, argv, "abc:d:0123456789");
if (c == EOF)
- break;
+ break;
switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
- printf ("%s ", argv[optind++]);
+ printf ("%s ", argv[optind++]);
printf ("\n");
}
diff --git a/src/util/getopt1.c b/src/util/getopt1.c
index a4f19762..505ae73e 100644
--- a/src/util/getopt1.c
+++ b/src/util/getopt1.c
@@ -1,6 +1,6 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
- Free Software Foundation, Inc.
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -54,7 +54,7 @@
char *getenv ();
#endif
-#ifndef NULL
+#ifndef NULL
#define NULL 0
#endif
@@ -86,7 +86,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
}
-#endif /* _LIBC or not __GNU_LIBRARY__. */
+#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
@@ -106,74 +106,74 @@ main (argc, argv)
int option_index = 0;
static struct option long_options[] =
{
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
+ {"add", 1, 0, 0},
+ {"append", 0, 0, 0},
+ {"delete", 1, 0, 0},
+ {"verbose", 0, 0, 0},
+ {"create", 0, 0, 0},
+ {"file", 1, 0, 0},
+ {0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
+ long_options, &option_index);
if (c == EOF)
- break;
+ break;
switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
+ {
+ case 0:
+ printf ("option %s", long_options[option_index].name);
+ if (optarg)
+ printf (" with arg %s", optarg);
+ printf ("\n");
+ break;
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case 'd':
+ printf ("option d with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
- printf ("%s ", argv[optind++]);
+ printf ("%s ", argv[optind++]);
printf ("\n");
}
diff --git a/src/util/gnu_regex.c b/src/util/gnu_regex.c
index 01a2d50f..529cc4d1 100644
--- a/src/util/gnu_regex.c
+++ b/src/util/gnu_regex.c
@@ -69,13 +69,13 @@ static char *rcsid = "$Id$";
#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
#include <string.h>
#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
+#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
#endif
#ifndef bcopy
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
+#define bcopy(s, d, n) memcpy ((d), (s), (n))
#endif
#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
+#define bzero(s, n) memset ((s), 0, (n))
#endif
#else
#include <strings.h>
@@ -226,9 +226,9 @@ char *alloca ();
#define REGEX_ALLOCATE alloca
/* Assumes a `char *destination' variable. */
-#define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
- bcopy (source, destination, osize), \
+#define REGEX_REALLOCATE(source, osize, nsize) \
+ (destination = (char *) alloca (nsize), \
+ bcopy (source, destination, osize), \
destination)
#endif /* not REGEX_MALLOC */
@@ -237,7 +237,7 @@ char *alloca ();
/* True if `size1' is non-NULL and PTR is pointing anywhere inside
`string1' or just past its end. This works if PTR is NULL, which is
a good thing. */
-#define FIRST_STRING_P(ptr) \
+#define FIRST_STRING_P(ptr) \
(size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
/* (Re)Allocate N items of type T using malloc, or fail. */
@@ -325,13 +325,13 @@ typedef enum
/* Followed by two byte relative address to which to jump. */
jump,
- /* Same as jump, but marks the end of an alternative. */
+ /* Same as jump, but marks the end of an alternative. */
jump_past_alt,
/* Followed by two-byte relative address of place to resume at
in case of failure. */
on_failure_jump,
-
+
/* Like on_failure_jump, but pushes a placeholder instead of the
current string position when executed. */
on_failure_keep_string_jump,
@@ -356,8 +356,8 @@ typedef enum
of jump when compiling an alternative. */
dummy_failure_jump,
- /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
+ /* Push a dummy failure point and continue. Used at the end of
+ alternatives. */
push_dummy_failure,
/* Followed by two-byte relative address and two-byte number n.
@@ -373,25 +373,25 @@ typedef enum
bytes of number. */
set_number_at,
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
+ wordchar, /* Matches any word-constituent character. */
+ notwordchar, /* Matches any char that is not a word-constituent. */
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
+ wordbeg, /* Succeeds if at word beginning. */
+ wordend, /* Succeeds if at word end. */
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
+ wordbound, /* Succeeds if at a word boundary. */
+ notwordbound /* Succeeds if not at a word boundary. */
#ifdef emacs
- ,before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
+ ,before_dot, /* Succeeds if before point. */
+ at_dot, /* Succeeds if at point. */
+ after_dot, /* Succeeds if after point. */
- /* Matches any character whose syntax is specified. Followed by
+ /* Matches any character whose syntax is specified. Followed by
a byte which contains a syntax code, e.g., Sword. */
syntaxspec,
- /* Matches any character whose syntax is not that specified. */
+ /* Matches any character whose syntax is not that specified. */
notsyntaxspec
#endif /* emacs */
} re_opcode_t;
@@ -400,29 +400,29 @@ typedef enum
/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-#define STORE_NUMBER(destination, number) \
- do { \
- (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; \
+#define STORE_NUMBER(destination, number) \
+ do { \
+ (destination)[0] = (number) & 0377; \
+ (destination)[1] = (number) >> 8; \
} while (0)
/* Same as STORE_NUMBER, except increment DESTINATION to
the byte after where the number is stored. Therefore, DESTINATION
must be an lvalue. */
-#define STORE_NUMBER_AND_INCR(destination, number) \
- do { \
- STORE_NUMBER (destination, number); \
- (destination) += 2; \
+#define STORE_NUMBER_AND_INCR(destination, number) \
+ do { \
+ STORE_NUMBER (destination, number); \
+ (destination) += 2; \
} while (0)
/* Put into DESTINATION a number stored in two contiguous bytes starting
at SOURCE. */
-#define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
+#define EXTRACT_NUMBER(destination, source) \
+ do { \
+ (destination) = *(source) & 0377; \
+ (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
} while (0)
#ifdef DEBUG
@@ -446,10 +446,10 @@ extract_number (dest, source)
/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
SOURCE must be an lvalue. */
-#define EXTRACT_NUMBER_AND_INCR(destination, source) \
- do { \
- EXTRACT_NUMBER (destination, source); \
- (source) += 2; \
+#define EXTRACT_NUMBER_AND_INCR(destination, source) \
+ do { \
+ EXTRACT_NUMBER (destination, source); \
+ (source) += 2; \
} while (0)
#ifdef DEBUG
@@ -491,9 +491,9 @@ static int debug = 0;
#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
+#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
if (debug) print_partial_compiled_pattern (s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
+#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
if (debug) print_double_string (w, s1, sz1, s2, sz2)
@@ -511,15 +511,15 @@ print_fastmap (fastmap)
while (i < (1 << BYTEWIDTH))
{
if (fastmap[i++])
- {
- was_a_range = 0;
+ {
+ was_a_range = 0;
printchar (i - 1);
while (i < (1 << BYTEWIDTH) && fastmap[i])
{
was_a_range = 1;
i++;
}
- if (was_a_range)
+ if (was_a_range)
{
printf ("-");
printchar (i - 1);
@@ -552,47 +552,47 @@ print_partial_compiled_pattern (start, end)
while (p < pend)
{
switch ((re_opcode_t) *p++)
- {
+ {
case no_op:
printf ("/no_op");
break;
- case exactn:
- mcnt = *p++;
+ case exactn:
+ mcnt = *p++;
printf ("/exactn/%d", mcnt);
do
- {
+ {
putchar ('/');
- printchar (*p++);
+ printchar (*p++);
}
while (--mcnt);
break;
- case start_memory:
+ case start_memory:
mcnt = *p++;
printf ("/start_memory/%d/%d", mcnt, *p++);
break;
- case stop_memory:
+ case stop_memory:
mcnt = *p++;
- printf ("/stop_memory/%d/%d", mcnt, *p++);
+ printf ("/stop_memory/%d/%d", mcnt, *p++);
break;
- case duplicate:
- printf ("/duplicate/%d", *p++);
- break;
+ case duplicate:
+ printf ("/duplicate/%d", *p++);
+ break;
- case anychar:
- printf ("/anychar");
- break;
+ case anychar:
+ printf ("/anychar");
+ break;
- case charset:
+ case charset:
case charset_not:
{
register int c;
printf ("/charset%s",
- (re_opcode_t) *(p - 1) == charset_not ? "_not" : "");
+ (re_opcode_t) *(p - 1) == charset_not ? "_not" : "");
assert (p + *p < pend);
@@ -603,139 +603,139 @@ print_partial_compiled_pattern (start, end)
putchar ('/');
- for (bit = 0; bit < BYTEWIDTH; bit++)
+ for (bit = 0; bit < BYTEWIDTH; bit++)
if (map_byte & (1 << bit))
printchar (c * BYTEWIDTH + bit);
}
- p += 1 + *p;
- break;
- }
+ p += 1 + *p;
+ break;
+ }
- case begline:
- printf ("/begline");
+ case begline:
+ printf ("/begline");
break;
- case endline:
+ case endline:
printf ("/endline");
break;
- case on_failure_jump:
+ case on_failure_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_jump/0/%d", mcnt);
+ printf ("/on_failure_jump/0/%d", mcnt);
break;
- case on_failure_keep_string_jump:
+ case on_failure_keep_string_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_keep_string_jump/0/%d", mcnt);
+ printf ("/on_failure_keep_string_jump/0/%d", mcnt);
break;
- case dummy_failure_jump:
+ case dummy_failure_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/dummy_failure_jump/0/%d", mcnt);
+ printf ("/dummy_failure_jump/0/%d", mcnt);
break;
- case push_dummy_failure:
+ case push_dummy_failure:
printf ("/push_dummy_failure");
break;
case maybe_pop_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/maybe_pop_jump/0/%d", mcnt);
- break;
+ printf ("/maybe_pop_jump/0/%d", mcnt);
+ break;
case pop_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/pop_failure_jump/0/%d", mcnt);
- break;
+ extract_number_and_incr (&mcnt, &p);
+ printf ("/pop_failure_jump/0/%d", mcnt);
+ break;
case jump_past_alt:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump_past_alt/0/%d", mcnt);
- break;
+ extract_number_and_incr (&mcnt, &p);
+ printf ("/jump_past_alt/0/%d", mcnt);
+ break;
case jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump/0/%d", mcnt);
- break;
+ extract_number_and_incr (&mcnt, &p);
+ printf ("/jump/0/%d", mcnt);
+ break;
case succeed_n:
extract_number_and_incr (&mcnt, &p);
extract_number_and_incr (&mcnt2, &p);
- printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2);
+ printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2);
break;
case jump_n:
extract_number_and_incr (&mcnt, &p);
extract_number_and_incr (&mcnt2, &p);
- printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2);
+ printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2);
break;
case set_number_at:
extract_number_and_incr (&mcnt, &p);
extract_number_and_incr (&mcnt2, &p);
- printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2);
+ printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2);
break;
case wordbound:
- printf ("/wordbound");
- break;
+ printf ("/wordbound");
+ break;
- case notwordbound:
- printf ("/notwordbound");
+ case notwordbound:
+ printf ("/notwordbound");
break;
- case wordbeg:
- printf ("/wordbeg");
- break;
+ case wordbeg:
+ printf ("/wordbeg");
+ break;
- case wordend:
- printf ("/wordend");
+ case wordend:
+ printf ("/wordend");
#ifdef emacs
- case before_dot:
- printf ("/before_dot");
+ case before_dot:
+ printf ("/before_dot");
break;
- case at_dot:
- printf ("/at_dot");
+ case at_dot:
+ printf ("/at_dot");
break;
- case after_dot:
- printf ("/after_dot");
+ case after_dot:
+ printf ("/after_dot");
break;
- case syntaxspec:
+ case syntaxspec:
printf ("/syntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
+ mcnt = *p++;
+ printf ("/%d", mcnt);
break;
-
- case notsyntaxspec:
+
+ case notsyntaxspec:
printf ("/notsyntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
+ mcnt = *p++;
+ printf ("/%d", mcnt);
+ break;
#endif /* emacs */
- case wordchar:
- printf ("/wordchar");
+ case wordchar:
+ printf ("/wordchar");
break;
-
- case notwordchar:
- printf ("/notwordchar");
+
+ case notwordchar:
+ printf ("/notwordchar");
break;
- case begbuf:
- printf ("/begbuf");
+ case begbuf:
+ printf ("/begbuf");
break;
- case endbuf:
- printf ("/endbuf");
+ case endbuf:
+ printf ("/endbuf");
break;
default:
printf ("?%d", *(p-1));
- }
+ }
}
printf ("/\n");
}
@@ -837,23 +837,23 @@ re_set_syntax (syntax)
in regex.h. Obviously the order here has to be same as there. */
static const char *re_error_msg[] =
- { NULL, /* REG_NOERROR */
- "No match", /* REG_NOMATCH */
- "Invalid regular expression", /* REG_BADPAT */
- "Invalid collation character", /* REG_ECOLLATE */
- "Invalid character class name", /* REG_ECTYPE */
- "Trailing backslash", /* REG_EESCAPE */
- "Invalid back reference", /* REG_ESUBREG */
- "Unmatched [ or [^", /* REG_EBRACK */
- "Unmatched ( or \\(", /* REG_EPAREN */
- "Unmatched \\{", /* REG_EBRACE */
- "Invalid content of \\{\\}", /* REG_BADBR */
- "Invalid range end", /* REG_ERANGE */
- "Memory exhausted", /* REG_ESPACE */
- "Invalid preceding regular expression", /* REG_BADRPT */
- "Premature end of regular expression", /* REG_EEND */
- "Regular expression too big", /* REG_ESIZE */
- "Unmatched ) or \\)", /* REG_ERPAREN */
+ { NULL, /* REG_NOERROR */
+ "No match", /* REG_NOMATCH */
+ "Invalid regular expression", /* REG_BADPAT */
+ "Invalid collation character", /* REG_ECOLLATE */
+ "Invalid character class name", /* REG_ECTYPE */
+ "Trailing backslash", /* REG_EESCAPE */
+ "Invalid back reference", /* REG_ESUBREG */
+ "Unmatched [ or [^", /* REG_EBRACK */
+ "Unmatched ( or \\(", /* REG_EPAREN */
+ "Unmatched \\{", /* REG_EBRACE */
+ "Invalid content of \\{\\}", /* REG_BADBR */
+ "Invalid range end", /* REG_ERANGE */
+ "Memory exhausted", /* REG_ESPACE */
+ "Invalid preceding regular expression", /* REG_BADRPT */
+ "Premature end of regular expression", /* REG_EEND */
+ "Regular expression too big", /* REG_ESIZE */
+ "Unmatched ) or \\)", /* REG_ERPAREN */
};
/* Subroutine declarations and macros for regex_compile. */
@@ -868,17 +868,17 @@ static reg_errcode_t compile_range ();
if necessary. Also cast from a signed character in the constant
string passed to us by the user to an unsigned char that we can use
as an array index (in, e.g., `translate'). */
-#define PATFETCH(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- if (translate) c = translate[c]; \
+#define PATFETCH(c) \
+ do {if (p == pend) return REG_EEND; \
+ c = (unsigned char) *p++; \
+ if (translate) c = translate[c]; \
} while (0)
/* Fetch the next character in the uncompiled pattern, with no
translation. */
-#define PATFETCH_RAW(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
+#define PATFETCH_RAW(c) \
+ do {if (p == pend) return REG_EEND; \
+ c = (unsigned char) *p++; \
} while (0)
/* Go backwards one character in the pattern. */
@@ -898,34 +898,34 @@ static reg_errcode_t compile_range ();
#define INIT_BUF_SIZE 32
/* Make sure we have at least N more bytes of space in buffer. */
-#define GET_BUFFER_SPACE(n) \
- while (b - bufp->buffer + (n) > bufp->allocated) \
+#define GET_BUFFER_SPACE(n) \
+ while (b - bufp->buffer + (n) > bufp->allocated) \
EXTEND_BUFFER ()
/* Make sure we have one more byte of buffer space and then add C to it. */
-#define BUF_PUSH(c) \
- do { \
- GET_BUFFER_SPACE (1); \
- *b++ = (unsigned char) (c); \
+#define BUF_PUSH(c) \
+ do { \
+ GET_BUFFER_SPACE (1); \
+ *b++ = (unsigned char) (c); \
} while (0)
/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
-#define BUF_PUSH_2(c1, c2) \
- do { \
- GET_BUFFER_SPACE (2); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
+#define BUF_PUSH_2(c1, c2) \
+ do { \
+ GET_BUFFER_SPACE (2); \
+ *b++ = (unsigned char) (c1); \
+ *b++ = (unsigned char) (c2); \
} while (0)
/* As with BUF_PUSH_2, except for three bytes. */
-#define BUF_PUSH_3(c1, c2, c3) \
- do { \
- GET_BUFFER_SPACE (3); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- *b++ = (unsigned char) (c3); \
+#define BUF_PUSH_3(c1, c2, c3) \
+ do { \
+ GET_BUFFER_SPACE (3); \
+ *b++ = (unsigned char) (c1); \
+ *b++ = (unsigned char) (c2); \
+ *b++ = (unsigned char) (c3); \
} while (0)
@@ -957,29 +957,29 @@ static reg_errcode_t compile_range ();
reset the pointers that pointed into the old block to point to the
correct places in the new one. If extending the buffer results in it
being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-#define EXTEND_BUFFER() \
- do { \
- unsigned char *old_buffer = bufp->buffer; \
- if (bufp->allocated == MAX_BUF_SIZE) \
- return REG_ESIZE; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
+#define EXTEND_BUFFER() \
+ do { \
+ unsigned char *old_buffer = bufp->buffer; \
+ if (bufp->allocated == MAX_BUF_SIZE) \
+ return REG_ESIZE; \
+ bufp->allocated <<= 1; \
+ if (bufp->allocated > MAX_BUF_SIZE) \
+ bufp->allocated = MAX_BUF_SIZE; \
bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
- if (bufp->buffer == NULL) \
- return REG_ESPACE; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != bufp->buffer) \
- { \
- b = (b - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (fixup_alt_jump) \
+ if (bufp->buffer == NULL) \
+ return REG_ESPACE; \
+ /* If the buffer moved, move all the pointers into it. */ \
+ if (old_buffer != bufp->buffer) \
+ { \
+ b = (b - old_buffer) + bufp->buffer; \
+ begalt = (begalt - old_buffer) + bufp->buffer; \
+ if (fixup_alt_jump) \
fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- } \
+ if (laststart) \
+ laststart = (laststart - old_buffer) + bufp->buffer; \
+ if (pending_exact) \
+ pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
+ } \
} while (0)
@@ -1013,7 +1013,7 @@ typedef struct
{
compile_stack_elt_t *stack;
unsigned size;
- unsigned avail; /* Offset of next open position. */
+ unsigned avail; /* Offset of next open position. */
} compile_stack_type;
@@ -1033,30 +1033,30 @@ typedef struct
/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
- { if (p != pend) \
- { \
- PATFETCH (c); \
- while (ISDIGIT (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
- }
+#define GET_UNSIGNED_NUMBER(num) \
+ { if (p != pend) \
+ { \
+ PATFETCH (c); \
+ while (ISDIGIT (c)) \
+ { \
+ if (num < 0) \
+ num = 0; \
+ num = num * 10 + c - '0'; \
+ if (p == pend) \
+ break; \
+ PATFETCH (c); \
+ } \
+ } \
+ }
#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-#define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
+#define IS_CHAR_CLASS(string) \
+ (STREQ (string, "alpha") || STREQ (string, "upper") \
+ || STREQ (string, "lower") || STREQ (string, "digit") \
+ || STREQ (string, "alnum") || STREQ (string, "xdigit") \
+ || STREQ (string, "space") || STREQ (string, "print") \
+ || STREQ (string, "punct") || STREQ (string, "graph") \
|| STREQ (string, "cntrl") || STREQ (string, "blank"))
/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
@@ -1164,7 +1164,7 @@ regex_compile (pattern, size, syntax, bufp)
bufp->used = 0;
/* Always count groups, whether or not bufp->no_sub is set. */
- bufp->re_nsub = 0;
+ bufp->re_nsub = 0;
#if !defined (emacs) && !defined (SYNTAX_TABLE)
/* Initialize the syntax table. */
@@ -1174,7 +1174,7 @@ regex_compile (pattern, size, syntax, bufp)
if (bufp->allocated == 0)
{
if (bufp->buffer)
- { /* If zero allocated, but buffer is non-null, try to realloc
+ { /* If zero allocated, but buffer is non-null, try to realloc
enough space. This loses if buffer's address is bogus, but
that is the user's responsibility. */
RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
@@ -1227,7 +1227,7 @@ regex_compile (pattern, size, syntax, bufp)
break;
- case '+':
+ case '+':
case '?':
if ((syntax & RE_BK_PLUS_QM)
|| (syntax & RE_LIMITED_OPS))
@@ -1321,7 +1321,7 @@ regex_compile (pattern, size, syntax, bufp)
the `*'. Do we have to do something analogous here
for null bytes, because of RE_DOT_NOT_NULL? */
if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
- && zero_times_ok
+ && zero_times_ok
&& p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
&& !(syntax & RE_DOT_NEWLINE))
{ /* We have .*\n. */
@@ -1357,10 +1357,10 @@ regex_compile (pattern, size, syntax, bufp)
b += 3;
}
}
- break;
+ break;
- case '.':
+ case '.':
laststart = b;
BUF_PUSH (anychar);
break;
@@ -1374,7 +1374,7 @@ regex_compile (pattern, size, syntax, bufp)
/* Ensure that we have enough space to push a charset: the
opcode, the length count, and the bitset; 34 bytes in all. */
- GET_BUFFER_SPACE (34);
+ GET_BUFFER_SPACE (34);
laststart = b;
@@ -1444,7 +1444,7 @@ regex_compile (pattern, size, syntax, bufp)
{ /* This handles ranges made up of characters only. */
reg_errcode_t ret;
- /* Move past the `-'. */
+ /* Move past the `-'. */
PATFETCH (c1);
ret = compile_range (&p, pend, translate, syntax, b);
@@ -1497,7 +1497,7 @@ regex_compile (pattern, size, syntax, bufp)
/* Throw away the ] at the end of the character
class. */
- PATFETCH (c);
+ PATFETCH (c);
if (p == pend) return REG_EBRACK;
@@ -1545,7 +1545,7 @@ regex_compile (pattern, size, syntax, bufp)
break;
- case '(':
+ case '(':
if (syntax & RE_NO_BK_PARENS)
goto handle_open;
else
@@ -1566,7 +1566,7 @@ regex_compile (pattern, size, syntax, bufp)
goto normal_char;
- case '|':
+ case '|':
if (syntax & RE_NO_BK_VBAR)
goto handle_alt;
else
@@ -1632,10 +1632,10 @@ regex_compile (pattern, size, syntax, bufp)
fixup_alt_jump = 0;
laststart = 0;
begalt = b;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
+ /* If we've reached MAX_REGNUM groups, then this open
+ won't actually generate any code, so we'll have to
+ clear pending_exact explicitly. */
+ pending_exact = 0;
break;
@@ -1677,7 +1677,7 @@ regex_compile (pattern, size, syntax, bufp)
as in `(ab)c(de)' -- the second group is #2. */
regnum_t this_group_regnum;
- compile_stack.avail--;
+ compile_stack.avail--;
begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset;
fixup_alt_jump
= COMPILE_STACK_TOP.fixup_alt_jump
@@ -1685,10 +1685,10 @@ regex_compile (pattern, size, syntax, bufp)
: 0;
laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset;
this_group_regnum = COMPILE_STACK_TOP.regnum;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
+ /* If we've reached MAX_REGNUM groups, then this open
+ won't actually generate any code, so we'll have to
+ clear pending_exact explicitly. */
+ pending_exact = 0;
/* We're at the end of the group, so now we know how many
groups were inside this one. */
@@ -1705,7 +1705,7 @@ regex_compile (pattern, size, syntax, bufp)
break;
- case '|': /* `\|'. */
+ case '|': /* `\|'. */
if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
goto normal_backslash;
handle_alt:
@@ -1910,7 +1910,7 @@ regex_compile (pattern, size, syntax, bufp)
beg_interval = NULL;
/* normal_char and normal_backslash need `c'. */
- PATFETCH (c);
+ PATFETCH (c);
if (!(syntax & RE_NO_BK_BRACES))
{
@@ -1926,7 +1926,7 @@ regex_compile (pattern, size, syntax, bufp)
BUF_PUSH (at_dot);
break;
- case 's':
+ case 's':
laststart = b;
PATFETCH (c);
BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
@@ -2013,39 +2013,39 @@ regex_compile (pattern, size, syntax, bufp)
break;
- default:
+ default:
/* Expects the character in `c'. */
- normal_char:
- /* If no exactn currently being built. */
+ normal_char:
+ /* If no exactn currently being built. */
if (!pending_exact
/* If last exactn not at current position. */
|| pending_exact + *pending_exact + 1 != b
/* We have only one byte following the exactn for the count. */
- || *pending_exact == (1 << BYTEWIDTH) - 1
+ || *pending_exact == (1 << BYTEWIDTH) - 1
/* If followed by a repetition operator. */
|| *p == '*' || *p == '^'
- || ((syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
- || ((syntax & RE_INTERVALS)
+ || ((syntax & RE_BK_PLUS_QM)
+ ? *p == '\\' && (p[1] == '+' || p[1] == '?')
+ : (*p == '+' || *p == '?'))
+ || ((syntax & RE_INTERVALS)
&& ((syntax & RE_NO_BK_BRACES)
- ? *p == '{'
+ ? *p == '{'
: (p[0] == '\\' && p[1] == '{'))))
- {
- /* Start building a new exactn. */
+ {
+ /* Start building a new exactn. */
laststart = b;
- BUF_PUSH_2 (exactn, 0);
- pending_exact = b - 1;
+ BUF_PUSH_2 (exactn, 0);
+ pending_exact = b - 1;
}
- BUF_PUSH (c);
+ BUF_PUSH (c);
(*pending_exact)++;
- break;
+ break;
} /* switch (c) */
} /* while p != pend */
@@ -2284,7 +2284,7 @@ typedef struct
{
fail_stack_elt_t *stack;
unsigned size;
- unsigned avail; /* Offset of next open position. */
+ unsigned avail; /* Offset of next open position. */
} fail_stack_type;
#define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
@@ -2295,16 +2295,16 @@ typedef struct
/* Initialize `fail_stack'. Do `return -2' if the alloc fails. */
-#define INIT_FAIL_STACK() \
- do { \
- fail_stack.stack = (fail_stack_elt_t *) \
- REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
- \
- if (fail_stack.stack == NULL) \
- return -2; \
- \
- fail_stack.size = INIT_FAILURE_ALLOC; \
- fail_stack.avail = 0; \
+#define INIT_FAIL_STACK() \
+ do { \
+ fail_stack.stack = (fail_stack_elt_t *) \
+ REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
+ \
+ if (fail_stack.stack == NULL) \
+ return -2; \
+ \
+ fail_stack.size = INIT_FAILURE_ALLOC; \
+ fail_stack.avail = 0; \
} while (0)
@@ -2315,17 +2315,17 @@ typedef struct
REGEX_REALLOCATE requires `destination' be declared. */
-#define DOUBLE_FAIL_STACK(fail_stack) \
- ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
- ? 0 \
- : ((fail_stack).stack = (fail_stack_elt_t *) \
- REGEX_REALLOCATE ((fail_stack).stack, \
- (fail_stack).size * sizeof (fail_stack_elt_t), \
- ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
- \
- (fail_stack).stack == NULL \
- ? 0 \
- : ((fail_stack).size <<= 1, \
+#define DOUBLE_FAIL_STACK(fail_stack) \
+ ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
+ ? 0 \
+ : ((fail_stack).stack = (fail_stack_elt_t *) \
+ REGEX_REALLOCATE ((fail_stack).stack, \
+ (fail_stack).size * sizeof (fail_stack_elt_t), \
+ ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
+ \
+ (fail_stack).stack == NULL \
+ ? 0 \
+ : ((fail_stack).size <<= 1, \
1)))
@@ -2333,17 +2333,17 @@ typedef struct
Return 1 if was able to do so and 0 if ran out of memory allocating
space to do so. */
-#define PUSH_PATTERN_OP(pattern_op, fail_stack) \
- ((FAIL_STACK_FULL () \
- && !DOUBLE_FAIL_STACK (fail_stack)) \
- ? 0 \
- : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \
+#define PUSH_PATTERN_OP(pattern_op, fail_stack) \
+ ((FAIL_STACK_FULL () \
+ && !DOUBLE_FAIL_STACK (fail_stack)) \
+ ? 0 \
+ : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \
1))
/* This pushes an item onto the failure stack. Must be a four-byte
value. Assumes the variable `fail_stack'. Probably should only
be called from within `PUSH_FAILURE_POINT'. */
-#define PUSH_FAILURE_ITEM(item) \
+#define PUSH_FAILURE_ITEM(item) \
fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
/* The complement operation. Assumes `fail_stack' is nonempty. */
@@ -2368,78 +2368,78 @@ typedef struct
Does `return FAILURE_CODE' if runs out of memory. */
-#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
- do { \
- char *destination; \
- /* Must be int, so when we don't save any registers, the arithmetic \
- of 0 + -1 isn't done as unsigned. */ \
- int this_reg; \
- \
- DEBUG_STATEMENT (failure_id++); \
- DEBUG_STATEMENT (nfailure_points_pushed++); \
- DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
+#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
+ do { \
+ char *destination; \
+ /* Must be int, so when we don't save any registers, the arithmetic \
+ of 0 + -1 isn't done as unsigned. */ \
+ int this_reg; \
+ \
+ DEBUG_STATEMENT (failure_id++); \
+ DEBUG_STATEMENT (nfailure_points_pushed++); \
+ DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
- \
- DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \
- DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
- \
- /* Ensure we have enough space allocated for what we will push. */ \
- while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
- { \
- if (!DOUBLE_FAIL_STACK (fail_stack)) \
- return failure_code; \
- \
- DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
- (fail_stack).size); \
+ \
+ DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \
+ DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
+ \
+ /* Ensure we have enough space allocated for what we will push. */ \
+ while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
+ { \
+ if (!DOUBLE_FAIL_STACK (fail_stack)) \
+ return failure_code; \
+ \
+ DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
+ (fail_stack).size); \
DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
- } \
- \
- /* Push the info, starting with the registers. */ \
- DEBUG_PRINT1 ("\n"); \
- \
- for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
- this_reg++) \
- { \
- DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
- DEBUG_STATEMENT (num_regs_pushed++); \
- \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- PUSH_FAILURE_ITEM (regstart[this_reg]); \
+ } \
+ \
+ /* Push the info, starting with the registers. */ \
+ DEBUG_PRINT1 ("\n"); \
+ \
+ for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
+ this_reg++) \
+ { \
+ DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
+ DEBUG_STATEMENT (num_regs_pushed++); \
+ \
+ DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
+ PUSH_FAILURE_ITEM (regstart[this_reg]); \
+ \
+ DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
+ PUSH_FAILURE_ITEM (regend[this_reg]); \
+ \
+ DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \
+ DEBUG_PRINT2 (" match_null=%d", \
+ REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
+ DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
+ DEBUG_PRINT2 (" matched_something=%d", \
+ MATCHED_SOMETHING (reg_info[this_reg])); \
+ DEBUG_PRINT2 (" ever_matched=%d", \
+ EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
+ DEBUG_PRINT1 ("\n"); \
+ PUSH_FAILURE_ITEM (reg_info[this_reg].word); \
+ } \
\
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- PUSH_FAILURE_ITEM (regend[this_reg]); \
- \
- DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \
- DEBUG_PRINT2 (" match_null=%d", \
- REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
- DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
- DEBUG_PRINT2 (" matched_something=%d", \
- MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT2 (" ever_matched=%d", \
- EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT1 ("\n"); \
- PUSH_FAILURE_ITEM (reg_info[this_reg].word); \
- } \
- \
DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\
- PUSH_FAILURE_ITEM (lowest_active_reg); \
- \
+ PUSH_FAILURE_ITEM (lowest_active_reg); \
+ \
DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
- PUSH_FAILURE_ITEM (highest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
- PUSH_FAILURE_ITEM (pattern_place); \
- \
- DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
+ PUSH_FAILURE_ITEM (highest_active_reg); \
+ \
+ DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \
+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
+ PUSH_FAILURE_ITEM (pattern_place); \
+ \
+ DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
- size2); \
- DEBUG_PRINT1 ("'\n"); \
- PUSH_FAILURE_ITEM (string_place); \
- \
- DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
- DEBUG_PUSH (failure_id); \
+ size2); \
+ DEBUG_PRINT1 ("'\n"); \
+ PUSH_FAILURE_ITEM (string_place); \
+ \
+ DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
+ DEBUG_PUSH (failure_id); \
} while (0)
/* This is the number of items that are pushed and popped on the stack
@@ -2457,8 +2457,8 @@ typedef struct
#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
/* We actually push this many items. */
-#define NUM_FAILURE_ITEMS \
- ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
+#define NUM_FAILURE_ITEMS \
+ ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
+ NUM_NONREG_ITEMS)
/* How many items can still be added to the stack without overflowing it. */
@@ -2478,60 +2478,60 @@ typedef struct
`pend', `string1', `size1', `string2', and `size2'. */
#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
-{ \
- DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
- int this_reg; \
- const unsigned char *string_temp; \
- \
- assert (!FAIL_STACK_EMPTY ()); \
- \
- /* Remove failure points and point to how many regs pushed. */ \
- DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
- DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
- DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
- \
- assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
- \
- DEBUG_POP (&failure_id); \
- DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
- \
- /* If the saved string location is NULL, it came from an \
- on_failure_keep_string_jump opcode, and we want to throw away the \
- saved NULL, thus retaining our current position in the string. */ \
- string_temp = POP_FAILURE_ITEM (); \
- if (string_temp != NULL) \
- str = (const char *) string_temp; \
- \
- DEBUG_PRINT2 (" Popping string 0x%x: `", str); \
- DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
- DEBUG_PRINT1 ("'\n"); \
- \
- pat = (unsigned char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
- \
- /* Restore register info. */ \
- high_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
- \
- low_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
- \
- for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
- { \
- DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
- \
- reg_info[this_reg].word = POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \
- \
- regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- \
- regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- } \
- \
- DEBUG_STATEMENT (nfailure_points_popped++); \
+{ \
+ DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
+ int this_reg; \
+ const unsigned char *string_temp; \
+ \
+ assert (!FAIL_STACK_EMPTY ()); \
+ \
+ /* Remove failure points and point to how many regs pushed. */ \
+ DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
+ DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
+ DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
+ \
+ assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
+ \
+ DEBUG_POP (&failure_id); \
+ DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
+ \
+ /* If the saved string location is NULL, it came from an \
+ on_failure_keep_string_jump opcode, and we want to throw away the \
+ saved NULL, thus retaining our current position in the string. */ \
+ string_temp = POP_FAILURE_ITEM (); \
+ if (string_temp != NULL) \
+ str = (const char *) string_temp; \
+ \
+ DEBUG_PRINT2 (" Popping string 0x%x: `", str); \
+ DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
+ DEBUG_PRINT1 ("'\n"); \
+ \
+ pat = (unsigned char *) POP_FAILURE_ITEM (); \
+ DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \
+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
+ \
+ /* Restore register info. */ \
+ high_reg = (unsigned) POP_FAILURE_ITEM (); \
+ DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
+ \
+ low_reg = (unsigned) POP_FAILURE_ITEM (); \
+ DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
+ \
+ for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
+ { \
+ DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
+ \
+ reg_info[this_reg].word = POP_FAILURE_ITEM (); \
+ DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \
+ \
+ regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \
+ DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
+ \
+ regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \
+ DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
+ } \
+ \
+ DEBUG_STATEMENT (nfailure_points_popped++); \
} /* POP_FAILURE_POINT */
/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
@@ -2578,7 +2578,7 @@ re_compile_fastmap (bufp)
INIT_FAIL_STACK ();
bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
- bufp->fastmap_accurate = 1; /* It will be when we're done. */
+ bufp->fastmap_accurate = 1; /* It will be when we're done. */
bufp->can_be_null = 0;
while (p != pend || !FAIL_STACK_EMPTY ())
@@ -2591,7 +2591,7 @@ re_compile_fastmap (bufp)
path_can_be_null = true;
p = fail_stack.stack[--fail_stack.avail];
- }
+ }
/* We should never be about to go beyond the end of the pattern. */
assert (p < pend);
@@ -2601,61 +2601,61 @@ re_compile_fastmap (bufp)
#else
switch ((re_opcode_t) *p++)
#endif
- {
+ {
/* I guess the idea here is to simply not bother with a fastmap
if a backreference is used, since it's too hard to figure out
the fastmap for the corresponding group. Setting
`can_be_null' stops `re_search_2' from using the fastmap, so
that is all we do. */
- case duplicate:
- bufp->can_be_null = 1;
+ case duplicate:
+ bufp->can_be_null = 1;
return 0;
/* Following are the cases which match a character. These end
with `break'. */
- case exactn:
+ case exactn:
fastmap[p[1]] = 1;
- break;
+ break;
case charset:
for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
+ if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
fastmap[j] = 1;
- break;
+ break;
- case charset_not:
- /* Chars beyond end of map must be allowed. */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
+ case charset_not:
+ /* Chars beyond end of map must be allowed. */
+ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
fastmap[j] = 1;
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
+ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
+ if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
fastmap[j] = 1;
break;
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
+ case wordchar:
+ for (j = 0; j < (1 << BYTEWIDTH); j++)
+ if (SYNTAX (j) == Sword)
+ fastmap[j] = 1;
+ break;
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
+ case notwordchar:
+ for (j = 0; j < (1 << BYTEWIDTH); j++)
+ if (SYNTAX (j) != Sword)
+ fastmap[j] = 1;
+ break;
case anychar:
/* `.' matches anything ... */
- for (j = 0; j < (1 << BYTEWIDTH); j++)
+ for (j = 0; j < (1 << BYTEWIDTH); j++)
fastmap[j] = 1;
/* ... except perhaps newline. */
@@ -2664,37 +2664,37 @@ re_compile_fastmap (bufp)
/* Return if we have already set `can_be_null'; if we have,
then the fastmap is irrelevant. Something's wrong here. */
- else if (bufp->can_be_null)
- return 0;
+ else if (bufp->can_be_null)
+ return 0;
/* Otherwise, have to check alternative paths. */
- break;
+ break;
#ifdef emacs
case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
+ k = *p++;
+ for (j = 0; j < (1 << BYTEWIDTH); j++)
+ if (SYNTAX (j) == (enum syntaxcode) k)
+ fastmap[j] = 1;
+ break;
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
+ case notsyntaxspec:
+ k = *p++;
+ for (j = 0; j < (1 << BYTEWIDTH); j++)
+ if (SYNTAX (j) != (enum syntaxcode) k)
+ fastmap[j] = 1;
+ break;
/* All cases after this match the empty string. These end with
`continue'. */
- case before_dot:
- case at_dot:
- case after_dot:
+ case before_dot:
+ case at_dot:
+ case after_dot:
continue;
#endif /* not emacs */
@@ -2702,26 +2702,26 @@ re_compile_fastmap (bufp)
case no_op:
case begline:
case endline:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
+ case begbuf:
+ case endbuf:
+ case wordbound:
+ case notwordbound:
+ case wordbeg:
+ case wordend:
case push_dummy_failure:
continue;
- case jump_n:
+ case jump_n:
case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
+ case maybe_pop_jump:
+ case jump:
case jump_past_alt:
- case dummy_failure_jump:
+ case dummy_failure_jump:
EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (j > 0)
- continue;
+ p += j;
+ if (j > 0)
+ continue;
/* Jump backward implies we just went through the body of a
loop and matched nothing. Opcode jumped to should be
@@ -2729,16 +2729,16 @@ re_compile_fastmap (bufp)
ordinary jump. For a * loop, it has pushed its failure
point already; if so, discard that as redundant. */
if ((re_opcode_t) *p != on_failure_jump
- && (re_opcode_t) *p != succeed_n)
- continue;
+ && (re_opcode_t) *p != succeed_n)
+ continue;
p++;
EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
-
+ p += j;
+
/* If what's on the stack is where we are now, pop it. */
if (!FAIL_STACK_EMPTY ()
- && fail_stack.stack[fail_stack.avail - 1] == p)
+ && fail_stack.stack[fail_stack.avail - 1] == p)
fail_stack.avail--;
continue;
@@ -2746,7 +2746,7 @@ re_compile_fastmap (bufp)
case on_failure_jump:
case on_failure_keep_string_jump:
- handle_on_failure_jump:
+ handle_on_failure_jump:
EXTRACT_NUMBER_AND_INCR (j, p);
/* For some patterns, e.g., `(a?)?', `p+j' here points to the
@@ -2766,40 +2766,40 @@ re_compile_fastmap (bufp)
if (succeed_n_p)
{
- EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
+ EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
succeed_n_p = false;
- }
+ }
continue;
- case succeed_n:
+ case succeed_n:
/* Get to the number of times to succeed. */
- p += 2;
+ p += 2;
/* Increment p past the n for when k != 0. */
EXTRACT_NUMBER_AND_INCR (k, p);
if (k == 0)
- {
+ {
p -= 4;
- succeed_n_p = true; /* Spaghetti code alert. */
+ succeed_n_p = true; /* Spaghetti code alert. */
goto handle_on_failure_jump;
}
continue;
- case set_number_at:
+ case set_number_at:
p += 4;
continue;
- case start_memory:
+ case start_memory:
case stop_memory:
- p += 2;
- continue;
+ p += 2;
+ continue;
- default:
+ default:
abort (); /* We have listed all the cases. */
} /* switch *p++ */
@@ -2867,7 +2867,7 @@ re_search (bufp, string, size, startpos, range, regs)
struct re_registers *regs;
{
return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
- regs, size);
+ regs, size);
}
@@ -2924,9 +2924,9 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
{
if (startpos > 0)
- return -1;
+ return -1;
else
- range = 1;
+ range = 1;
}
/* Update the fastmap now if not correct already. */
@@ -2942,54 +2942,54 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
null string, however, we don't need to skip characters; we want
the first null string. */
if (fastmap && startpos < total_size && !bufp->can_be_null)
- {
- if (range > 0) /* Searching forwards. */
- {
- register const char *d;
- register int lim = 0;
- int irange = range;
+ {
+ if (range > 0) /* Searching forwards. */
+ {
+ register const char *d;
+ register int lim = 0;
+ int irange = range;
if (startpos < size1 && startpos + range >= size1)
lim = range - (size1 - startpos);
- d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
+ d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
/* Written out as an if-else to avoid testing `translate'
inside the loop. */
- if (translate)
+ if (translate)
while (range > lim
&& !fastmap[(unsigned char)
- translate[(unsigned char) *d++]])
+ translate[(unsigned char) *d++]])
range--;
- else
+ else
while (range > lim && !fastmap[(unsigned char) *d++])
range--;
- startpos += irange - range;
- }
- else /* Searching backwards. */
- {
- register char c = (size1 == 0 || startpos >= size1
+ startpos += irange - range;
+ }
+ else /* Searching backwards. */
+ {
+ register char c = (size1 == 0 || startpos >= size1
? string2[startpos - size1]
: string1[startpos]);
- if (!fastmap[(unsigned char) TRANSLATE (c)])
- goto advance;
- }
- }
+ if (!fastmap[(unsigned char) TRANSLATE (c)])
+ goto advance;
+ }
+ }
/* If can't match the null string, and that's all we have left, fail. */
if (range >= 0 && startpos == total_size && fastmap
&& !bufp->can_be_null)
- return -1;
+ return -1;
val = re_match_2 (bufp, string1, size1, string2, size2,
- startpos, regs, stop);
+ startpos, regs, stop);
if (val >= 0)
- return startpos;
+ return startpos;
if (val == -2)
- return -2;
+ return -2;
advance:
if (!range)
@@ -3050,23 +3050,23 @@ typedef union
/* Call this when have matched a real character; it sets `matched' flags
for the subexpressions which we are currently inside. Also records
that those subexprs have matched. */
-#define SET_REGS_MATCHED() \
- do \
- { \
- unsigned r; \
- for (r = lowest_active_reg; r <= highest_active_reg; r++) \
- { \
- MATCHED_SOMETHING (reg_info[r]) \
- = EVER_MATCHED_SOMETHING (reg_info[r]) \
- = 1; \
- } \
- } \
+#define SET_REGS_MATCHED() \
+ do \
+ { \
+ unsigned r; \
+ for (r = lowest_active_reg; r <= highest_active_reg; r++) \
+ { \
+ MATCHED_SOMETHING (reg_info[r]) \
+ = EVER_MATCHED_SOMETHING (reg_info[r]) \
+ = 1; \
+ } \
+ } \
while (0)
/* This converts PTR, a pointer into one of the search strings `string1'
and `string2' into an offset from the beginning of that string. */
-#define POINTER_TO_OFFSET(ptr) \
+#define POINTER_TO_OFFSET(ptr) \
(FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1)
/* Registers are set to a sentinel when they haven't yet matched. */
@@ -3080,55 +3080,55 @@ typedef union
/* Call before fetching a character with *d. This switches over to
string2 if necessary. */
-#define PREFETCH() \
- while (d == dend) \
- { \
- /* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
- d = string2; \
- dend = end_match_2; \
+#define PREFETCH() \
+ while (d == dend) \
+ { \
+ /* End of string2 => fail. */ \
+ if (dend == end_match_2) \
+ goto fail; \
+ /* End of string1 => advance to string2. */ \
+ d = string2; \
+ dend = end_match_2; \
}
/* Test if at very beginning or at very end of the virtual concatenation
of `string1' and `string2'. If only one string, it's `string2'. */
#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
-#define AT_STRINGS_END(d) ((d) == end2)
+#define AT_STRINGS_END(d) ((d) == end2)
/* Test if D points to a character which is word-constituent. We have
two special cases to check for: if past the end of string1, look at
the first character in string2; and if before the beginning of
string2, look at the last character in string1. */
-#define WORDCHAR_P(d) \
- (SYNTAX ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
+#define WORDCHAR_P(d) \
+ (SYNTAX ((d) == end1 ? *string2 \
+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
== Sword)
/* Test if the character before D and the one at D differ with respect
to being word-constituent. */
-#define AT_WORD_BOUNDARY(d) \
- (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
+#define AT_WORD_BOUNDARY(d) \
+ (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
|| WORDCHAR_P (d - 1) != WORDCHAR_P (d))
/* Free everything we malloc. */
#ifdef REGEX_MALLOC
#define FREE_VAR(var) if (var) free (var); var = NULL
-#define FREE_VARIABLES() \
- do { \
- FREE_VAR (fail_stack.stack); \
- FREE_VAR (regstart); \
- FREE_VAR (regend); \
- FREE_VAR (old_regstart); \
- FREE_VAR (old_regend); \
- FREE_VAR (best_regstart); \
- FREE_VAR (best_regend); \
- FREE_VAR (reg_info); \
- FREE_VAR (reg_dummy); \
- FREE_VAR (reg_info_dummy); \
+#define FREE_VARIABLES() \
+ do { \
+ FREE_VAR (fail_stack.stack); \
+ FREE_VAR (regstart); \
+ FREE_VAR (regend); \
+ FREE_VAR (old_regstart); \
+ FREE_VAR (old_regend); \
+ FREE_VAR (best_regstart); \
+ FREE_VAR (best_regend); \
+ FREE_VAR (reg_info); \
+ FREE_VAR (reg_dummy); \
+ FREE_VAR (reg_info_dummy); \
} while (0)
#else /* not REGEX_MALLOC */
/* Some MIPS systems (at least) want this to free alloca'd storage. */
@@ -3277,7 +3277,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
#ifdef DEBUG
/* Counts the total number of registers pushed. */
- unsigned num_regs_pushed = 0;
+ unsigned num_regs_pushed = 0;
#endif
DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
@@ -3395,19 +3395,19 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
DEBUG_PRINT2 ("\n0x%x: ", p);
if (p == pend)
- { /* End of pattern means we might have succeeded. */
+ { /* End of pattern means we might have succeeded. */
DEBUG_PRINT1 ("end of pattern ... ");
- /* If we haven't matched the entire string, and we want the
+ /* If we haven't matched the entire string, and we want the
longest match, try backtracking. */
if (d != end_match_2)
- {
+ {
DEBUG_PRINT1 ("backtracking.\n");
if (!FAIL_STACK_EMPTY ())
{ /* More failure points to try. */
boolean same_str_p = (FIRST_STRING_P (match_end)
- == MATCHING_IN_FIRST_STRING);
+ == MATCHING_IN_FIRST_STRING);
/* If exceeds best match so far, save it. */
if (!best_regs_set
@@ -3425,13 +3425,13 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
best_regend[mcnt] = regend[mcnt];
}
}
- goto fail;
+ goto fail;
}
/* If no failure points, don't restore garbage. */
else if (best_regs_set)
{
- restore_best_regs:
+ restore_best_regs:
/* Restore best match. It may happen that `dend ==
end_match_1' while the restored d is in string2.
For example, the pattern `x.*y.*z' against the
@@ -3441,13 +3441,13 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
d = match_end;
dend = ((d >= string1 && d <= end1)
- ? end_match_1 : end_match_2);
+ ? end_match_1 : end_match_2);
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
+ for (mcnt = 1; mcnt < num_regs; mcnt++)
+ {
+ regstart[mcnt] = best_regstart[mcnt];
+ regend[mcnt] = best_regend[mcnt];
+ }
}
} /* d != end_match_2 */
@@ -3455,7 +3455,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* If caller wants register contents data back, do it. */
if (regs && !bufp->no_sub)
- {
+ {
/* Have the register data arrays been allocated? */
if (bufp->regs_allocated == REGS_UNALLOCATED)
{ /* No. So allocate them with malloc. We need one
@@ -3491,21 +3491,21 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
{
regs->start[0] = pos;
regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1
- : d - string2 + size1);
+ : d - string2 + size1);
}
/* Go through the first `min (num_regs, regs->num_regs)'
registers, since that is all we initialized. */
- for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
- {
+ for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
+ {
if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
regs->start[mcnt] = regs->end[mcnt] = -1;
else
{
- regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]);
+ regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]);
regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]);
}
- }
+ }
/* If the regs structure we return has more elements than
were in the pattern, set the extra elements to -1. If
@@ -3514,7 +3514,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
-1 at the end. */
for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
regs->start[mcnt] = regs->end[mcnt] = -1;
- } /* regs && !bufp->no_sub */
+ } /* regs && !bufp->no_sub */
FREE_VARIABLES ();
DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
@@ -3523,8 +3523,8 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
mcnt = d - pos - (MATCHING_IN_FIRST_STRING
- ? string1
- : string2 - size1);
+ ? string1
+ : string2 - size1);
DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
@@ -3537,7 +3537,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
#else
switch ((re_opcode_t) *p++)
#endif
- {
+ {
/* Ignore these. Used to ignore the n of succeed_n's which
currently have n == 0. */
case no_op:
@@ -3548,76 +3548,76 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* Match the next n pattern characters exactly. The following
byte in the pattern defines n, and the n bytes after that
are the characters to match. */
- case exactn:
- mcnt = *p++;
+ case exactn:
+ mcnt = *p++;
DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
/* This is written out as an if-else so we don't waste time
testing `translate' inside the loop. */
if (translate)
- {
- do
- {
- PREFETCH ();
- if (translate[(unsigned char) *d++] != (char) *p++)
+ {
+ do
+ {
+ PREFETCH ();
+ if (translate[(unsigned char) *d++] != (char) *p++)
goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH ();
- if (*d++ != (char) *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED ();
+ }
+ while (--mcnt);
+ }
+ else
+ {
+ do
+ {
+ PREFETCH ();
+ if (*d++ != (char) *p++) goto fail;
+ }
+ while (--mcnt);
+ }
+ SET_REGS_MATCHED ();
break;
/* Match any character except possibly a newline or a null. */
- case anychar:
+ case anychar:
DEBUG_PRINT1 ("EXECUTING anychar.\n");
PREFETCH ();
if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
|| (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
- goto fail;
+ goto fail;
SET_REGS_MATCHED ();
DEBUG_PRINT2 (" Matched `%d'.\n", *d);
d++;
- break;
+ break;
- case charset:
- case charset_not:
- {
- register unsigned char c;
- boolean not = (re_opcode_t) *(p - 1) == charset_not;
+ case charset:
+ case charset_not:
+ {
+ register unsigned char c;
+ boolean not = (re_opcode_t) *(p - 1) == charset_not;
DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
- PREFETCH ();
- c = TRANSLATE (*d); /* The character to match. */
+ PREFETCH ();
+ c = TRANSLATE (*d); /* The character to match. */
/* Cast to `unsigned' instead of `unsigned char' in case the
bit list is a full 32 bytes long. */
- if (c < (unsigned) (*p * BYTEWIDTH)
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
+ if (c < (unsigned) (*p * BYTEWIDTH)
+ && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
+ not = !not;
- p += 1 + *p;
+ p += 1 + *p;
- if (!not) goto fail;
+ if (!not) goto fail;
- SET_REGS_MATCHED ();
+ SET_REGS_MATCHED ();
d++;
- break;
- }
+ break;
+ }
/* The beginning of a group is represented by start_memory.
@@ -3626,10 +3626,10 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
matched within the group is recorded (in the internal
registers data structure) under the register number. */
case start_memory:
- DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
+ DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
/* Find out if this group can match the empty string. */
- p1 = p; /* To send to group_match_null_string_p. */
+ p1 = p; /* To send to group_match_null_string_p. */
if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
REG_MATCH_NULL_STRING_P (reg_info[*p])
@@ -3643,11 +3643,11 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
? REG_UNSET (regstart[*p]) ? d : regstart[*p]
: regstart[*p];
- DEBUG_PRINT2 (" old_regstart: %d\n",
- POINTER_TO_OFFSET (old_regstart[*p]));
+ DEBUG_PRINT2 (" old_regstart: %d\n",
+ POINTER_TO_OFFSET (old_regstart[*p]));
regstart[*p] = d;
- DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
+ DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
IS_ACTIVE (reg_info[*p]) = 1;
MATCHED_SOMETHING (reg_info[*p]) = 0;
@@ -3668,8 +3668,8 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* The stop_memory opcode represents the end of a group. Its
arguments are the same as start_memory's: the register
number, and the number of inner groups. */
- case stop_memory:
- DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
+ case stop_memory:
+ DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
/* We need to save the string position the last time we were at
this close-group operator in case the group is operated
@@ -3678,12 +3678,12 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
the string in case this attempt to match fails. */
old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
? REG_UNSET (regend[*p]) ? d : regend[*p]
- : regend[*p];
- DEBUG_PRINT2 (" old_regend: %d\n",
- POINTER_TO_OFFSET (old_regend[*p]));
+ : regend[*p];
+ DEBUG_PRINT2 (" old_regend: %d\n",
+ POINTER_TO_OFFSET (old_regend[*p]));
regend[*p] = d;
- DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
+ DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
/* This register isn't active anymore. */
IS_ACTIVE (reg_info[*p]) = 0;
@@ -3711,7 +3711,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
registers 1 and 2 as a result of the *, but when we pop
back to the second ), we are at the stop_memory 1.
Thus, nothing is active. */
- if (r == 0)
+ if (r == 0)
{
lowest_active_reg = NO_LOWEST_ACTIVE_REG;
highest_active_reg = NO_HIGHEST_ACTIVE_REG;
@@ -3727,7 +3727,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
last match. */
if ((!MATCHED_SOMETHING (reg_info[*p])
|| (re_opcode_t) p[-3] == start_memory)
- && (p + 2) < pend)
+ && (p + 2) < pend)
{
boolean is_a_jump_n = false;
@@ -3736,29 +3736,29 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
switch ((re_opcode_t) *p1++)
{
case jump_n:
- is_a_jump_n = true;
+ is_a_jump_n = true;
case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case dummy_failure_jump:
+ case maybe_pop_jump:
+ case jump:
+ case dummy_failure_jump:
EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (is_a_jump_n)
- p1 += 2;
+ if (is_a_jump_n)
+ p1 += 2;
break;
default:
/* do nothing */ ;
}
- p1 += mcnt;
+ p1 += mcnt;
/* If the next operation is a jump backwards in the pattern
- to an on_failure_jump right before the start_memory
+ to an on_failure_jump right before the start_memory
corresponding to this stop_memory, exit from the loop
by forcing a failure after pushing on the stack the
on_failure_jump's jump in the pattern, and d. */
if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
&& (re_opcode_t) p1[3] == start_memory && p1[4] == *p)
- {
+ {
/* If this group ever matched anything, then restore
what its registers were before trying this last
failed match, e.g., with `(a*)*b' against `ab' for
@@ -3770,12 +3770,12 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
otherwise get trashed). */
if (EVER_MATCHED_SOMETHING (reg_info[*p]))
- {
- unsigned r;
+ {
+ unsigned r;
EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
- /* Restore this and inner groups' (if any) registers. */
+ /* Restore this and inner groups' (if any) registers. */
for (r = *p; r < *p + *(p + 1); r++)
{
regstart[r] = old_regstart[r];
@@ -3785,7 +3785,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
regend[r] = old_regend[r];
}
}
- p1++;
+ p1++;
EXTRACT_NUMBER_AND_INCR (mcnt, p1);
PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
@@ -3798,15 +3798,15 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
break;
- /* \<digit> has been turned into a `duplicate' command which is
+ /* \<digit> has been turned into a `duplicate' command which is
followed by the numeric value of <digit> as the register number. */
case duplicate:
- {
- register const char *d2, *dend2;
- int regno = *p++; /* Get which register to match against. */
- DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
+ {
+ register const char *d2, *dend2;
+ int regno = *p++; /* Get which register to match against. */
+ DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
- /* Can't back reference a group which we've never matched. */
+ /* Can't back reference a group which we've never matched. */
if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
goto fail;
@@ -3819,51 +3819,51 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
the end of the first string. */
dend2 = ((FIRST_STRING_P (regstart[regno])
- == FIRST_STRING_P (regend[regno]))
- ? regend[regno] : end_match_1);
- for (;;)
- {
- /* If necessary, advance to next segment in register
+ == FIRST_STRING_P (regend[regno]))
+ ? regend[regno] : end_match_1);
+ for (;;)
+ {
+ /* If necessary, advance to next segment in register
contents. */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
+ while (d2 == dend2)
+ {
+ if (dend2 == end_match_2) break;
+ if (dend2 == regend[regno]) break;
/* End of string1 => advance to string2. */
d2 = string2;
dend2 = regend[regno];
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
+ }
+ /* At end of register contents => success */
+ if (d2 == dend2) break;
- /* If necessary, advance to next segment in data. */
- PREFETCH ();
+ /* If necessary, advance to next segment in data. */
+ PREFETCH ();
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
+ /* How many characters left in this segment to match. */
+ mcnt = dend - d;
- /* Want how many consecutive characters we can match in
+ /* Want how many consecutive characters we can match in
one shot, so, if necessary, adjust the count. */
if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
+ mcnt = dend2 - d2;
- /* Compare that many; failure if mismatch, else move
+ /* Compare that many; failure if mismatch, else move
past them. */
- if (translate
+ if (translate
? bcmp_translate (d, d2, mcnt, translate)
: bcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
+ goto fail;
+ d += mcnt, d2 += mcnt;
+ }
+ }
+ break;
/* begline matches the empty string at the beginning of the string
(unless `not_bol' is set in `bufp'), and, if
`newline_anchor' is set, after newlines. */
- case begline:
+ case begline:
DEBUG_PRINT1 ("EXECUTING begline.\n");
if (AT_STRINGS_BEG (d))
@@ -3879,7 +3879,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* endline is the dual of begline. */
- case endline:
+ case endline:
DEBUG_PRINT1 ("EXECUTING endline.\n");
if (AT_STRINGS_END (d))
@@ -3896,7 +3896,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
goto fail;
- /* Match at the very beginning of the data. */
+ /* Match at the very beginning of the data. */
case begbuf:
DEBUG_PRINT1 ("EXECUTING begbuf.\n");
if (AT_STRINGS_BEG (d))
@@ -3904,11 +3904,11 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
goto fail;
- /* Match at the very end of the data. */
+ /* Match at the very end of the data. */
case endbuf:
DEBUG_PRINT1 ("EXECUTING endbuf.\n");
- if (AT_STRINGS_END (d))
- break;
+ if (AT_STRINGS_END (d))
+ break;
goto fail;
@@ -3938,7 +3938,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
break;
- /* Uses of on_failure_jump:
+ /* Uses of on_failure_jump:
Each alternative starts with an on_failure_jump that points
to the beginning of the next alternative. Each alternative
@@ -3950,7 +3950,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
Repeats start with an on_failure_jump that points past both
the repetition text and either the following jump or
pop_failure_jump back to this on_failure_jump. */
- case on_failure_jump:
+ case on_failure_jump:
on_failure:
DEBUG_PRINT1 ("EXECUTING on_failure_jump");
@@ -3992,12 +3992,12 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* A smart repeat ends with `maybe_pop_jump'.
- We change it to either `pop_failure_jump' or `jump'. */
+ We change it to either `pop_failure_jump' or `jump'. */
case maybe_pop_jump:
EXTRACT_NUMBER_AND_INCR (mcnt, p);
DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
{
- register unsigned char *p2 = p;
+ register unsigned char *p2 = p;
/* Compare the beginning of the repeat with what in the
pattern follows its end. If we can establish that there
@@ -4012,70 +4012,70 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
detect that here, the alternative has put on a dummy
failure point which is what we will end up popping. */
- /* Skip over open/close-group commands. */
- while (p2 + 2 < pend
- && ((re_opcode_t) *p2 == stop_memory
- || (re_opcode_t) *p2 == start_memory))
- p2 += 3; /* Skip over args, too. */
+ /* Skip over open/close-group commands. */
+ while (p2 + 2 < pend
+ && ((re_opcode_t) *p2 == stop_memory
+ || (re_opcode_t) *p2 == start_memory))
+ p2 += 3; /* Skip over args, too. */
/* If we're at the end of the pattern, we can change. */
if (p2 == pend)
- {
- /* Consider what happens when matching ":\(.*\)"
- against ":/". I don't really understand this code
- yet. */
- p[-3] = (unsigned char) pop_failure_jump;
+ {
+ /* Consider what happens when matching ":\(.*\)"
+ against ":/". I don't really understand this code
+ yet. */
+ p[-3] = (unsigned char) pop_failure_jump;
DEBUG_PRINT1
(" End of pattern: change to `pop_failure_jump'.\n");
}
else if ((re_opcode_t) *p2 == exactn
- || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
- {
- register unsigned char c
+ || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
+ {
+ register unsigned char c
= *p2 == (unsigned char) endline ? '\n' : p2[2];
- p1 = p + mcnt;
+ p1 = p + mcnt;
/* p1[0] ... p1[2] are the `on_failure_jump' corresponding
to the `maybe_finalize_jump' of this case. Examine what
follows. */
if ((re_opcode_t) p1[3] == exactn && p1[5] != c)
{
- p[-3] = (unsigned char) pop_failure_jump;
+ p[-3] = (unsigned char) pop_failure_jump;
DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
c, p1[5]);
}
- else if ((re_opcode_t) p1[3] == charset
- || (re_opcode_t) p1[3] == charset_not)
- {
- int not = (re_opcode_t) p1[3] == charset_not;
+ else if ((re_opcode_t) p1[3] == charset
+ || (re_opcode_t) p1[3] == charset_not)
+ {
+ int not = (re_opcode_t) p1[3] == charset_not;
- if (c < (unsigned char) (p1[4] * BYTEWIDTH)
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
+ if (c < (unsigned char) (p1[4] * BYTEWIDTH)
+ && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
+ not = !not;
/* `not' is equal to 1 if c would match, which means
that we can't change to pop_failure_jump. */
- if (!not)
+ if (!not)
{
- p[-3] = (unsigned char) pop_failure_jump;
+ p[-3] = (unsigned char) pop_failure_jump;
DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
}
- }
- }
- }
- p -= 2; /* Point at relative address again. */
- if ((re_opcode_t) p[-1] != pop_failure_jump)
- {
- p[-1] = (unsigned char) jump;
+ }
+ }
+ }
+ p -= 2; /* Point at relative address again. */
+ if ((re_opcode_t) p[-1] != pop_failure_jump)
+ {
+ p[-1] = (unsigned char) jump;
DEBUG_PRINT1 (" Match => jump.\n");
- goto unconditional_jump;
- }
+ goto unconditional_jump;
+ }
/* Note fall through. */
- /* The end of a simple repeat has a pop_failure_jump back to
+ /* The end of a simple repeat has a pop_failure_jump back to
its matching on_failure_jump, where the latter will push a
failure point. The pop_failure_jump takes off failure
points put on by this pop_failure_jump's matching
@@ -4102,14 +4102,14 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* Unconditionally jump (without popping any failure points). */
case jump:
- unconditional_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
+ unconditional_jump:
+ EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
- p += mcnt; /* Do the jump. */
+ p += mcnt; /* Do the jump. */
DEBUG_PRINT2 ("(to 0x%x).\n", p);
- break;
+ break;
-
+
/* We need this opcode so we can detect where alternatives end
in `group_match_null_string_p' et al. */
case jump_past_alt:
@@ -4153,14 +4153,14 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
if (mcnt > 0)
{
mcnt--;
- p += 2;
+ p += 2;
STORE_NUMBER_AND_INCR (p, mcnt);
DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt);
}
- else if (mcnt == 0)
+ else if (mcnt == 0)
{
DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2);
- p[2] = (unsigned char) no_op;
+ p[2] = (unsigned char) no_op;
p[3] = (unsigned char) no_op;
goto on_failure;
}
@@ -4175,137 +4175,137 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
{
mcnt--;
STORE_NUMBER (p + 2, mcnt);
- goto unconditional_jump;
+ goto unconditional_jump;
}
/* If don't have to jump any more, skip over the rest of command. */
- else
- p += 4;
+ else
+ p += 4;
break;
- case set_number_at:
- {
+ case set_number_at:
+ {
DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
EXTRACT_NUMBER_AND_INCR (mcnt, p);
p1 = p + mcnt;
EXTRACT_NUMBER_AND_INCR (mcnt, p);
DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
- STORE_NUMBER (p1, mcnt);
+ STORE_NUMBER (p1, mcnt);
break;
}
case wordbound:
DEBUG_PRINT1 ("EXECUTING wordbound.\n");
if (AT_WORD_BOUNDARY (d))
- break;
+ break;
goto fail;
- case notwordbound:
+ case notwordbound:
DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- goto fail;
+ if (AT_WORD_BOUNDARY (d))
+ goto fail;
break;
- case wordbeg:
+ case wordbeg:
DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
- if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
- break;
+ if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
+ break;
goto fail;
- case wordend:
+ case wordend:
DEBUG_PRINT1 ("EXECUTING wordend.\n");
- if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
+ if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
&& (!WORDCHAR_P (d) || AT_STRINGS_END (d)))
- break;
+ break;
goto fail;
#ifdef emacs
#ifdef emacs19
- case before_dot:
+ case before_dot:
DEBUG_PRINT1 ("EXECUTING before_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) >= point)
- goto fail;
- break;
+ if (PTR_CHAR_POS ((unsigned char *) d) >= point)
+ goto fail;
+ break;
- case at_dot:
+ case at_dot:
DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) != point)
- goto fail;
- break;
+ if (PTR_CHAR_POS ((unsigned char *) d) != point)
+ goto fail;
+ break;
- case after_dot:
+ case after_dot:
DEBUG_PRINT1 ("EXECUTING after_dot.\n");
if (PTR_CHAR_POS ((unsigned char *) d) <= point)
- goto fail;
- break;
+ goto fail;
+ break;
#else /* not emacs19 */
- case at_dot:
+ case at_dot:
DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point)
- goto fail;
- break;
+ if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point)
+ goto fail;
+ break;
#endif /* not emacs19 */
- case syntaxspec:
+ case syntaxspec:
DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchsyntax;
+ mcnt = *p++;
+ goto matchsyntax;
case wordchar:
DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
- mcnt = (int) Sword;
+ mcnt = (int) Sword;
matchsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt)
+ PREFETCH ();
+ if (SYNTAX (*d++) != (enum syntaxcode) mcnt)
goto fail;
SET_REGS_MATCHED ();
- break;
+ break;
- case notsyntaxspec:
+ case notsyntaxspec:
DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchnotsyntax;
+ mcnt = *p++;
+ goto matchnotsyntax;
case notwordchar:
DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
- mcnt = (int) Sword;
+ mcnt = (int) Sword;
matchnotsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt)
+ PREFETCH ();
+ if (SYNTAX (*d++) == (enum syntaxcode) mcnt)
goto fail;
- SET_REGS_MATCHED ();
+ SET_REGS_MATCHED ();
break;
#else /* not emacs */
- case wordchar:
+ case wordchar:
DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
- PREFETCH ();
+ PREFETCH ();
if (!WORDCHAR_P (d))
goto fail;
- SET_REGS_MATCHED ();
+ SET_REGS_MATCHED ();
d++;
- break;
-
- case notwordchar:
+ break;
+
+ case notwordchar:
DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
- PREFETCH ();
- if (WORDCHAR_P (d))
+ PREFETCH ();
+ if (WORDCHAR_P (d))
goto fail;
SET_REGS_MATCHED ();
d++;
- break;
+ break;
#endif /* not emacs */
default:
abort ();
- }
+ }
continue; /* Successfully executed one pattern command; keep going. */
/* We goto here if a matching operation fails. */
fail:
if (!FAIL_STACK_EMPTY ())
- { /* A restart point is known. Restore to that state. */
+ { /* A restart point is known. Restore to that state. */
DEBUG_PRINT1 ("\nFAIL:\n");
POP_FAILURE_POINT (d, p,
lowest_active_reg, highest_active_reg,
@@ -4313,10 +4313,10 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* If this failure point is a dummy, try the next one. */
if (!p)
- goto fail;
+ goto fail;
/* If we failed to the end of the pattern, don't examine *p. */
- assert (p <= pend);
+ assert (p <= pend);
if (p < pend)
{
boolean is_a_jump_n = false;
@@ -4332,7 +4332,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
case jump:
p1 = p + 1;
EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
+ p1 += mcnt;
if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
|| (!is_a_jump_n
@@ -4345,7 +4345,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
}
if (d >= string1 && d <= end1)
- dend = end_match_1;
+ dend = end_match_1;
}
else
break; /* Matching at this starting point really fails. */
@@ -4356,7 +4356,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
FREE_VARIABLES ();
- return -1; /* Failure to match. */
+ return -1; /* Failure to match. */
} /* re_match_2 */
/* Subroutine definitions for re_match_2. */
@@ -4384,7 +4384,7 @@ group_match_null_string_p (p, end, reg_info)
while (p1 < end)
{
/* Skip over opcodes that can match nothing, and return true or
- false, as appropriate, when we get to one that can't, or to the
+ false, as appropriate, when we get to one that can't, or to the
matching stop_memory. */
switch ((re_opcode_t) *p1)
@@ -4395,10 +4395,10 @@ group_match_null_string_p (p, end, reg_info)
EXTRACT_NUMBER_AND_INCR (mcnt, p1);
/* If the next operation is not a jump backwards in the
- pattern. */
+ pattern. */
- if (mcnt >= 0)
- {
+ if (mcnt >= 0)
+ {
/* Go through the on_failure_jumps of the alternatives,
seeing if any of the alternatives cannot match nothing.
The last alternative starts with only a jump,
@@ -4407,7 +4407,7 @@ group_match_null_string_p (p, end, reg_info)
/on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
/on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
- /exactn/1/c
+ /exactn/1/c
So, we have to first go through the first (n-1)
alternatives and then deal with the last one separately. */
@@ -4424,25 +4424,25 @@ group_match_null_string_p (p, end, reg_info)
its number. */
if (!alt_match_null_string_p (p1, p1 + mcnt - 3,
- reg_info))
+ reg_info))
return false;
/* Move to right after this alternative, including the
- jump_past_alt. */
- p1 += mcnt;
+ jump_past_alt. */
+ p1 += mcnt;
/* Break if it's the beginning of an n-th alternative
that doesn't begin with an on_failure_jump. */
if ((re_opcode_t) *p1 != on_failure_jump)
break;
-
- /* Still have to check that it's not an n-th
- alternative that starts with an on_failure_jump. */
- p1++;
+
+ /* Still have to check that it's not an n-th
+ alternative that starts with an on_failure_jump. */
+ p1++;
EXTRACT_NUMBER_AND_INCR (mcnt, p1);
if ((re_opcode_t) p1[mcnt-3] != jump_past_alt)
{
- /* Get to the beginning of the n-th alternative. */
+ /* Get to the beginning of the n-th alternative. */
p1 -= 3;
break;
}
@@ -4456,13 +4456,13 @@ group_match_null_string_p (p, end, reg_info)
if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info))
return false;
- p1 += mcnt; /* Get past the n-th alternative. */
+ p1 += mcnt; /* Get past the n-th alternative. */
} /* if mcnt > 0 */
break;
case stop_memory:
- assert (p1[1] == **p);
+ assert (p1[1] == **p);
*p = p1 + 2;
return true;
@@ -4496,14 +4496,14 @@ alt_match_null_string_p (p, end, reg_info)
switch ((re_opcode_t) *p1)
{
- /* It's a loop. */
+ /* It's a loop. */
case on_failure_jump:
p1++;
EXTRACT_NUMBER_AND_INCR (mcnt, p1);
p1 += mcnt;
break;
- default:
+ default:
if (!common_op_match_null_string_p (&p1, end, reg_info))
return false;
}
@@ -4572,7 +4572,7 @@ common_op_match_null_string_p (p, end, reg_info)
case succeed_n:
/* Get to the number of times to succeed. */
- p1 += 2;
+ p1 += 2;
EXTRACT_NUMBER_AND_INCR (mcnt, p1);
if (mcnt == 0)
@@ -4674,7 +4674,7 @@ re_comp (s)
if (!s)
{
if (!re_comp_buf.buffer)
- return "No previous regular expression";
+ return "No previous regular expression";
return 0;
}
@@ -4687,7 +4687,7 @@ re_comp (s)
re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
if (re_comp_buf.fastmap == NULL)
- return "Memory exhausted";
+ return "Memory exhausted";
}
/* Since `re_exec' always passes NULL for the `regs' argument, we