summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2016-12-13 10:13:21 -0500
committerAdrian Thurston <thurston@colm.net>2016-12-13 10:13:55 -0500
commitdc2adb04132daf673a6abaae3c3b7cc0fa570374 (patch)
tree75ff9049119fecce08cd82f6aa2f6332a3bbfed2
parent93cb6a1c9ea51335118f9342a93a5c23d7f2f8c9 (diff)
downloadcolm-dc2adb04132daf673a6abaae3c3b7cc0fa570374.tar.gz
an automated include convention improvement from Peter Reijnders
-rw-r--r--AUTHORS1
-rw-r--r--src/buffer.h7
-rw-r--r--src/bytecode.c22
-rw-r--r--src/bytecode.h7
-rw-r--r--src/closure.cc10
-rw-r--r--src/codegen.cc19
-rw-r--r--src/codevect.c7
-rw-r--r--src/colm.h7
-rw-r--r--src/commit.c15
-rw-r--r--src/compiler.cc19
-rw-r--r--src/compiler.h31
-rw-r--r--src/consinit.cc12
-rw-r--r--src/consinit.h8
-rw-r--r--src/cstring.h8
-rw-r--r--src/ctinput.cc13
-rw-r--r--src/debug.c4
-rw-r--r--src/debug.h6
-rw-r--r--src/declare.cc7
-rw-r--r--src/dotgen.cc4
-rw-r--r--src/dotgen.h6
-rw-r--r--src/exports.cc9
-rw-r--r--src/fsmap.cc6
-rw-r--r--src/fsmattach.cc6
-rw-r--r--src/fsmbase.cc3
-rw-r--r--src/fsmcodegen.cc12
-rw-r--r--src/fsmcodegen.h13
-rw-r--r--src/fsmexec.cc9
-rw-r--r--src/fsmgraph.cc7
-rw-r--r--src/fsmgraph.h31
-rw-r--r--src/fsmmin.cc5
-rw-r--r--src/fsmstate.cc6
-rw-r--r--src/global.h11
-rw-r--r--src/input.c15
-rw-r--r--src/input.h7
-rw-r--r--src/internal.h7
-rw-r--r--src/iter.c7
-rw-r--r--src/keyops.h7
-rw-r--r--src/list.c6
-rw-r--r--src/loadcolm.cc13
-rw-r--r--src/loadcolm.h6
-rw-r--r--src/loadinit.cc16
-rw-r--r--src/loadinit.h10
-rw-r--r--src/lookup.cc7
-rw-r--r--src/main.cc16
-rw-r--r--src/map.c7
-rw-r--r--src/map.h7
-rw-r--r--src/parser.cc12
-rw-r--r--src/parser.h11
-rw-r--r--src/parsetree.cc15
-rw-r--r--src/parsetree.h25
-rw-r--r--src/pcheck.cc4
-rw-r--r--src/pcheck.h7
-rw-r--r--src/pdabuild.cc20
-rw-r--r--src/pdacodegen.cc10
-rw-r--r--src/pdacodegen.h7
-rw-r--r--src/pdagraph.cc10
-rw-r--r--src/pdagraph.h31
-rw-r--r--src/pdarun.c18
-rw-r--r--src/pdarun.h7
-rw-r--r--src/pool.c3
-rw-r--r--src/pool.h7
-rw-r--r--src/program.c11
-rw-r--r--src/program.h13
-rw-r--r--src/redbuild.cc11
-rw-r--r--src/redbuild.h10
-rw-r--r--src/redfsm.cc12
-rw-r--r--src/redfsm.h31
-rw-r--r--src/reduce.cc22
-rw-r--r--src/resolve.cc5
-rw-r--r--src/rtvector.h6
-rw-r--r--src/string.c9
-rw-r--r--src/struct.c9
-rw-r--r--src/struct.h3
-rw-r--r--src/synthesis.cc9
-rw-r--r--src/tree.c17
-rw-r--r--src/tree.h6
-rw-r--r--src/type.h3
77 files changed, 392 insertions, 434 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 00000000..e0ae0eef
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Peter Reijnders
diff --git a/src/buffer.h b/src/buffer.h
index 9039ad4b..744dc5d7 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _BUFFER_H
-#define _BUFFER_H
+#ifndef _COLM_BUFFER_H
+#define _COLM_BUFFER_H
#define BUFFER_INITIAL_SIZE 4096
@@ -52,4 +52,5 @@ struct Buffer
int length;
};
-#endif /* _BUFFER_H */
+#endif /* _COLM_BUFFER_H */
+
diff --git a/src/bytecode.c b/src/bytecode.c
index 4b77399e..43be340d 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -18,23 +18,20 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <colm/pdarun.h>
-#include <colm/tree.h>
#include <colm/bytecode.h>
-#include <colm/pool.h>
-#include <colm/debug.h>
-#include <colm/config.h>
-#include <colm/struct.h>
-#include <alloca.h>
-#include <sys/mman.h>
-#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include <assert.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <signal.h>
+#include <colm/pool.h>
+#include <colm/debug.h>
+
typedef struct colm_struct struct_t;
#define TRUE_VAL 1
@@ -44,9 +41,6 @@ typedef struct colm_struct struct_t;
#error "SIZEOF_LONG contained an unexpected value"
#endif
-#define true 1
-#define false 0
-
#define read_byte( i ) do { \
i = ((uchar) *instr++); \
} while(0)
diff --git a/src/bytecode.h b/src/bytecode.h
index bba463aa..6e4e143c 100644
--- a/src/bytecode.h
+++ b/src/bytecode.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _BYTECODE_H
-#define _BYTECODE_H
+#ifndef _COLM_BYTECODE_H
+#define _COLM_BYTECODE_H
#include <colm/pdarun.h>
#include <colm/type.h>
@@ -679,4 +679,5 @@ code_t *colm_pop_reverse_code( struct rt_code_vect *all_rev );
}
#endif
-#endif
+#endif /* _COLM_BYTECODE_H */
+
diff --git a/src/closure.cc b/src/closure.cc
index 5b368773..9f381be1 100644
--- a/src/closure.cc
+++ b/src/closure.cc
@@ -18,15 +18,13 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include "global.h"
-#include "compiler.h"
-
-#include "vector.h"
#include <assert.h>
-#include <string.h>
+#include <stdbool.h>
+
#include <iostream>
+#include "compiler.h"
+
using std::endl;
using std::cerr;
diff --git a/src/codegen.cc b/src/codegen.cc
index ecc45840..bbf9aeb3 100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -19,17 +19,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "compiler.h"
+#include <iostream>
#include "fsmcodegen.h"
-#include "redfsm.h"
-#include "bstmap.h"
-#include "debug.h"
-#include <sstream>
-#include <string>
void FsmCodeGen::writeIncludes()
{
out <<
+ "#include <stdio.h>\n"
+ "#include <stdlib.h>\n"
+ "#include <string.h>\n"
+ "#include <assert.h>\n"
+ "\n"
"#include <colm/pdarun.h>\n"
"#include <colm/debug.h>\n"
"#include <colm/bytecode.h>\n"
@@ -39,16 +39,9 @@ void FsmCodeGen::writeIncludes()
"#include <colm/tree.h>\n"
"#include <colm/program.h>\n"
"#include <colm/colm.h>\n"
- "\n"
- "#include <stdio.h>\n"
- "#include <stdlib.h>\n"
- "#include <string.h>\n"
- "#include <assert.h>\n"
- "\n"
"\n";
}
-
void FsmCodeGen::writeMain( long activeRealm )
{
out <<
diff --git a/src/codevect.c b/src/codevect.c
index 9f968f73..0b108ddb 100644
--- a/src/codevect.c
+++ b/src/codevect.c
@@ -18,14 +18,11 @@
* along with Aapl; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <colm/rtvector.h>
-#include <colm/pdarun.h>
-
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
+#include <colm/rtvector.h>
+#include <colm/pdarun.h>
void init_rt_code_vect( struct rt_code_vect *vect )
{
diff --git a/src/colm.h b/src/colm.h
index 4dd53656..b71ef0b3 100644
--- a/src/colm.h
+++ b/src/colm.h
@@ -1,5 +1,5 @@
-#ifndef __COLM_COLM_H
-#define __COLM_COLM_H
+#ifndef _COLM_COLM_H
+#define _COLM_COLM_H
#ifdef __cplusplus
extern "C" {
@@ -115,4 +115,5 @@ const char **colm_extract_fns( struct colm_program *prg );
}
#endif
-#endif
+#endif /* _COLM_COLM_H */
+
diff --git a/src/commit.c b/src/commit.c
index fbb07170..edf0f193 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -18,6 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
#include "config.h"
#include "debug.h"
@@ -25,18 +30,8 @@
#include "bytecode.h"
#include "tree.h"
#include "pool.h"
-
#include "internal.h"
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-//#define true 1
-//#define false 0
-
void commit_clear_kid_list( program_t *prg, tree_t **sp, kid_t *kid )
{
kid_t *next;
diff --git a/src/compiler.cc b/src/compiler.cc
index 808c6e95..e65a530e 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -18,27 +18,20 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "compiler.h"
-#include <iostream>
-#include <iomanip>
#include <errno.h>
#include <stdlib.h>
-#include <limits.h>
-#include <sstream>
+#include <string.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <assert.h>
+#include <iostream>
-#include "global.h"
-#include "avltree.h"
-#include "compiler.h"
-#include "parser.h"
-#include "parsetree.h"
-#include "mergesort.h"
#include "redbuild.h"
#include "pdacodegen.h"
#include "fsmcodegen.h"
-#include "pdarun.h"
#include "colm.h"
-#include "pool.h"
-#include "struct.h"
using std::ostringstream;
using std::cout;
diff --git a/src/compiler.h b/src/compiler.h
index 9a45793b..f77b6edc 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -19,27 +19,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _PARSEDATA_H
-#define _PARSEDATA_H
+#ifndef _COLM_PARSEDATA_H
+#define _COLM_PARSEDATA_H
-#include <iostream>
#include <limits.h>
-#include "bstset.h"
+
+#include <iostream>
+
+#include <avlmap.h>
+#include <avlset.h>
+#include <bstmap.h>
+#include <vector.h>
+#include <bstset.h>
+#include <dlist.h>
+#include <dlistmel.h>
+#include <fsmgraph.h>
+#include <compare.h>
+
#include "global.h"
-#include "avlmap.h"
-#include "avlset.h"
-#include "bstmap.h"
-#include "vector.h"
-#include "dlist.h"
-#include "dlistmel.h"
-#include "fsmgraph.h"
-#include "compare.h"
-#include "vector.h"
#include "keyops.h"
#include "parsetree.h"
#include "cstring.h"
#include "pdagraph.h"
-#include "compare.h"
#include "pdarun.h"
#include "bytecode.h"
#include "program.h"
@@ -1106,5 +1107,5 @@ ObjectMethod *initFunction( UniqueType *retType, Namespace *nspace, ObjectDef *o
UniqueType *arg1, UniqueType *arg2, bool isConst,
bool useFnInstr = false, GenericType *useGeneric = 0 );
+#endif /* _COLM_PARSEDATA_H */
-#endif /* _PARSEDATA_H */
diff --git a/src/consinit.cc b/src/consinit.cc
index 397b8ecd..f1e642aa 100644
--- a/src/consinit.cc
+++ b/src/consinit.cc
@@ -19,18 +19,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <iostream>
-#include <errno.h>
-
-#include "parser.h"
-#include "config.h"
-#include "avltree.h"
-#include "compiler.h"
-#include "parser.h"
-#include "global.h"
-#include "input.h"
#include "consinit.h"
+#include <iostream>
+
using std::cout;
using std::cerr;
using std::endl;
diff --git a/src/consinit.h b/src/consinit.h
index d62f72f1..88413c6a 100644
--- a/src/consinit.h
+++ b/src/consinit.h
@@ -20,10 +20,15 @@
*/
#include <iostream>
-#include "avltree.h"
+
+#include <avltree.h>
+
#include "compiler.h"
#include "parser.h"
+#ifndef _COLM_CONSINIT_H
+#define _COLM_CONSINIT_H
+
struct ConsInit
:
public BaseParser
@@ -100,4 +105,5 @@ struct ConsInit
virtual void go( long activeRealm );
};
+#endif /* _COLM_CONSINIT_H */
diff --git a/src/cstring.h b/src/cstring.h
index a59ebe36..8c563795 100644
--- a/src/cstring.h
+++ b/src/cstring.h
@@ -22,14 +22,15 @@
#ifndef _AAPL_ASTRING_H
#define _AAPL_ASTRING_H
-#include <new>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include <iostream>
#include <assert.h>
+#include <new>
+#include <iostream>
+
#include "tree.h"
struct colm_data;
@@ -852,10 +853,9 @@ template<class T> struct CmpStrTmpl
typedef CmpStrTmpl<char> CmpStr;
-
-
#ifdef AAPL_NAMESPACE
}
#endif
#endif /* _AAPL_ASTRING_H */
+
diff --git a/src/ctinput.cc b/src/ctinput.cc
index fbc67157..1ba4969f 100644
--- a/src/ctinput.cc
+++ b/src/ctinput.cc
@@ -18,15 +18,16 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <assert.h>
+
+#include <iostream>
#include "compiler.h"
-#include "parsetree.h"
-#include "input.h"
-#include "debug.h"
#include "pool.h"
-#include "pdacodegen.h"
-
-#include <iostream>
+//#include "debug.h"
using std::cerr;
using std::endl;
diff --git a/src/debug.c b/src/debug.c
index 21b7501c..426977ca 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -20,11 +20,13 @@
*/
#include <colm/debug.h>
-#include <colm/program.h>
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <colm/program.h>
+
const char *const colm_realm_names[REALMS] =
{
"BYTECODE",
diff --git a/src/debug.h b/src/debug.h
index 5a37b08c..4a221bde 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -19,6 +19,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef _COLM_DEBUG_H
+#define _COLM_DEBUG_H
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -58,3 +61,6 @@ extern const char *const colmRealmNames[REALMS];
#ifdef __cplusplus
}
#endif
+
+#endif /* _COLM_DEBUG_H */
+
diff --git a/src/declare.cc b/src/declare.cc
index 6ceffe9d..ef8d7454 100644
--- a/src/declare.cc
+++ b/src/declare.cc
@@ -18,11 +18,12 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdbool.h>
+#include <assert.h>
-#include "bytecode.h"
-#include "compiler.h"
#include <iostream>
-#include <assert.h>
+
+#include "compiler.h"
void Compiler::initUniqueTypes( )
{
diff --git a/src/dotgen.cc b/src/dotgen.cc
index aa407129..462d6788 100644
--- a/src/dotgen.cc
+++ b/src/dotgen.cc
@@ -18,14 +18,14 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdbool.h>
+#include <iostream>
-#include "global.h"
#include "compiler.h"
using namespace std;
-
void Compiler::writeTransList( PdaState *state )
{
ostream &out = *outStream;
diff --git a/src/dotgen.h b/src/dotgen.h
index d05a2410..ae256e98 100644
--- a/src/dotgen.h
+++ b/src/dotgen.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _GVDOTGEN_H
-#define _GVDOTGEN_H
+#ifndef _COLM_GVDOTGEN_H
+#define _COLM_GVDOTGEN_H
#include <iostream>
@@ -47,5 +47,5 @@ private:
#endif
+#endif /* _COLM_GVDOTGEN_H */
-#endif /* _GVDOTGEN_H */
diff --git a/src/exports.cc b/src/exports.cc
index b5b2f7a6..4ccc1870 100644
--- a/src/exports.cc
+++ b/src/exports.cc
@@ -18,14 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdbool.h>
+
+#include <iostream>
-#include "compiler.h"
#include "fsmcodegen.h"
-#include "redfsm.h"
-#include "bstmap.h"
-#include "debug.h"
-#include <sstream>
-#include <string>
using std::ostream;
using std::ostringstream;
diff --git a/src/fsmap.cc b/src/fsmap.cc
index cd955614..181fac4c 100644
--- a/src/fsmap.cc
+++ b/src/fsmap.cc
@@ -18,11 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <iostream>
+
+#include <assert.h>
-#include "config.h"
-#include "defs.h"
#include "fsmgraph.h"
-#include <iostream>
using std::cerr;
using std::endl;
diff --git a/src/fsmattach.cc b/src/fsmattach.cc
index a58ed9a4..323ee437 100644
--- a/src/fsmattach.cc
+++ b/src/fsmattach.cc
@@ -18,12 +18,12 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <string.h>
#include <assert.h>
-#include "fsmgraph.h"
#include <iostream>
+
+#include "fsmgraph.h"
+
using namespace std;
/* Insert a transition into an inlist. The head must be supplied. */
diff --git a/src/fsmbase.cc b/src/fsmbase.cc
index 90341039..d17849cb 100644
--- a/src/fsmbase.cc
+++ b/src/fsmbase.cc
@@ -18,9 +18,8 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <string.h>
#include <assert.h>
+
#include "fsmgraph.h"
/* Simple singly linked list append routine for the fill list. The new state
diff --git a/src/fsmcodegen.cc b/src/fsmcodegen.cc
index 75311bc5..40b8c60d 100644
--- a/src/fsmcodegen.cc
+++ b/src/fsmcodegen.cc
@@ -18,15 +18,14 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <assert.h>
+#include <string.h>
+#include <stdbool.h>
-#include "compiler.h"
-#include "fsmcodegen.h"
-#include "redfsm.h"
-#include "bstmap.h"
#include <sstream>
-#include <string>
-#include <assert.h>
+#include <iostream>
+#include "fsmcodegen.h"
using std::ostream;
using std::ostringstream;
@@ -34,7 +33,6 @@ using std::string;
using std::cerr;
using std::endl;
-
/* Init code gen with in parameters. */
FsmCodeGen::FsmCodeGen( ostream &out,
RedFsm *redFsm, fsm_tables *fsmTables )
diff --git a/src/fsmcodegen.h b/src/fsmcodegen.h
index f2672166..4de3979e 100644
--- a/src/fsmcodegen.h
+++ b/src/fsmcodegen.h
@@ -19,12 +19,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _FSMCODEGEN_H
-#define _FSMCODEGEN_H
+#ifndef _COLM_FSMCODEGEN_H
+#define _COLM_FSMCODEGEN_H
-#include <iostream>
-#include <string>
#include <stdio.h>
+
+#include <string>
+#include <iostream>
+
#include "keyops.h"
#include "compiler.h"
#include "redfsm.h"
@@ -203,4 +205,5 @@ protected:
void setLabelsNeeded();
};
-#endif /* _FSMCODEGEN_H */
+#endif /* _COLM_FSMCODEGEN_H */
+
diff --git a/src/fsmexec.cc b/src/fsmexec.cc
index 3b3d08f3..0a35f343 100644
--- a/src/fsmexec.cc
+++ b/src/fsmexec.cc
@@ -18,17 +18,12 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdbool.h>
-#include <string.h>
-#include <iostream>
+#include <assert.h>
-#include "config.h"
-#include "defs.h"
#include "redfsm.h"
#include "compiler.h"
-#include "parsetree.h"
-#include "pdarun.h"
-#include "global.h"
void execAction( struct pda_run *pdaRun, GenAction *genAction )
{
diff --git a/src/fsmgraph.cc b/src/fsmgraph.cc
index bf2d2446..f1685c20 100644
--- a/src/fsmgraph.cc
+++ b/src/fsmgraph.cc
@@ -18,14 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "fsmgraph.h"
#include <assert.h>
-#include <iostream>
-#include "config.h"
-#include "defs.h"
-#include "fsmgraph.h"
-#include "mergesort.h"
+#include <iostream>
using std::cerr;
using std::endl;
diff --git a/src/fsmgraph.h b/src/fsmgraph.h
index 9a0f2aea..22c50678 100644
--- a/src/fsmgraph.h
+++ b/src/fsmgraph.h
@@ -19,22 +19,24 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _FSMGRAPH_H
-#define _FSMGRAPH_H
+#ifndef _COLM_FSMGRAPH_H
+#define _COLM_FSMGRAPH_H
#include <assert.h>
+
+#include <avltree.h>
+#include <avlmap.h>
+#include <avlset.h>
+#include <bstmap.h>
+#include <vector.h>
+#include <sbstmap.h>
+#include <sbstset.h>
+#include <sbsttable.h>
+#include <bstset.h>
+#include <compare.h>
+#include <dlist.h>
+
#include "keyops.h"
-#include "vector.h"
-#include "bstset.h"
-#include "compare.h"
-#include "avltree.h"
-#include "dlist.h"
-#include "bstmap.h"
-#include "sbstmap.h"
-#include "sbstset.h"
-#include "sbsttable.h"
-#include "avlset.h"
-#include "avlmap.h"
/* Flags that control merging. */
#define SB_GRAPH1 0x01
@@ -1314,4 +1316,5 @@ struct FsmGraph
};
-#endif /* _FSMGRAPH_H */
+#endif /* _COLM_FSMGRAPH_H */
+
diff --git a/src/fsmmin.cc b/src/fsmmin.cc
index cbb2b99f..f4875861 100644
--- a/src/fsmmin.cc
+++ b/src/fsmmin.cc
@@ -18,9 +18,12 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdbool.h>
+#include <assert.h>
+
+#include <mergesort.h>
#include "fsmgraph.h"
-#include "mergesort.h"
int FsmGraph::partitionRound( FsmState **statePtrs, MinPartition *parts, int numParts )
{
diff --git a/src/fsmstate.cc b/src/fsmstate.cc
index f917302e..6c22e953 100644
--- a/src/fsmstate.cc
+++ b/src/fsmstate.cc
@@ -18,12 +18,14 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#include <string.h>
#include <assert.h>
-#include "fsmgraph.h"
+#include <stdbool.h>
#include <iostream>
+
+#include "fsmgraph.h"
+
using namespace std;
/* Construct a mark index for a specified number of states. Must new up
diff --git a/src/global.h b/src/global.h
index 1c74880f..ef7b5e95 100644
--- a/src/global.h
+++ b/src/global.h
@@ -19,18 +19,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __COLM_GLOBAL_H
-#define __COLM_GLOBAL_H
+#ifndef _COLM_GLOBAL_H
+#define _COLM_GLOBAL_H
#include <stdio.h>
+
#include <iostream>
#include <fstream>
#include <fstream>
#include <string>
+#include <avltree.h>
+
#include "config.h"
#include "defs.h"
-#include "avltree.h"
#include "keyops.h"
#define PROGNAME "colm"
@@ -103,4 +105,5 @@ void openOutput();
void escapeLiteralString( std::ostream &out, const char *data );
bool readCheck( const char *fn );
-#endif
+#endif /* _COLM_GLOBAL_H */
+
diff --git a/src/input.c b/src/input.c
index 8432ca08..fcf9a315 100644
--- a/src/input.c
+++ b/src/input.c
@@ -20,13 +20,6 @@
*/
#include <colm/input.h>
-#include <colm/pdarun.h>
-#include <colm/debug.h>
-#include <colm/program.h>
-#include <colm/tree.h>
-#include <colm/bytecode.h>
-#include <colm/pool.h>
-#include <colm/struct.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,6 +28,14 @@
#include <unistd.h>
#include <stdbool.h>
+#include <colm/pdarun.h>
+#include <colm/debug.h>
+#include <colm/program.h>
+#include <colm/tree.h>
+#include <colm/bytecode.h>
+#include <colm/pool.h>
+#include <colm/struct.h>
+
char *colm_filename_add( program_t *prg, const char *fn )
{
/* Search for it. */
diff --git a/src/input.h b/src/input.h
index cc1686e7..5cbe6076 100644
--- a/src/input.h
+++ b/src/input.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _INPUT_H
-#define _INPUT_H
+#ifndef _COLM_INPUT_H
+#define _COLM_INPUT_H
#include <stdio.h>
@@ -173,4 +173,5 @@ struct colm_stream *colm_stream_open_collect( struct colm_program *prg );
}
#endif
-#endif /* _INPUT_H */
+#endif /* _COLM_INPUT_H */
+
diff --git a/src/internal.h b/src/internal.h
index c809e4f3..e394e9ae 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -1,5 +1,5 @@
-#ifndef _COLM_INTERNAL
-#define _COLM_INTERNAL
+#ifndef _COLM_INTERNAL_H
+#define _COLM_INTERNAL_H
#include "colm.h"
@@ -7,4 +7,5 @@ typedef struct colm_struct struct_t;
typedef struct colm_program program_t;
typedef unsigned long value_t;
-#endif
+#endif /* _COLM_INTERNAL_H */
+
diff --git a/src/iter.c b/src/iter.c
index 368dce26..6af3cd08 100644
--- a/src/iter.c
+++ b/src/iter.c
@@ -18,15 +18,14 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <assert.h>
+#include <stdbool.h>
#include <colm/tree.h>
#include <colm/bytecode.h>
#include <colm/program.h>
-#include <assert.h>
-#include "internal.h"
-#define true 1
-#define false 0
+#include "internal.h"
void colm_init_list_iter( generic_iter_t *list_iter, tree_t **stack_root,
long arg_size, long root_size, const ref_t *root_ref, int generic_id )
diff --git a/src/keyops.h b/src/keyops.h
index a79881e7..49c95e8e 100644
--- a/src/keyops.h
+++ b/src/keyops.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _KEYOPS_H
-#define _KEYOPS_H
+#ifndef _COLM_KEYOPS_H
+#define _COLM_KEYOPS_H
#include <fstream>
#include <climits>
@@ -193,4 +193,5 @@ inline Key operator-(const Key key1, const Key key2)
const char *findFileExtension( const char *stemFile );
char *fileNameFromStem( const char *stemFile, const char *suffix );
-#endif /* _KEYOPS_H */
+#endif /* _COLM_KEYOPS_H */
+
diff --git a/src/list.c b/src/list.c
index 55a0ce0e..71f1280b 100644
--- a/src/list.c
+++ b/src/list.c
@@ -18,14 +18,14 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
#include <colm/pdarun.h>
#include <colm/program.h>
#include <colm/struct.h>
#include <colm/bytecode.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
static void colm_list_add_after( list_t *list, list_el_t *prev_el, list_el_t *new_el );
static void colm_list_add_before( list_t *list, list_el_t *next_el, list_el_t *new_el);
diff --git a/src/loadcolm.cc b/src/loadcolm.cc
index 20fb02ee..699bed4b 100644
--- a/src/loadcolm.cc
+++ b/src/loadcolm.cc
@@ -19,19 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdbool.h>
+#include <string.h>
#include <iostream>
-#include <errno.h>
-
-#include "parser.h"
-#include "config.h"
-#include "avltree.h"
-#include "compiler.h"
-#include "parser.h"
-#include "global.h"
-#include "input.h"
+
#include "loadcolm.h"
#include "gen/if2.h"
-#include "colm/colm.h"
extern colm_sections colm_object;
diff --git a/src/loadcolm.h b/src/loadcolm.h
index bfc0589f..4f6f8f78 100644
--- a/src/loadcolm.h
+++ b/src/loadcolm.h
@@ -19,6 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef _COLM_LOADCOLM_H
+#define _COLM_LOADCOLM_H
+
#include "parser.h"
BaseParser *consLoadColm( Compiler *pd, const char *inputFileName );
+
+#endif /* _COLM_LOADCOLM_H */
+
diff --git a/src/loadinit.cc b/src/loadinit.cc
index 695f8751..b8287087 100644
--- a/src/loadinit.cc
+++ b/src/loadinit.cc
@@ -18,21 +18,13 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "loadinit.h"
+
+#include <string.h>
#include <iostream>
-#include <string>
-#include <errno.h>
-
-#include "parser.h"
-#include "config.h"
-#include "avltree.h"
-#include "compiler.h"
-#include "parser.h"
-#include "global.h"
-#include "input.h"
-#include "loadinit.h"
+
#include "gen/if1.h"
-#include "colm/colm.h"
using std::string;
diff --git a/src/loadinit.h b/src/loadinit.h
index 34c901b5..7cdfd18e 100644
--- a/src/loadinit.h
+++ b/src/loadinit.h
@@ -19,8 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef _COLM_LOADINIT_H
+#define _COLM_LOADINIT_H
+
#include <iostream>
-#include "avltree.h"
+
+#include <avltree.h>
+
#include "compiler.h"
#include "parser.h"
@@ -66,3 +71,6 @@ struct LoadInit
virtual void go( long activeRealm );
};
+
+#endif /* _COLM_LOAD_INIT_H */
+
diff --git a/src/lookup.cc b/src/lookup.cc
index c5155bdb..62ff5406 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -18,12 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include "bytecode.h"
-#include "compiler.h"
+#include <assert.h>
#include <iostream>
-#include <assert.h>
+
+#include "compiler.h"
using std::cout;
using std::cerr;
diff --git a/src/main.cc b/src/main.cc
index 77d29c82..c924f7ba 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -19,28 +19,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <stdio.h>
-#include <iostream>
-#include <fstream>
-#include <unistd.h>
-#include <sstream>
+#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
+#include <iostream>
-#include "global.h"
#include "debug.h"
#include "pcheck.h"
-#include "vector.h"
#include "version.h"
-#include "keyops.h"
#include "compiler.h"
-#include "vector.h"
-#include "version.h"
-#include "fsmcodegen.h"
-#include "colm.h"
#if defined(CONS_INIT)
#include "consinit.h"
diff --git a/src/map.c b/src/map.c
index 88665323..5f6ac055 100644
--- a/src/map.c
+++ b/src/map.c
@@ -18,16 +18,15 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <colm/map.h>
#include <assert.h>
+#include <stdbool.h>
+
#include <colm/pdarun.h>
-#include <colm/map.h>
#include <colm/pool.h>
#include <colm/bytecode.h>
-#define true 1
-#define false 0
-
struct colm_struct *colm_map_el_get( struct colm_program *prg,
map_el_t *map_el, word_t gen_id, word_t field )
{
diff --git a/src/map.h b/src/map.h
index 737a4de7..a99e6a44 100644
--- a/src/map.h
+++ b/src/map.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _MAP_H
-#define _MAP_H
+#ifndef _COLM_MAP_H
+#define _COLM_MAP_H
#if defined(__cplusplus)
extern "C" {
@@ -28,6 +28,7 @@ extern "C" {
#include <colm/program.h>
#include <colm/struct.h>
+
#include "internal.h"
void map_list_abandon( map_t *map );
@@ -80,5 +81,5 @@ tree_t *colm_vmap_find( program_t *prg, map_t *map, tree_t *key );
}
#endif
-#endif
+#endif /* _COLM_MAP_H */
diff --git a/src/parser.cc b/src/parser.cc
index 90d71f59..d85b4793 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -18,17 +18,13 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "parser.h"
-#include <iostream>
+#include <stdbool.h>
+#include <stdlib.h>
#include <errno.h>
-#include "parser.h"
-#include "config.h"
-#include "avltree.h"
-#include "compiler.h"
-#include "parser.h"
-#include "global.h"
-#include "input.h"
+#include <iostream>
using std::endl;
diff --git a/src/parser.h b/src/parser.h
index 5a0e31cc..00df2fc7 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -19,11 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PARSER_H
-#define PARSER_H
+#ifndef _COLM_PARSER_H
+#define _COLM_PARSER_H
#include <iostream>
-#include "avltree.h"
+
+#include <avltree.h>
+
#include "compiler.h"
#include "parser.h"
@@ -186,4 +188,5 @@ struct BaseParser
};
-#endif
+#endif /* _COLM_PARSER_H */
+
diff --git a/src/parsetree.cc b/src/parsetree.cc
index 797d2dc9..6f6e2480 100644
--- a/src/parsetree.cc
+++ b/src/parsetree.cc
@@ -18,19 +18,14 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include "avltree.h"
-#include "compiler.h"
-#include "parser.h"
-#include "parsetree.h"
-#include "input.h"
+#include <assert.h>
+#include <stdbool.h>
#include <iostream>
-#include <iomanip>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
+#include "fsmgraph.h"
+#include "compiler.h"
+#include "parsetree.h"
using namespace std;
ostream &operator<<( ostream &out, const NameRef &nameRef );
diff --git a/src/parsetree.h b/src/parsetree.h
index 34ce3e3c..d9724251 100644
--- a/src/parsetree.h
+++ b/src/parsetree.h
@@ -19,24 +19,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _PARSETREE_H
-#define _PARSETREE_H
+#ifndef _COLM_PARSETREE_H
+#define _COLM_PARSETREE_H
#include <iostream>
#include <string.h>
#include <string>
+#include <avlbasic.h>
+#include <avlmap.h>
+#include <bstmap.h>
+#include <bstset.h>
+#include <vector.h>
+#include <dlist.h>
+#include <dlistval.h>
+#include <dlistmel.h>
+
#include "global.h"
-#include "avlmap.h"
-#include "bstmap.h"
-#include "bstset.h"
-#include "vector.h"
-#include "dlist.h"
-#include "dlistval.h"
-#include "dlistmel.h"
#include "cstring.h"
#include "bytecode.h"
-#include "avlbasic.h"
+
/* Operators that are represented with single symbol characters. */
#define OP_DoubleEql 'e'
@@ -3529,4 +3531,5 @@ struct Function
typedef DList<Function> FunctionList;
-#endif /* _PARSETREE_H */
+#endif /* _COLM_PARSETREE_H */
+
diff --git a/src/pcheck.cc b/src/pcheck.cc
index d5401f7d..0f3e8774 100644
--- a/src/pcheck.cc
+++ b/src/pcheck.cc
@@ -18,9 +18,9 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#include "pcheck.h"
-#include <assert.h>
+
+#include <stdbool.h>
/* Construct a new parameter checker with for paramSpec. */
ParamCheck::ParamCheck( const char *paramSpec, int argc, const char **argv )
diff --git a/src/pcheck.h b/src/pcheck.h
index 5be60426..a6a36925 100644
--- a/src/pcheck.h
+++ b/src/pcheck.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _PCHECK_H
-#define _PCHECK_H
+#ifndef _COLM_PCHECK_H
+#define _COLM_PCHECK_H
class ParamCheck
{
@@ -45,4 +45,5 @@ private:
const char **argv;
};
-#endif /* _PCHECK_H */
+#endif /* _COLM_PCHECK_H */
+
diff --git a/src/pdabuild.cc b/src/pdabuild.cc
index 9ba17f43..8b8be749 100644
--- a/src/pdabuild.cc
+++ b/src/pdabuild.cc
@@ -18,25 +18,21 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#define EOF_REGION 0
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <assert.h>
+
#include <iostream>
-#include <iomanip>
-#include <errno.h>
-#include <stdlib.h>
+
+/* Dumping the fsm. */
+#include <mergesort.h>
/* Parsing. */
-#include "global.h"
#include "compiler.h"
#include "pdacodegen.h"
-#include "pdarun.h"
-#include "redfsm.h"
-#include "fsmcodegen.h"
-#include "redbuild.h"
-
-/* Dumping the fsm. */
-#include "mergesort.h"
using std::endl;
using std::cerr;
diff --git a/src/pdacodegen.cc b/src/pdacodegen.cc
index 4de05161..58c3aaf8 100644
--- a/src/pdacodegen.cc
+++ b/src/pdacodegen.cc
@@ -18,17 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <string.h>
#include <iostream>
-#include <stdlib.h>
-#include <ctype.h>
-#include <limits.h>
-#include "global.h"
+
#include "compiler.h"
-#include "avlmap.h"
-#include "avlbasic.h"
-#include "avlset.h"
-#include "mergesort.h"
#include "pdacodegen.h"
using std::cerr;
diff --git a/src/pdacodegen.h b/src/pdacodegen.h
index b6031873..3d6f8773 100644
--- a/src/pdacodegen.h
+++ b/src/pdacodegen.h
@@ -20,8 +20,8 @@
*/
-#ifndef _PDACODEGEN_H
-#define _PDACODEGEN_H
+#ifndef _COLM_PDACODEGEN_H
+#define _COLM_PDACODEGEN_H
struct Compiler;
@@ -103,4 +103,5 @@ extern "C"
void internalPopBinding( struct pda_run *pdaRun, parse_tree_t *parseTree );
}
-#endif
+#endif /* _COLM_PDACODEGEN_H */
+
diff --git a/src/pdagraph.cc b/src/pdagraph.cc
index 8f17b7a5..829203c8 100644
--- a/src/pdagraph.cc
+++ b/src/pdagraph.cc
@@ -18,14 +18,12 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "pdagraph.h"
-#include <string.h>
-#include <iostream>
-#include <string.h>
#include <assert.h>
-#include "global.h"
-#include "pdagraph.h"
-#include "mergesort.h"
+#include <stdbool.h>
+
+#include <iostream>
using std::cerr;
using std::endl;
diff --git a/src/pdagraph.h b/src/pdagraph.h
index af6eb3d5..ddcca06a 100644
--- a/src/pdagraph.h
+++ b/src/pdagraph.h
@@ -19,22 +19,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _PDAGRAPH_H
-#define _PDAGRAPH_H
+#ifndef _COLM_PDAGRAPH_H
+#define _COLM_PDAGRAPH_H
#include <assert.h>
-#include "vector.h"
-#include "bstset.h"
-#include "compare.h"
-#include "avltree.h"
-#include "dlist.h"
-#include "bstmap.h"
-#include "sbstmap.h"
-#include "sbstset.h"
-#include "sbsttable.h"
-#include "avlset.h"
-#include "dlistmel.h"
-#include "avltree.h"
+
+#include <avltree.h>
+#include <bstmap.h>
+#include <vector.h>
+#include <sbstmap.h>
+#include <sbstset.h>
+#include <sbsttable.h>
+#include <bstset.h>
+#include <compare.h>
+#include <avltree.h>
+#include <dlist.h>
+#include <avlset.h>
+#include <dlistmel.h>
/* Flags for states. */
#define SB_ISFINAL 0x04
@@ -511,5 +512,5 @@ struct PdaGraph
PdaActionSet actionSet;
};
+#endif /* _COLM_PDAGRAPH_H */
-#endif /* _FSMGRAPH_H */
diff --git a/src/pdarun.c b/src/pdarun.c
index 9379ecb3..a925bc6f 100644
--- a/src/pdarun.c
+++ b/src/pdarun.c
@@ -18,25 +18,21 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-
-#include "config.h"
-#include "debug.h"
#include "pdarun.h"
-#include "bytecode.h"
-#include "tree.h"
-#include "pool.h"
-
-#include "internal.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <assert.h>
-#define true 1
-#define false 0
+#include "config.h"
+#include "debug.h"
+#include "bytecode.h"
+#include "tree.h"
+#include "pool.h"
+#include "internal.h"
#define act_sb 0x1
#define act_rb 0x2
diff --git a/src/pdarun.h b/src/pdarun.h
index a5427576..9922e7e4 100644
--- a/src/pdarun.h
+++ b/src/pdarun.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __COLM_PDARUN_H
-#define __COLM_PDARUN_H
+#ifndef _COLM_PDARUN_H
+#define _COLM_PDARUN_H
#include <colm/input.h>
#include <colm/defs.h>
@@ -471,4 +471,5 @@ void commit_reduce( program_t *prg, tree_t **root,
}
#endif
-#endif
+#endif /* _COLM_PDRUN_H */
+
diff --git a/src/pool.c b/src/pool.c
index 916a50c8..d6412119 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -18,12 +18,13 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <colm/pool.h>
+#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <colm/pdarun.h>
-#include <colm/pool.h>
#include <colm/debug.h>
void init_pool_alloc( struct pool_alloc *pool_alloc, int sizeofT )
diff --git a/src/pool.h b/src/pool.h
index ec098aca..8f0b6abc 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _POOL_H
-#define _POOL_H
+#ifndef _COLM_POOL_H
+#define _COLM_POOL_H
/* Allocation, number of items. */
#define FRESH_BLOCK 8128
@@ -68,4 +68,5 @@ long pool_alloc_num_lost( struct pool_alloc *pool_alloc );
}
#endif
-#endif
+#endif /* _COLM_POOL_H */
+
diff --git a/src/program.c b/src/program.c
index f3071866..98114eb0 100644
--- a/src/program.c
+++ b/src/program.c
@@ -18,6 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <alloca.h>
+#include <sys/mman.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
#include <colm/pdarun.h>
#include <colm/tree.h>
@@ -27,12 +32,6 @@
#include <colm/config.h>
#include <colm/struct.h>
-#include <alloca.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-
#define VM_STACK_SIZE (8192)
static void colm_alloc_global( program_t *prg )
diff --git a/src/program.h b/src/program.h
index fa80b6bc..35696939 100644
--- a/src/program.h
+++ b/src/program.h
@@ -19,8 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __COLM_PROGRAM_H
-#define __COLM_PROGRAM_H
+#ifndef _COLM_PROGRAM_H
+#define _COLM_PROGRAM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <colm/pdarun.h>
@@ -164,4 +168,9 @@ struct colm_program
const char **stream_fns;
};
+#ifdef __cplusplus
+}
#endif
+
+#endif /* _COLM_PROGRAM_H */
+
diff --git a/src/redbuild.cc b/src/redbuild.cc
index 257bc929..481cd250 100644
--- a/src/redbuild.cc
+++ b/src/redbuild.cc
@@ -18,14 +18,15 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "redbuild.h"
+#include <assert.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include <iostream>
-#include "global.h"
-#include "redbuild.h"
-#include "fsmgraph.h"
-#include "redfsm.h"
#include "fsmcodegen.h"
-#include <string.h>
using namespace std;
diff --git a/src/redbuild.h b/src/redbuild.h
index 5cadef16..ddef667d 100644
--- a/src/redbuild.h
+++ b/src/redbuild.h
@@ -19,11 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _FSMREDUCE_H
-#define _FSMREDUCE_H
+#ifndef _COLM_FSMREDUCE_H
+#define _COLM_FSMREDUCE_H
#include <iostream>
-#include "avltree.h"
+
+#include <avltree.h>
+
#include "fsmgraph.h"
#include "compiler.h"
@@ -154,5 +156,5 @@ private:
int curStateCond;
};
+#endif /* _COLM_FSMREDUCE_H */
-#endif /* _FSMREDUCE_H */
diff --git a/src/redfsm.cc b/src/redfsm.cc
index 17ca9ac3..68251ed5 100644
--- a/src/redfsm.cc
+++ b/src/redfsm.cc
@@ -18,12 +18,16 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "redfsm.h"
+
+#include <assert.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdio.h>
-#include <iostream>
#include <sstream>
-#include "redfsm.h"
-#include "avlmap.h"
-#include "mergesort.h"
+#include <iostream>
+
#include "fsmgraph.h"
#include "parsetree.h"
diff --git a/src/redfsm.h b/src/redfsm.h
index c79576a1..be36548d 100644
--- a/src/redfsm.h
+++ b/src/redfsm.h
@@ -19,25 +19,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _REDFSM_H
-#define _REDFSM_H
+#ifndef _COLM_REDFSM_H
+#define _COLM_REDFSM_H
#include <assert.h>
#include <string.h>
+
#include <string>
+
+#include <avlbasic.h>
+#include <avltree.h>
+#include <avlmap.h>
+#include <bstmap.h>
+#include <vector.h>
+#include <dlist.h>
+#include <bstset.h>
+#include <mergesort.h>
+#include <sbstmap.h>
+#include <sbstset.h>
+#include <sbsttable.h>
+
#include "keyops.h"
-#include "vector.h"
-#include "dlist.h"
#include "compare.h"
-#include "bstmap.h"
-#include "bstset.h"
-#include "avlmap.h"
-#include "avltree.h"
-#include "avlbasic.h"
-#include "mergesort.h"
-#include "sbstmap.h"
-#include "sbstset.h"
-#include "sbsttable.h"
#include "global.h"
#include "pdarun.h"
@@ -471,5 +474,5 @@ struct RedFsm
fsm_tables *makeFsmTables();
};
+#endif /* _COLM_REDFSM_H */
-#endif /* _REDFSM_H */
diff --git a/src/reduce.cc b/src/reduce.cc
index 3e0c042b..d4eb5fb8 100644
--- a/src/reduce.cc
+++ b/src/reduce.cc
@@ -19,26 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <string.h>
+#include <stdbool.h>
+
#include <iostream>
-#include <iomanip>
-#include <errno.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <sstream>
-
-#include "global.h"
-#include "avltree.h"
-#include "compiler.h"
-#include "parser.h"
-#include "parsetree.h"
-#include "mergesort.h"
-#include "redbuild.h"
-#include "pdacodegen.h"
+
#include "fsmcodegen.h"
-#include "pdarun.h"
-#include "colm.h"
-#include "pool.h"
-#include "struct.h"
void Compiler::writeCommitStub()
{
diff --git a/src/resolve.cc b/src/resolve.cc
index f451bd29..c3c43f53 100644
--- a/src/resolve.cc
+++ b/src/resolve.cc
@@ -18,12 +18,11 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdbool.h>
-#include "bytecode.h"
-#include "compiler.h"
#include <iostream>
-#include <assert.h>
+#include "compiler.h"
/*
* Type Resolution.
*/
diff --git a/src/rtvector.h b/src/rtvector.h
index e03a17f9..10a00269 100644
--- a/src/rtvector.h
+++ b/src/rtvector.h
@@ -19,8 +19,8 @@
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _RT_VECTOR_H
-#define _RT_VECTOR_H
+#ifndef _COLM_RTVECTOR_H
+#define _COLM_RTVECTOR_H
#ifdef __cplusplus
extern "C" {
@@ -30,5 +30,5 @@ extern "C" {
}
#endif
-#endif
+#endif /* _COLM_RT_VECTOR_H */
diff --git a/src/string.c b/src/string.c
index 2a1c5674..ff9e0812 100644
--- a/src/string.c
+++ b/src/string.c
@@ -18,17 +18,16 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <colm/pool.h>
-#include <colm/pdarun.h>
-#include <colm/bytecode.h>
-
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <colm/pool.h>
+#include <colm/pdarun.h>
+#include <colm/bytecode.h>
+
str_t *string_prefix( program_t *prg, str_t *str, long len )
{
head_t *head = string_alloc_full( prg, str->value->data, len );
diff --git a/src/struct.c b/src/struct.c
index cd614afd..802c1ee6 100644
--- a/src/struct.c
+++ b/src/struct.c
@@ -1,14 +1,13 @@
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+
#include <colm/program.h>
#include <colm/struct.h>
#include "internal.h"
#include "bytecode.h"
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdbool.h>
-
struct colm_tree *colm_get_global( program_t *prg, long pos )
{
return colm_struct_get_field( prg->global, tree_t*, pos );
diff --git a/src/struct.h b/src/struct.h
index 0bb10cd3..f1b24239 100644
--- a/src/struct.h
+++ b/src/struct.h
@@ -157,4 +157,5 @@ struct colm_struct *colm_construct_reducer( struct colm_program *prg, long gener
}
#endif
-#endif
+#endif /* _COLM_STRUCT_H */
+
diff --git a/src/synthesis.cc b/src/synthesis.cc
index bda6aece..7e7d4412 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -18,13 +18,12 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <assert.h>
+#include <stdbool.h>
-#include "bytecode.h"
-#include "compiler.h"
-#include "pdarun.h"
-#include "input.h"
#include <iostream>
-#include <assert.h>
+
+#include "compiler.h"
using std::cout;
using std::cerr;
diff --git a/src/tree.c b/src/tree.c
index 2f81e104..baf97921 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -18,24 +18,17 @@
* along with Colm; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <colm/pdarun.h>
-#include <colm/tree.h>
-#include <colm/pool.h>
-#include <colm/bytecode.h>
-#include <colm/debug.h>
-#include <colm/map.h>
-#include <colm/struct.h>
-
#include <string.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
-#include <errno.h>
-#define true 1
-#define false 0
+#include <colm/tree.h>
+#include <colm/pool.h>
+#include <colm/bytecode.h>
+#include <colm/debug.h>
#define BUFFER_INITIAL_SIZE 4096
diff --git a/src/tree.h b/src/tree.h
index ef714175..825d12a3 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __COLM_TREE_H
-#define __COLM_TREE_H
+#ifndef _COLM_TREE_H
+#define _COLM_TREE_H
#if defined(__cplusplus)
extern "C" {
@@ -374,5 +374,5 @@ tree_t *construct_string( struct colm_program *prg, head_t *s );
}
#endif
-#endif
+#endif /* COLM_TREE_H */
diff --git a/src/type.h b/src/type.h
index cfd4612b..482d9ed4 100644
--- a/src/type.h
+++ b/src/type.h
@@ -20,4 +20,5 @@ enum TYPE
TYPE_MAP_PTRS = 0x0a,
};
-#endif
+#endif /* _COLM_TYPE_H */
+