]> granicus.if.org Git - yasm/commitdiff
Add coretype.h, make util.h do a lot more, use util.h to simplify include
authorPeter Johnson <peter@tortall.net>
Sat, 3 Nov 2001 05:17:51 +0000 (05:17 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 3 Nov 2001 05:17:51 +0000 (05:17 -0000)
sections of C files.  Also remove IdPath from top comment in files where
RCSID() is used.  Move RCSID() to immediately after util.h include.

svn path=/trunk/yasm/; revision=313

94 files changed:
frontends/yasm/yasm-options.c
frontends/yasm/yasm.c
libyasm/bitvect.c
libyasm/bytecode.c
libyasm/bytecode.h
libyasm/coretype.h [new file with mode: 0644]
libyasm/errwarn.c
libyasm/expr.c
libyasm/expr.h
libyasm/file.c
libyasm/floatnum.c
libyasm/floatnum.h
libyasm/intnum.c
libyasm/intnum.h
libyasm/linemgr.c
libyasm/mergesort.c
libyasm/objfmt.h
libyasm/optimizer.h
libyasm/parser.h
libyasm/preproc.h
libyasm/section.c
libyasm/section.h
libyasm/strcasecmp.c
libyasm/strsep.c
libyasm/symrec.c
libyasm/symrec.h
libyasm/tests/memexpr_test.c
libyasm/util.h
libyasm/xmalloc.c
libyasm/xstrdup.c
mergesort.c
modules/arch/x86/expr.c
modules/arch/x86/x86expr.c
modules/objfmts/dbg/dbg-objfmt.c
modules/objfmts/dbg/objfmt.c
modules/optimizers/basic/basic-optimizer.c
modules/optimizers/basic/optimizer.c
modules/optimizers/dbg/optimizer.c
modules/parsers/nasm/bison.y.in
modules/parsers/nasm/nasm-bison.y
modules/parsers/nasm/nasm-parser.c
modules/parsers/nasm/parser.c
modules/parsers/nasm/token.l.in
modules/preprocs/raw/preproc.c
modules/preprocs/raw/raw-preproc.c
src/arch/x86/expr.c
src/arch/x86/x86expr.c
src/bitvect.c
src/bytecode.c
src/bytecode.h
src/coretype.h [new file with mode: 0644]
src/errwarn.c
src/expr.c
src/expr.h
src/file.c
src/floatnum.c
src/floatnum.h
src/globals.c
src/intnum.c
src/intnum.h
src/linemgr.c
src/main.c
src/mergesort.c
src/objfmt.h
src/objfmts/dbg/dbg-objfmt.c
src/objfmts/dbg/objfmt.c
src/optimizer.h
src/optimizers/basic/basic-optimizer.c
src/optimizers/basic/optimizer.c
src/optimizers/dbg/optimizer.c
src/options.c
src/parser.c
src/parser.h
src/parsers/nasm/bison.y.in
src/parsers/nasm/nasm-bison.y
src/parsers/nasm/nasm-parser.c
src/parsers/nasm/parser.c
src/parsers/nasm/token.l.in
src/preproc.h
src/preprocs/raw/preproc.c
src/preprocs/raw/raw-preproc.c
src/section.c
src/section.h
src/strcasecmp.c
src/strsep.c
src/symrec.c
src/symrec.h
src/ternary.c
src/tests/memexpr_test.c
src/util.h
src/xmalloc.c
src/xstrdup.c
strsep.c
util.h

index efe7882e1eb0612e0104c6a1ac463e46568fcec0..5eef8b2453e067643b2175b4bd15c869ebc9a6db 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Generic Options Support Header File
  *
  * Copyright (c) 2001  Stanislav Karchebny <berk@madfire.net>
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)       gettext(String)
-#ifdef gettext_noop
-#define N_(String)      gettext_noop(String)
-#else
-#define N_(String)      (String)
-#endif
+RCSID("$IdPath$");
 
 #include "options.h"
 #include "errwarn.h"
index 45e76049ca6e8d9c77f64261562876e0ed093e54..0b4d711f9803e7446390b227b9defa020e734c95 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Program entry point, command line parsing
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
 #ifdef gettext_noop
 #define N_(String)     gettext_noop(String)
 #else
 #include "preproc.h"
 #include "parser.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #ifndef countof
 #define countof(x,y)   (sizeof(x)/sizeof(y))
index cedec92428093487c20f1bc714ace139d4227f2f..6ed5d1894fc8a3cfb68e1428b9e066ab5cc71297 100644 (file)
@@ -1,30 +1,21 @@
-/* $IdPath$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 /*****************************************************************************/
 /*  MODULE NAME:  BitVector.c                           MODULE TYPE:  (adt)  */
 /*****************************************************************************/
 /*  MODULE IMPORTS:                                                          */
 /*****************************************************************************/
+#include <ctype.h>                                  /*  MODULE TYPE:  (sys)  */
 #ifdef STDC_HEADERS
 #include <limits.h>                                 /*  MODULE TYPE:  (sys)  */
 #include <string.h>                                 /*  MODULE TYPE:  (sys)  */
-#include <ctype.h>                                  /*  MODULE TYPE:  (sys)  */
 #endif
 /*****************************************************************************/
 /*  MODULE INTERFACE:                                                        */
 /*****************************************************************************/
 #include "bitvect.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* ToolBox.h */
 #define and         &&      /* logical (boolean) operators: lower case */
index 6db2d777f9661b36a8103e39bb41a93ae1319ab5..407f01eccf51b19d3f92370cac0214f903b73615 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Bytecode utility functions
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "globals.h"
 #include "errwarn.h"
 #include "intnum.h"
-#include "floatnum.h"
 #include "expr.h"
 
 #include "bytecode.h"
-#include "section.h"
-
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
 
-RCSID("$IdPath$");
 
 struct effaddr {
     expr *disp;                        /* address displacement */
index d2cd383cc43b239777db633c9c61b3f89d5c7a41..3683bae9eae169385378818edef3e721867f8d24 100644 (file)
 #ifndef YASM_BYTECODE_H
 #define YASM_BYTECODE_H
 
-#ifndef YASM_SECTION
-#define YASM_SECTION
-typedef struct section section;
-#endif
-
-#ifndef YASM_EXPR
-#define YASM_EXPR
-typedef struct expr expr;
-#endif
-
-#ifndef YASM_FLOATNUM
-#define YASM_FLOATNUM
-typedef struct floatnum floatnum;
-#endif
-
 typedef struct effaddr effaddr;
 typedef struct immval immval;
 typedef STAILQ_HEAD(datavalhead, dataval) datavalhead;
 typedef struct dataval dataval;
-typedef STAILQ_HEAD(bytecodehead, bytecode) bytecodehead;
-
-#ifndef YASM_BYTECODE
-#define YASM_BYTECODE
-typedef struct bytecode bytecode;
-#endif
 
 typedef enum {
     JR_NONE,
@@ -56,7 +35,7 @@ typedef enum {
     JR_NEAR_FORCED
 } jmprel_opcode_sel;
 
-typedef struct targetval_s {
+typedef struct targetval {
     expr *val;
 
     jmprel_opcode_sel op_sel;
diff --git a/libyasm/coretype.h b/libyasm/coretype.h
new file mode 100644 (file)
index 0000000..ada1ffb
--- /dev/null
@@ -0,0 +1,69 @@
+/* $IdPath$
+ * Core (used by many modules/header files) type definitions.
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef YASM_CORETYPE_H
+#define YASM_CORETYPE_H
+
+typedef struct preproc preproc;
+typedef struct parser parser;
+typedef struct optimizer optimizer;
+typedef struct objfmt objfmt;
+
+typedef struct bytecode bytecode;
+typedef STAILQ_HEAD(bytecodehead, bytecode) bytecodehead;
+
+typedef struct section section;
+typedef STAILQ_HEAD(sectionhead, section) sectionhead;
+
+typedef struct symrec symrec;
+
+typedef struct expr expr;
+typedef struct intnum intnum;
+typedef struct floatnum floatnum;
+
+typedef enum {
+    EXPR_ADD,
+    EXPR_SUB,
+    EXPR_MUL,
+    EXPR_DIV,
+    EXPR_SIGNDIV,
+    EXPR_MOD,
+    EXPR_SIGNMOD,
+    EXPR_NEG,
+    EXPR_NOT,
+    EXPR_OR,
+    EXPR_AND,
+    EXPR_XOR,
+    EXPR_SHL,
+    EXPR_SHR,
+    EXPR_LOR,
+    EXPR_LAND,
+    EXPR_LNOT,
+    EXPR_LT,
+    EXPR_GT,
+    EXPR_EQ,
+    EXPR_LE,
+    EXPR_GE,
+    EXPR_NE,
+    EXPR_IDENT     /* no operation, just a value */
+} ExprOp;
+
+#endif
index 4f008386f9fa0978313d5a7795268a942462adde..4f66a1c01c23b3713bf48e2619c6292cc015bb1f 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Error and warning reporting and related functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
 #include <ctype.h>
 
 #ifdef STDC_HEADERS
-# include <stdlib.h>
 # include <stdarg.h>
-# include <string.h>
 #endif
 
-#include <libintl.h>
-#define _(String)      gettext(String)
 #ifdef gettext_noop
 #define N_(String)     gettext_noop(String)
 #else
 #include "globals.h"
 #include "errwarn.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Total error count for entire assembler run.
  * Assembler should exit with EXIT_FAILURE if this is >= 0 on finish. */
index 17a737380e0856e84b33e2dd9da425bb14a0d9a7..c49d184625f75b78488c839e28b93e0270abe4b3 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Expression handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 #include "expr.h"
 #include "symrec.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Types listed in canonical sorting order.  See expr_order_terms(). */
 typedef enum {
index 25266d59fda01f0ca8e97142b01880bacc760567..3f526e90d4324bae37e402a0a822420ae4c2c72b 100644 (file)
 #ifndef YASM_EXPR_H
 #define YASM_EXPR_H
 
-#ifndef YASM_SYMREC
-#define YASM_SYMREC
-typedef struct symrec symrec;
-#endif
-
-#ifndef YASM_FLOATNUM
-#define YASM_FLOATNUM
-typedef struct floatnum floatnum;
-#endif
-
-#ifndef YASM_INTNUM
-#define YASM_INTNUM
-typedef struct intnum intnum;
-#endif
-
-#ifndef YASM_EXPROP
-#define YASM_EXPROP
-typedef enum {
-    EXPR_ADD,
-    EXPR_SUB,
-    EXPR_MUL,
-    EXPR_DIV,
-    EXPR_SIGNDIV,
-    EXPR_MOD,
-    EXPR_SIGNMOD,
-    EXPR_NEG,
-    EXPR_NOT,
-    EXPR_OR,
-    EXPR_AND,
-    EXPR_XOR,
-    EXPR_SHL,
-    EXPR_SHR,
-    EXPR_LOR,
-    EXPR_LAND,
-    EXPR_LNOT,
-    EXPR_LT,
-    EXPR_GT,
-    EXPR_EQ,
-    EXPR_LE,
-    EXPR_GE,
-    EXPR_NE,
-    EXPR_IDENT     /* no operation, just a value */
-} ExprOp;
-#endif
-
 typedef struct ExprItem ExprItem;
 
-#ifndef YASM_EXPR
-#define YASM_EXPR
-typedef struct expr expr;
-#endif
-
 expr *expr_new(ExprOp, ExprItem *, ExprItem *);
 
 ExprItem *ExprSym(symrec *);
index acd1a74f97c784c3fae304a2fa54f4e2f358fe62..93347df042527888c75abd634fb8f7b1eadf47ed 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Little-endian file functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "file.h"
 
-RCSID("$IdPath$");
 
 size_t
 fwrite_short(unsigned short val, FILE *f)
index 1f173d144db022e3ed04e090ec721711f99504d2..54a9759fe39eb5f2412edc4bb96a3e65c8690a57 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Floating point number functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
 #include <ctype.h>
 
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
-
 #include "bitvect.h"
 #include "file.h"
 
 #include "errwarn.h"
 #include "floatnum.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* 97-bit internal floating point format:
  * 0000000s eeeeeeee eeeeeeee m.....................................m
index cf265b2a7c83252220fe432f6c3900517e744322..5ac4b51a88d464264bc8823b1dee0ea3a09fe411 100644 (file)
 #ifndef YASM_FLOATNUM_H
 #define YASM_FLOATNUM_H
 
-#ifndef YASM_EXPROP
-#define YASM_EXPROP
-typedef enum {
-    EXPR_ADD,
-    EXPR_SUB,
-    EXPR_MUL,
-    EXPR_DIV,
-    EXPR_SIGNDIV,
-    EXPR_MOD,
-    EXPR_SIGNMOD,
-    EXPR_NEG,
-    EXPR_NOT,
-    EXPR_OR,
-    EXPR_AND,
-    EXPR_XOR,
-    EXPR_SHL,
-    EXPR_SHR,
-    EXPR_LOR,
-    EXPR_LAND,
-    EXPR_LNOT,
-    EXPR_LT,
-    EXPR_GT,
-    EXPR_EQ,
-    EXPR_LE,
-    EXPR_GE,
-    EXPR_NE,
-    EXPR_IDENT /* if right is IDENT, then the entire expr is just a num */
-} ExprOp;
-#endif
-
-#ifndef YASM_FLOATNUM
-#define YASM_FLOATNUM
-typedef struct floatnum floatnum;
-#endif
-
 floatnum *floatnum_new(const char *str);
 floatnum *floatnum_copy(const floatnum *flt);
 void floatnum_delete(floatnum *flt);
index 9b09d9b2ac50e53eade64d5686bd648cd23d107a..bcd1c485850331101008214f2243a5ea8cdb5390 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Integer number functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
 #include <ctype.h>
 
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-
 #include "bitvect.h"
 #include "file.h"
 
 #include "errwarn.h"
 #include "intnum.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define BITVECT_ALLOC_SIZE     80
 
index 5aec73891120367573c1a262797e91b94f87d82d..cd104f287cfbb6bc9b8993c343a9bfbb9eae8740 100644 (file)
 #ifndef YASM_INTNUM_H
 #define YASM_INTNUM_H
 
-#ifndef YASM_EXPROP
-#define YASM_EXPROP
-typedef enum {
-    EXPR_ADD,
-    EXPR_SUB,
-    EXPR_MUL,
-    EXPR_DIV,
-    EXPR_SIGNDIV,
-    EXPR_MOD,
-    EXPR_SIGNMOD,
-    EXPR_NEG,
-    EXPR_NOT,
-    EXPR_OR,
-    EXPR_AND,
-    EXPR_XOR,
-    EXPR_SHL,
-    EXPR_SHR,
-    EXPR_LOR,
-    EXPR_LAND,
-    EXPR_LNOT,
-    EXPR_LT,
-    EXPR_GT,
-    EXPR_EQ,
-    EXPR_LE,
-    EXPR_GE,
-    EXPR_NE,
-    EXPR_IDENT /* if right is IDENT, then the entire expr is just a num */
-} ExprOp;
-#endif
-
-#ifndef YASM_INTNUM
-#define YASM_INTNUM
-typedef struct intnum intnum;
-#endif
-
 intnum *intnum_new_dec(char *str);
 intnum *intnum_new_bin(char *str);
 intnum *intnum_new_oct(char *str);
index 03ef07e0589a39a9110c9eedf9d1e52472286dff..c21436a7176c6bf8ada78d0d2dc166cb73fedae7 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Global variables
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
+#include "ternary.h"
 
 #include "globals.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 const char *in_filename = (const char *)NULL;
 unsigned int line_number = 1;
index 6091983b412a21561fad4d1b7c05f04ecda040d1..3f8a428bd73f521c5c67199cade7023f922b02a9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * mergesort() implementation for systems that don't have it.
  *
  * Copyright (c) 1992, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
 RCSID("$IdPath$");
 
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)merge.c    8.2 (Berkeley) 2/14/94";
 #endif /* LIBC_SCCS and not lint */
index cd584de34b96e3f13f4c32257829c7ee1eb95a45..ea82030697176befac52787bd6fa9e3c3434b23e 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_OBJFMT_H
 
 /* Interface to the object format module(s) */
-typedef struct objfmt_s {
+struct objfmt {
     /* one-line description of the format */
     const char *name;
 
@@ -39,18 +39,18 @@ typedef struct objfmt_s {
     /* NULL-terminated list of debugging formats that are valid to use with
      * this object format.
      */
-/*    struct debugfmt_s **debugfmts;*/
+/*    debugfmt **debugfmts;*/
 
     /* Default debugging format (set even if there's only one available to
      * use)
      */
-/*    struct debugfmt_s *default_df;*/
+/*    debugfmt *default_df;*/
 
     /* Is the specified section name valid?
      * Return is a boolean value.
      */
     int (*is_valid_section) (const char *name);
-} objfmt;
+};
 
 /* Available object formats */
 extern objfmt dbg_objfmt;
index 4b7e9d0fe6ae8d49d457d3b303cdf3f3a077ab0a..0f52e08706993bfb8b936f3639bb3eba29b70d6d 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_OPTIMIZER_H
 
 /* Interface to the optimizer module(s) */
-typedef struct optimizer_s {
+struct optimizer {
     /* one-line description of the optimizer */
     const char *name;
 
@@ -35,7 +35,7 @@ typedef struct optimizer_s {
      * This function takes the unoptimized linked list of sections and returns
      * an optimized linked list of sections ready for output to an object file.
      */
-} optimizer;
+};
 
 /* Available optimizers */
 extern optimizer dbg_optimizer;
index b66d317b2f41cca24694bd2d9942f2d71224eb7b..232bf393e2ec92bc4db01445250029d18608b9e2 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_PARSER_H
 
 /* Interface to the parser module(s) -- the "front end" of the assembler */
-typedef struct parser_s {
+struct parser {
     /* one-line description of the parser */
     const char *name;
 
@@ -52,8 +52,8 @@ typedef struct parser_s {
      * This function returns the starting section of a linked list of sections
      * (whatever was in the file).
      */
-    sectionhead *(*do_parse) (struct parser_s *p, objfmt *of, FILE *f);
-} parser;
+    sectionhead *(*do_parse) (parser *p, objfmt *of, FILE *f);
+};
 
 /* Generic functions for all parsers - implemented in src/parser.c */
 
index 760afc94d662726e0703d3ffee56d536a28327cc..fa64ecd17d5bd44f7d9c1c665ca354454797c741 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_PREPROC_H
 
 /* Interface to the preprocesor module(s) */
-typedef struct preproc_s {
+struct preproc {
     /* one-line description of the preprocessor */
     const char *name;
 
@@ -44,7 +44,7 @@ typedef struct preproc_s {
     /* Gets more preprocessed source code (up to max_size bytes) into buf.
      * Note that more than a single line may be returned in buf. */
     int (*input) (char *buf, int max_size);
-} preproc;
+};
 
 /* Available preprocessors */
 extern preproc raw_preproc;
index 90608419febaffa5fad003ed80892523e0d76bdc..0ebccb7e67d69f886d97105fe5d544b0572b494a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Section utility functions
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define        _(String)       gettext(String)
-#ifdef gettext_noop
-#define        N_(String)      gettext_noop(String)
-#else
-#define        N_(String)      (String)
-#endif
+RCSID("$IdPath$");
 
 #include "globals.h"
 #include "errwarn.h"
 #include "section.h"
 #include "objfmt.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 struct section {
     STAILQ_ENTRY(section) link;
index ff99fb9d49a6f0e2d40357632767ebcec88c58ea..43e47bd14441b9e71209377524681e0afac813f8 100644 (file)
 #ifndef YASM_SECTION_H
 #define YASM_SECTION_H
 
-struct objfmt_s;
+struct objfmt;
 
-typedef STAILQ_HEAD(sectionhead, section) sectionhead;
+section *sections_initialize(sectionhead *headp, struct objfmt *of);
 
-#ifndef YASM_SECTION
-#define YASM_SECTION
-typedef struct section section;
-#endif
-
-section *sections_initialize(sectionhead *headp, struct objfmt_s *of);
-
-section *sections_switch(sectionhead *headp, struct objfmt_s *of,
+section *sections_switch(sectionhead *headp, struct objfmt *of,
                         const char *name);
 
 void sections_delete(sectionhead *headp);
index b0aa443cd168bfce44a68f18b6afa4b7556ee59f..15971ec4c5e23938078d11a3a666953206a92d2a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * strcasecmp() implementation for systems that don't have it or stricmp()
  * or strcmpi().
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
 RCSID("$IdPath$");
 
+
 #ifdef USE_OUR_OWN_STRCASECMP
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strcasecmp.c       8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef STDC_HEADERS
-# include <string.h>
-# include <ctype.h>
-#endif
+#include <ctype.h>
 
 int
 strcasecmp(const char *s1, const char *s2)
index 64a71889c74e075bdca15a61a1926e0248588687..4e35c4070ad8e28f5ac466ff6ae708b8fbf7dc3a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * strsep() implementation for systems that don't have it.
  *
  * Copyright (c) 1990, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "util.h"
+RCSID("$IdPath$");
+
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strsep.c   8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-#include <string.h>
-#endif
-
-RCSID("$IdPath$");
 
 /*
  * Get next token from string *stringp, where tokens are possibly-empty
index aad043af4f4887bfba9d2667701be7d3c36f7f47..eccb034f7e66a7e0cf1b9541a082de826b0b3d98 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Symbol table handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+#include "ternary.h"
 
 #include "globals.h"
 #include "errwarn.h"
 #include "bytecode.h"
 #include "section.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* DEFINED is set with EXTERN and COMMON below */
 typedef enum {
index c4a94f14ca7144816018b667fc4836d09ad81cd6..11ff4a09078d4a3b66ed7a8c225575ea3ee337d8 100644 (file)
 #ifndef YASM_SYMREC_H
 #define YASM_SYMREC_H
 
-#ifndef YASM_EXPR
-#define YASM_EXPR
-typedef struct expr expr;
-#endif
-
-#ifndef YASM_SECTION
-#define YASM_SECTION
-typedef struct section section;
-#endif
-
-#ifndef YASM_BYTECODE
-#define YASM_BYTECODE
-typedef struct bytecode bytecode;
-#endif
-
 /* EXTERN and COMMON are mutually exclusive */
 typedef enum {
     SYM_LOCAL = 0,             /* default, local only */
@@ -45,11 +30,6 @@ typedef enum {
     SYM_EXTERN = 1 << 2                /* if it's declared EXTERN */
 } SymVisibility;
 
-#ifndef YASM_SYMREC
-#define YASM_SYMREC
-typedef struct symrec symrec;
-#endif
-
 symrec *symrec_use(const char *name);
 symrec *symrec_define_equ(const char *name, expr *e);
 /* in_table specifies if the label should be inserted into the symbol table. */
index 6e0ae89de4fa2b059c40899872a4d2712b28926a..09e017fa5a4de5b7b1c8fef0caa80445748293cf 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <stdio.h>
+#include "util.h"
 
 #include "check.h"
 
index a56c3e9cd0bd40160468827477f03ce9107f208d..5d0bf8d7fd57563cfd87664bb88c9c59d2bd278f 100644 (file)
@@ -1,5 +1,7 @@
 /* $IdPath$
- * Defines prototypes for replacement functions if needed.
+ * Includes standard headers and defines prototypes for replacement functions
+ * if needed.  This is the *only* header file which should include other
+ * header files!
  *
  *  Copyright (C) 2001  Peter Johnson
  *
 #ifndef YASM_UTIL_H
 #define YASM_UTIL_H
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
 #ifdef STDC_HEADERS
 # include <stddef.h>
+# include <stdlib.h>
+# include <string.h>
 #endif
 
+#include <libintl.h>
+#define _(String)      gettext(String)
+
 #if !defined(HAVE_MERGESORT)
 int mergesort(void *base, size_t nmemb, size_t size,
              int (*compar)(const void *, const void *));
@@ -62,19 +75,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 # include "compat-queue.h"
 #endif
 
-#include "ternary.h"
-
-#ifndef DMALLOC
-/* strdup() implementation with error checking (using xmalloc). */
-char *xstrdup(const char *str);
-
-/* Error-checking memory allocation routines in xmalloc.c. */
-void *xmalloc(size_t size);
-void *xcalloc(size_t nelem, size_t elsize);
-void *xrealloc(void *oldmem, size_t size);
-void xfree(void *p);
-#endif
-
 #ifdef HAVE_SYS_CDEFS_H
 # include <sys/cdefs.h>
 #endif
@@ -93,4 +93,19 @@ void xfree(void *p);
 # endif
 #endif
 
+#ifdef DMALLOC
+# include <dmalloc.h>
+#else
+/* strdup() implementation with error checking (using xmalloc). */
+char *xstrdup(const char *str);
+
+/* Error-checking memory allocation routines in xmalloc.c. */
+void *xmalloc(size_t size);
+void *xcalloc(size_t nelem, size_t elsize);
+void *xrealloc(void *oldmem, size_t size);
+void xfree(void *p);
+#endif
+
+#include "coretype.h"
+
 #endif
index 77353c19363d41ed845eae9cfb14f2c66f2d354a..da38bd920665b1098bf396ee4a2bbb382f0c99ca 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Memory allocation routines with error checking.  Idea from GNU libiberty.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#ifndef DMALLOC
 
-RCSID("$IdPath$");
+#ifndef DMALLOC
 
 void *
 xmalloc(size_t size)
index c0b3027221ec3c82b3b140d2214eeec068f0d09c..77cccba03306d2a74be9452876873dfe30e18980 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * strdup() implementation with error checking (using xmalloc).
  *
  * Copyright (c) 1988, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "util.h"
+RCSID("$IdPath$");
+
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strdup.c   8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "util.h"
 
-#ifdef STDC_HEADERS
-# include <stddef.h>
-# include <string.h>
-#else
+#ifndef STDC_HEADERS
 size_t strlen(const char *);
 # ifndef HAVE_MEMCPY
 void bcopy(const void *, void *, size_t);
@@ -54,8 +49,6 @@ void memcpy(void *, const void *, size_t);
 
 #ifndef DMALLOC
 
-RCSID("$IdPath$");
-
 char *
 xstrdup(const char *str)
 {
index 6091983b412a21561fad4d1b7c05f04ecda040d1..3f8a428bd73f521c5c67199cade7023f922b02a9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * mergesort() implementation for systems that don't have it.
  *
  * Copyright (c) 1992, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
 RCSID("$IdPath$");
 
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)merge.c    8.2 (Berkeley) 2/14/94";
 #endif /* LIBC_SCCS and not lint */
index 17a737380e0856e84b33e2dd9da425bb14a0d9a7..c49d184625f75b78488c839e28b93e0270abe4b3 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Expression handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 #include "expr.h"
 #include "symrec.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Types listed in canonical sorting order.  See expr_order_terms(). */
 typedef enum {
index 17a737380e0856e84b33e2dd9da425bb14a0d9a7..c49d184625f75b78488c839e28b93e0270abe4b3 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Expression handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 #include "expr.h"
 #include "symrec.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Types listed in canonical sorting order.  See expr_order_terms(). */
 typedef enum {
index 9c9b983b802065b962362f4935957702178609c1..f5ce6b69debafb658928d25f5f6e142a60b30849 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging object format (used to debug object format module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "objfmt.h"
 
-RCSID("$IdPath$");
 
 static int
 dbg_objfmt_is_valid_section(const char *name)
index 9c9b983b802065b962362f4935957702178609c1..f5ce6b69debafb658928d25f5f6e142a60b30849 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging object format (used to debug object format module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "objfmt.h"
 
-RCSID("$IdPath$");
 
 static int
 dbg_objfmt_is_valid_section(const char *name)
index d6535d942c1bce56e0f55d55088212a4dd40ec48..763f3864fe0208b2ee200c94b4b1da5ca21bcad9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging optimizer (used to debug optimizer module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #include "optimizer.h"
 
-RCSID("$IdPath$");
 
 /* Define optimizer structure -- see optimizer.h for details */
 optimizer dbg_optimizer = {
index d6535d942c1bce56e0f55d55088212a4dd40ec48..763f3864fe0208b2ee200c94b4b1da5ca21bcad9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging optimizer (used to debug optimizer module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #include "optimizer.h"
 
-RCSID("$IdPath$");
 
 /* Define optimizer structure -- see optimizer.h for details */
 optimizer dbg_optimizer = {
index d6535d942c1bce56e0f55d55088212a4dd40ec48..763f3864fe0208b2ee200c94b4b1da5ca21bcad9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging optimizer (used to debug optimizer module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #include "optimizer.h"
 
-RCSID("$IdPath$");
 
 /* Define optimizer structure -- see optimizer.h for details */
 optimizer dbg_optimizer = {
index 4b3754e44d694e81aa1c796d4c39e1b105243045..54893a7695ef90df3be9602fd496bf6b108ad499 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible bison parser
  *
  *  Copyright (C) 2001  Peter Johnson, Michael Urman
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 %{
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
 # include <math.h>
 #endif
 
-#include <libintl.h>
-#define _(String)      gettext(String)
-
 #include "bitvect.h"
 
 #include "globals.h"
 #include "section.h"
 #include "objfmt.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define YYDEBUG 1
 
index 4b3754e44d694e81aa1c796d4c39e1b105243045..54893a7695ef90df3be9602fd496bf6b108ad499 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible bison parser
  *
  *  Copyright (C) 2001  Peter Johnson, Michael Urman
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 %{
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
 # include <math.h>
 #endif
 
-#include <libintl.h>
-#define _(String)      gettext(String)
-
 #include "bitvect.h"
 
 #include "globals.h"
 #include "section.h"
 #include "objfmt.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define YYDEBUG 1
 
index fffa8bdbe4478ef40e50727270ed39edf875a6ea..c1bab7edcf9ff73b943e7b9e5709107decf7ce1a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible parser
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "bytecode.h"
 #include "section.h"
 #include "objfmt.h"
 #include "preproc.h"
 #include "parser.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 extern FILE *nasm_parser_in;
 extern int nasm_parser_debug;
index fffa8bdbe4478ef40e50727270ed39edf875a6ea..c1bab7edcf9ff73b943e7b9e5709107decf7ce1a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible parser
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "bytecode.h"
 #include "section.h"
 #include "objfmt.h"
 #include "preproc.h"
 #include "parser.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 extern FILE *nasm_parser_in;
 extern int nasm_parser_debug;
index 6973afbe3e2cd0bf1e81c9d4350fc5a0954c1915..8c1d683446cafded20f4c5d037fa99a4d09e9f83 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible lex lexer
  *
  *  Copyright (C) 2001  Peter Johnson
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 %{
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 
 #include "bison.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define YY_NEVER_INTERACTIVE   1
 
index c655e4dfe589a54bded048f73595383e12d40416..8c692c2481b0229dd82e0631f0cd6344126e6109 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Raw preprocessor (preforms NO preprocessing)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "objfmt.h"
 #include "preproc.h"
 
-RCSID("$IdPath$");
 
 static int is_interactive;
 static FILE *in;
index c655e4dfe589a54bded048f73595383e12d40416..8c692c2481b0229dd82e0631f0cd6344126e6109 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Raw preprocessor (preforms NO preprocessing)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "objfmt.h"
 #include "preproc.h"
 
-RCSID("$IdPath$");
 
 static int is_interactive;
 static FILE *in;
index 17a737380e0856e84b33e2dd9da425bb14a0d9a7..c49d184625f75b78488c839e28b93e0270abe4b3 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Expression handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 #include "expr.h"
 #include "symrec.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Types listed in canonical sorting order.  See expr_order_terms(). */
 typedef enum {
index 17a737380e0856e84b33e2dd9da425bb14a0d9a7..c49d184625f75b78488c839e28b93e0270abe4b3 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Expression handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 #include "expr.h"
 #include "symrec.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Types listed in canonical sorting order.  See expr_order_terms(). */
 typedef enum {
index cedec92428093487c20f1bc714ace139d4227f2f..6ed5d1894fc8a3cfb68e1428b9e066ab5cc71297 100644 (file)
@@ -1,30 +1,21 @@
-/* $IdPath$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 /*****************************************************************************/
 /*  MODULE NAME:  BitVector.c                           MODULE TYPE:  (adt)  */
 /*****************************************************************************/
 /*  MODULE IMPORTS:                                                          */
 /*****************************************************************************/
+#include <ctype.h>                                  /*  MODULE TYPE:  (sys)  */
 #ifdef STDC_HEADERS
 #include <limits.h>                                 /*  MODULE TYPE:  (sys)  */
 #include <string.h>                                 /*  MODULE TYPE:  (sys)  */
-#include <ctype.h>                                  /*  MODULE TYPE:  (sys)  */
 #endif
 /*****************************************************************************/
 /*  MODULE INTERFACE:                                                        */
 /*****************************************************************************/
 #include "bitvect.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* ToolBox.h */
 #define and         &&      /* logical (boolean) operators: lower case */
index 6db2d777f9661b36a8103e39bb41a93ae1319ab5..407f01eccf51b19d3f92370cac0214f903b73615 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Bytecode utility functions
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "globals.h"
 #include "errwarn.h"
 #include "intnum.h"
-#include "floatnum.h"
 #include "expr.h"
 
 #include "bytecode.h"
-#include "section.h"
-
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
 
-RCSID("$IdPath$");
 
 struct effaddr {
     expr *disp;                        /* address displacement */
index d2cd383cc43b239777db633c9c61b3f89d5c7a41..3683bae9eae169385378818edef3e721867f8d24 100644 (file)
 #ifndef YASM_BYTECODE_H
 #define YASM_BYTECODE_H
 
-#ifndef YASM_SECTION
-#define YASM_SECTION
-typedef struct section section;
-#endif
-
-#ifndef YASM_EXPR
-#define YASM_EXPR
-typedef struct expr expr;
-#endif
-
-#ifndef YASM_FLOATNUM
-#define YASM_FLOATNUM
-typedef struct floatnum floatnum;
-#endif
-
 typedef struct effaddr effaddr;
 typedef struct immval immval;
 typedef STAILQ_HEAD(datavalhead, dataval) datavalhead;
 typedef struct dataval dataval;
-typedef STAILQ_HEAD(bytecodehead, bytecode) bytecodehead;
-
-#ifndef YASM_BYTECODE
-#define YASM_BYTECODE
-typedef struct bytecode bytecode;
-#endif
 
 typedef enum {
     JR_NONE,
@@ -56,7 +35,7 @@ typedef enum {
     JR_NEAR_FORCED
 } jmprel_opcode_sel;
 
-typedef struct targetval_s {
+typedef struct targetval {
     expr *val;
 
     jmprel_opcode_sel op_sel;
diff --git a/src/coretype.h b/src/coretype.h
new file mode 100644 (file)
index 0000000..ada1ffb
--- /dev/null
@@ -0,0 +1,69 @@
+/* $IdPath$
+ * Core (used by many modules/header files) type definitions.
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef YASM_CORETYPE_H
+#define YASM_CORETYPE_H
+
+typedef struct preproc preproc;
+typedef struct parser parser;
+typedef struct optimizer optimizer;
+typedef struct objfmt objfmt;
+
+typedef struct bytecode bytecode;
+typedef STAILQ_HEAD(bytecodehead, bytecode) bytecodehead;
+
+typedef struct section section;
+typedef STAILQ_HEAD(sectionhead, section) sectionhead;
+
+typedef struct symrec symrec;
+
+typedef struct expr expr;
+typedef struct intnum intnum;
+typedef struct floatnum floatnum;
+
+typedef enum {
+    EXPR_ADD,
+    EXPR_SUB,
+    EXPR_MUL,
+    EXPR_DIV,
+    EXPR_SIGNDIV,
+    EXPR_MOD,
+    EXPR_SIGNMOD,
+    EXPR_NEG,
+    EXPR_NOT,
+    EXPR_OR,
+    EXPR_AND,
+    EXPR_XOR,
+    EXPR_SHL,
+    EXPR_SHR,
+    EXPR_LOR,
+    EXPR_LAND,
+    EXPR_LNOT,
+    EXPR_LT,
+    EXPR_GT,
+    EXPR_EQ,
+    EXPR_LE,
+    EXPR_GE,
+    EXPR_NE,
+    EXPR_IDENT     /* no operation, just a value */
+} ExprOp;
+
+#endif
index 4f008386f9fa0978313d5a7795268a942462adde..4f66a1c01c23b3713bf48e2619c6292cc015bb1f 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Error and warning reporting and related functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
 #include <ctype.h>
 
 #ifdef STDC_HEADERS
-# include <stdlib.h>
 # include <stdarg.h>
-# include <string.h>
 #endif
 
-#include <libintl.h>
-#define _(String)      gettext(String)
 #ifdef gettext_noop
 #define N_(String)     gettext_noop(String)
 #else
 #include "globals.h"
 #include "errwarn.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Total error count for entire assembler run.
  * Assembler should exit with EXIT_FAILURE if this is >= 0 on finish. */
index 17a737380e0856e84b33e2dd9da425bb14a0d9a7..c49d184625f75b78488c839e28b93e0270abe4b3 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Expression handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 #include "expr.h"
 #include "symrec.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Types listed in canonical sorting order.  See expr_order_terms(). */
 typedef enum {
index 25266d59fda01f0ca8e97142b01880bacc760567..3f526e90d4324bae37e402a0a822420ae4c2c72b 100644 (file)
 #ifndef YASM_EXPR_H
 #define YASM_EXPR_H
 
-#ifndef YASM_SYMREC
-#define YASM_SYMREC
-typedef struct symrec symrec;
-#endif
-
-#ifndef YASM_FLOATNUM
-#define YASM_FLOATNUM
-typedef struct floatnum floatnum;
-#endif
-
-#ifndef YASM_INTNUM
-#define YASM_INTNUM
-typedef struct intnum intnum;
-#endif
-
-#ifndef YASM_EXPROP
-#define YASM_EXPROP
-typedef enum {
-    EXPR_ADD,
-    EXPR_SUB,
-    EXPR_MUL,
-    EXPR_DIV,
-    EXPR_SIGNDIV,
-    EXPR_MOD,
-    EXPR_SIGNMOD,
-    EXPR_NEG,
-    EXPR_NOT,
-    EXPR_OR,
-    EXPR_AND,
-    EXPR_XOR,
-    EXPR_SHL,
-    EXPR_SHR,
-    EXPR_LOR,
-    EXPR_LAND,
-    EXPR_LNOT,
-    EXPR_LT,
-    EXPR_GT,
-    EXPR_EQ,
-    EXPR_LE,
-    EXPR_GE,
-    EXPR_NE,
-    EXPR_IDENT     /* no operation, just a value */
-} ExprOp;
-#endif
-
 typedef struct ExprItem ExprItem;
 
-#ifndef YASM_EXPR
-#define YASM_EXPR
-typedef struct expr expr;
-#endif
-
 expr *expr_new(ExprOp, ExprItem *, ExprItem *);
 
 ExprItem *ExprSym(symrec *);
index acd1a74f97c784c3fae304a2fa54f4e2f358fe62..93347df042527888c75abd634fb8f7b1eadf47ed 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Little-endian file functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "file.h"
 
-RCSID("$IdPath$");
 
 size_t
 fwrite_short(unsigned short val, FILE *f)
index 1f173d144db022e3ed04e090ec721711f99504d2..54a9759fe39eb5f2412edc4bb96a3e65c8690a57 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Floating point number functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
 #include <ctype.h>
 
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-#ifdef gettext_noop
-#define N_(String)     gettext_noop(String)
-#else
-#define N_(String)     (String)
-#endif
-
 #include "bitvect.h"
 #include "file.h"
 
 #include "errwarn.h"
 #include "floatnum.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* 97-bit internal floating point format:
  * 0000000s eeeeeeee eeeeeeee m.....................................m
index cf265b2a7c83252220fe432f6c3900517e744322..5ac4b51a88d464264bc8823b1dee0ea3a09fe411 100644 (file)
 #ifndef YASM_FLOATNUM_H
 #define YASM_FLOATNUM_H
 
-#ifndef YASM_EXPROP
-#define YASM_EXPROP
-typedef enum {
-    EXPR_ADD,
-    EXPR_SUB,
-    EXPR_MUL,
-    EXPR_DIV,
-    EXPR_SIGNDIV,
-    EXPR_MOD,
-    EXPR_SIGNMOD,
-    EXPR_NEG,
-    EXPR_NOT,
-    EXPR_OR,
-    EXPR_AND,
-    EXPR_XOR,
-    EXPR_SHL,
-    EXPR_SHR,
-    EXPR_LOR,
-    EXPR_LAND,
-    EXPR_LNOT,
-    EXPR_LT,
-    EXPR_GT,
-    EXPR_EQ,
-    EXPR_LE,
-    EXPR_GE,
-    EXPR_NE,
-    EXPR_IDENT /* if right is IDENT, then the entire expr is just a num */
-} ExprOp;
-#endif
-
-#ifndef YASM_FLOATNUM
-#define YASM_FLOATNUM
-typedef struct floatnum floatnum;
-#endif
-
 floatnum *floatnum_new(const char *str);
 floatnum *floatnum_copy(const floatnum *flt);
 void floatnum_delete(floatnum *flt);
index 03ef07e0589a39a9110c9eedf9d1e52472286dff..c21436a7176c6bf8ada78d0d2dc166cb73fedae7 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Global variables
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
+#include "ternary.h"
 
 #include "globals.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 const char *in_filename = (const char *)NULL;
 unsigned int line_number = 1;
index 9b09d9b2ac50e53eade64d5686bd648cd23d107a..bcd1c485850331101008214f2243a5ea8cdb5390 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Integer number functions.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
 #include <ctype.h>
 
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
-
 #include "bitvect.h"
 #include "file.h"
 
 #include "errwarn.h"
 #include "intnum.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define BITVECT_ALLOC_SIZE     80
 
index 5aec73891120367573c1a262797e91b94f87d82d..cd104f287cfbb6bc9b8993c343a9bfbb9eae8740 100644 (file)
 #ifndef YASM_INTNUM_H
 #define YASM_INTNUM_H
 
-#ifndef YASM_EXPROP
-#define YASM_EXPROP
-typedef enum {
-    EXPR_ADD,
-    EXPR_SUB,
-    EXPR_MUL,
-    EXPR_DIV,
-    EXPR_SIGNDIV,
-    EXPR_MOD,
-    EXPR_SIGNMOD,
-    EXPR_NEG,
-    EXPR_NOT,
-    EXPR_OR,
-    EXPR_AND,
-    EXPR_XOR,
-    EXPR_SHL,
-    EXPR_SHR,
-    EXPR_LOR,
-    EXPR_LAND,
-    EXPR_LNOT,
-    EXPR_LT,
-    EXPR_GT,
-    EXPR_EQ,
-    EXPR_LE,
-    EXPR_GE,
-    EXPR_NE,
-    EXPR_IDENT /* if right is IDENT, then the entire expr is just a num */
-} ExprOp;
-#endif
-
-#ifndef YASM_INTNUM
-#define YASM_INTNUM
-typedef struct intnum intnum;
-#endif
-
 intnum *intnum_new_dec(char *str);
 intnum *intnum_new_bin(char *str);
 intnum *intnum_new_oct(char *str);
index 03ef07e0589a39a9110c9eedf9d1e52472286dff..c21436a7176c6bf8ada78d0d2dc166cb73fedae7 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Global variables
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
+#include "ternary.h"
 
 #include "globals.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 const char *in_filename = (const char *)NULL;
 unsigned int line_number = 1;
index 45e76049ca6e8d9c77f64261562876e0ed093e54..0b4d711f9803e7446390b227b9defa020e734c95 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Program entry point, command line parsing
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
 #ifdef gettext_noop
 #define N_(String)     gettext_noop(String)
 #else
 #include "preproc.h"
 #include "parser.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #ifndef countof
 #define countof(x,y)   (sizeof(x)/sizeof(y))
index 6091983b412a21561fad4d1b7c05f04ecda040d1..3f8a428bd73f521c5c67199cade7023f922b02a9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * mergesort() implementation for systems that don't have it.
  *
  * Copyright (c) 1992, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
 RCSID("$IdPath$");
 
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)merge.c    8.2 (Berkeley) 2/14/94";
 #endif /* LIBC_SCCS and not lint */
index cd584de34b96e3f13f4c32257829c7ee1eb95a45..ea82030697176befac52787bd6fa9e3c3434b23e 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_OBJFMT_H
 
 /* Interface to the object format module(s) */
-typedef struct objfmt_s {
+struct objfmt {
     /* one-line description of the format */
     const char *name;
 
@@ -39,18 +39,18 @@ typedef struct objfmt_s {
     /* NULL-terminated list of debugging formats that are valid to use with
      * this object format.
      */
-/*    struct debugfmt_s **debugfmts;*/
+/*    debugfmt **debugfmts;*/
 
     /* Default debugging format (set even if there's only one available to
      * use)
      */
-/*    struct debugfmt_s *default_df;*/
+/*    debugfmt *default_df;*/
 
     /* Is the specified section name valid?
      * Return is a boolean value.
      */
     int (*is_valid_section) (const char *name);
-} objfmt;
+};
 
 /* Available object formats */
 extern objfmt dbg_objfmt;
index 9c9b983b802065b962362f4935957702178609c1..f5ce6b69debafb658928d25f5f6e142a60b30849 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging object format (used to debug object format module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "objfmt.h"
 
-RCSID("$IdPath$");
 
 static int
 dbg_objfmt_is_valid_section(const char *name)
index 9c9b983b802065b962362f4935957702178609c1..f5ce6b69debafb658928d25f5f6e142a60b30849 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging object format (used to debug object format module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "objfmt.h"
 
-RCSID("$IdPath$");
 
 static int
 dbg_objfmt_is_valid_section(const char *name)
index 4b7e9d0fe6ae8d49d457d3b303cdf3f3a077ab0a..0f52e08706993bfb8b936f3639bb3eba29b70d6d 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_OPTIMIZER_H
 
 /* Interface to the optimizer module(s) */
-typedef struct optimizer_s {
+struct optimizer {
     /* one-line description of the optimizer */
     const char *name;
 
@@ -35,7 +35,7 @@ typedef struct optimizer_s {
      * This function takes the unoptimized linked list of sections and returns
      * an optimized linked list of sections ready for output to an object file.
      */
-} optimizer;
+};
 
 /* Available optimizers */
 extern optimizer dbg_optimizer;
index d6535d942c1bce56e0f55d55088212a4dd40ec48..763f3864fe0208b2ee200c94b4b1da5ca21bcad9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging optimizer (used to debug optimizer module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #include "optimizer.h"
 
-RCSID("$IdPath$");
 
 /* Define optimizer structure -- see optimizer.h for details */
 optimizer dbg_optimizer = {
index d6535d942c1bce56e0f55d55088212a4dd40ec48..763f3864fe0208b2ee200c94b4b1da5ca21bcad9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging optimizer (used to debug optimizer module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #include "optimizer.h"
 
-RCSID("$IdPath$");
 
 /* Define optimizer structure -- see optimizer.h for details */
 optimizer dbg_optimizer = {
index d6535d942c1bce56e0f55d55088212a4dd40ec48..763f3864fe0208b2ee200c94b4b1da5ca21bcad9 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Debugging optimizer (used to debug optimizer module interface)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #include "optimizer.h"
 
-RCSID("$IdPath$");
 
 /* Define optimizer structure -- see optimizer.h for details */
 optimizer dbg_optimizer = {
index efe7882e1eb0612e0104c6a1ac463e46568fcec0..5eef8b2453e067643b2175b4bd15c869ebc9a6db 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Generic Options Support Header File
  *
  * Copyright (c) 2001  Stanislav Karchebny <berk@madfire.net>
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)       gettext(String)
-#ifdef gettext_noop
-#define N_(String)      gettext_noop(String)
-#else
-#define N_(String)      (String)
-#endif
+RCSID("$IdPath$");
 
 #include "options.h"
 #include "errwarn.h"
index 3b7d360e2a4517f909397546893d4e03f3f28d38..4a654a5625eb62ac69449ee6a6e97c2361904933 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Generic functions for all parsers
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
+RCSID("$IdPath$");
 
 #include "globals.h"
-#include "errwarn.h"
-#include "expr.h"
 
-#include "bytecode.h"
-#include "section.h"
-#include "objfmt.h"
 #include "preproc.h"
 #include "parser.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* NULL-terminated list of all available parsers.
  * Someday change this if we dynamically load parsers at runtime.
index b66d317b2f41cca24694bd2d9942f2d71224eb7b..232bf393e2ec92bc4db01445250029d18608b9e2 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_PARSER_H
 
 /* Interface to the parser module(s) -- the "front end" of the assembler */
-typedef struct parser_s {
+struct parser {
     /* one-line description of the parser */
     const char *name;
 
@@ -52,8 +52,8 @@ typedef struct parser_s {
      * This function returns the starting section of a linked list of sections
      * (whatever was in the file).
      */
-    sectionhead *(*do_parse) (struct parser_s *p, objfmt *of, FILE *f);
-} parser;
+    sectionhead *(*do_parse) (parser *p, objfmt *of, FILE *f);
+};
 
 /* Generic functions for all parsers - implemented in src/parser.c */
 
index 4b3754e44d694e81aa1c796d4c39e1b105243045..54893a7695ef90df3be9602fd496bf6b108ad499 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible bison parser
  *
  *  Copyright (C) 2001  Peter Johnson, Michael Urman
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 %{
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
 # include <math.h>
 #endif
 
-#include <libintl.h>
-#define _(String)      gettext(String)
-
 #include "bitvect.h"
 
 #include "globals.h"
 #include "section.h"
 #include "objfmt.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define YYDEBUG 1
 
index 4b3754e44d694e81aa1c796d4c39e1b105243045..54893a7695ef90df3be9602fd496bf6b108ad499 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible bison parser
  *
  *  Copyright (C) 2001  Peter Johnson, Michael Urman
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 %{
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
 #ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
 # include <math.h>
 #endif
 
-#include <libintl.h>
-#define _(String)      gettext(String)
-
 #include "bitvect.h"
 
 #include "globals.h"
 #include "section.h"
 #include "objfmt.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define YYDEBUG 1
 
index fffa8bdbe4478ef40e50727270ed39edf875a6ea..c1bab7edcf9ff73b943e7b9e5709107decf7ce1a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible parser
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "bytecode.h"
 #include "section.h"
 #include "objfmt.h"
 #include "preproc.h"
 #include "parser.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 extern FILE *nasm_parser_in;
 extern int nasm_parser_debug;
index fffa8bdbe4478ef40e50727270ed39edf875a6ea..c1bab7edcf9ff73b943e7b9e5709107decf7ce1a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible parser
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "bytecode.h"
 #include "section.h"
 #include "objfmt.h"
 #include "preproc.h"
 #include "parser.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 extern FILE *nasm_parser_in;
 extern int nasm_parser_debug;
index 6973afbe3e2cd0bf1e81c9d4350fc5a0954c1915..8c1d683446cafded20f4c5d037fa99a4d09e9f83 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * NASM-compatible lex lexer
  *
  *  Copyright (C) 2001  Peter Johnson
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 %{
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "bitvect.h"
 
 
 #include "bison.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 #define YY_NEVER_INTERACTIVE   1
 
index 760afc94d662726e0703d3ffee56d536a28327cc..fa64ecd17d5bd44f7d9c1c665ca354454797c741 100644 (file)
@@ -23,7 +23,7 @@
 #define YASM_PREPROC_H
 
 /* Interface to the preprocesor module(s) */
-typedef struct preproc_s {
+struct preproc {
     /* one-line description of the preprocessor */
     const char *name;
 
@@ -44,7 +44,7 @@ typedef struct preproc_s {
     /* Gets more preprocessed source code (up to max_size bytes) into buf.
      * Note that more than a single line may be returned in buf. */
     int (*input) (char *buf, int max_size);
-} preproc;
+};
 
 /* Available preprocessors */
 extern preproc raw_preproc;
index c655e4dfe589a54bded048f73595383e12d40416..8c692c2481b0229dd82e0631f0cd6344126e6109 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Raw preprocessor (preforms NO preprocessing)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "objfmt.h"
 #include "preproc.h"
 
-RCSID("$IdPath$");
 
 static int is_interactive;
 static FILE *in;
index c655e4dfe589a54bded048f73595383e12d40416..8c692c2481b0229dd82e0631f0cd6344126e6109 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Raw preprocessor (preforms NO preprocessing)
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#include "objfmt.h"
 #include "preproc.h"
 
-RCSID("$IdPath$");
 
 static int is_interactive;
 static FILE *in;
index 90608419febaffa5fad003ed80892523e0d76bdc..0ebccb7e67d69f886d97105fe5d544b0572b494a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Section utility functions
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define        _(String)       gettext(String)
-#ifdef gettext_noop
-#define        N_(String)      gettext_noop(String)
-#else
-#define        N_(String)      (String)
-#endif
+RCSID("$IdPath$");
 
 #include "globals.h"
 #include "errwarn.h"
 #include "section.h"
 #include "objfmt.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 struct section {
     STAILQ_ENTRY(section) link;
index ff99fb9d49a6f0e2d40357632767ebcec88c58ea..43e47bd14441b9e71209377524681e0afac813f8 100644 (file)
 #ifndef YASM_SECTION_H
 #define YASM_SECTION_H
 
-struct objfmt_s;
+struct objfmt;
 
-typedef STAILQ_HEAD(sectionhead, section) sectionhead;
+section *sections_initialize(sectionhead *headp, struct objfmt *of);
 
-#ifndef YASM_SECTION
-#define YASM_SECTION
-typedef struct section section;
-#endif
-
-section *sections_initialize(sectionhead *headp, struct objfmt_s *of);
-
-section *sections_switch(sectionhead *headp, struct objfmt_s *of,
+section *sections_switch(sectionhead *headp, struct objfmt *of,
                         const char *name);
 
 void sections_delete(sectionhead *headp);
index b0aa443cd168bfce44a68f18b6afa4b7556ee59f..15971ec4c5e23938078d11a3a666953206a92d2a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * strcasecmp() implementation for systems that don't have it or stricmp()
  * or strcmpi().
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
 RCSID("$IdPath$");
 
+
 #ifdef USE_OUR_OWN_STRCASECMP
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strcasecmp.c       8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef STDC_HEADERS
-# include <string.h>
-# include <ctype.h>
-#endif
+#include <ctype.h>
 
 int
 strcasecmp(const char *s1, const char *s2)
index 64a71889c74e075bdca15a61a1926e0248588687..4e35c4070ad8e28f5ac466ff6ae708b8fbf7dc3a 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * strsep() implementation for systems that don't have it.
  *
  * Copyright (c) 1990, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "util.h"
+RCSID("$IdPath$");
+
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strsep.c   8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-#include <string.h>
-#endif
-
-RCSID("$IdPath$");
 
 /*
  * Get next token from string *stringp, where tokens are possibly-empty
index aad043af4f4887bfba9d2667701be7d3c36f7f47..eccb034f7e66a7e0cf1b9541a082de826b0b3d98 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Symbol table handling
  *
  *  Copyright (C) 2001  Michael Urman, Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
+RCSID("$IdPath$");
 
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <string.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+#include "ternary.h"
 
 #include "globals.h"
 #include "errwarn.h"
 #include "bytecode.h"
 #include "section.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* DEFINED is set with EXTERN and COMMON below */
 typedef enum {
index c4a94f14ca7144816018b667fc4836d09ad81cd6..11ff4a09078d4a3b66ed7a8c225575ea3ee337d8 100644 (file)
 #ifndef YASM_SYMREC_H
 #define YASM_SYMREC_H
 
-#ifndef YASM_EXPR
-#define YASM_EXPR
-typedef struct expr expr;
-#endif
-
-#ifndef YASM_SECTION
-#define YASM_SECTION
-typedef struct section section;
-#endif
-
-#ifndef YASM_BYTECODE
-#define YASM_BYTECODE
-typedef struct bytecode bytecode;
-#endif
-
 /* EXTERN and COMMON are mutually exclusive */
 typedef enum {
     SYM_LOCAL = 0,             /* default, local only */
@@ -45,11 +30,6 @@ typedef enum {
     SYM_EXTERN = 1 << 2                /* if it's declared EXTERN */
 } SymVisibility;
 
-#ifndef YASM_SYMREC
-#define YASM_SYMREC
-typedef struct symrec symrec;
-#endif
-
 symrec *symrec_use(const char *name);
 symrec *symrec_define_equ(const char *name, expr *e);
 /* in_table specifies if the label should be inserted into the symbol table. */
index 9447bab9d544a31874e0009376ea979f3347331a..7d5af590e51745a027ee98dcca1dd2784afb9a44 100644 (file)
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    USA.  */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "util.h"
-
-#include <stdio.h>
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
 #include "ternary.h"
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-RCSID("$IdPath$");
 
 /* Non-recursive so we don't waste stack space/time on large
    insertions. */
index 6e0ae89de4fa2b059c40899872a4d2712b28926a..09e017fa5a4de5b7b1c8fef0caa80445748293cf 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#include <stdio.h>
+#include "util.h"
 
 #include "check.h"
 
index a56c3e9cd0bd40160468827477f03ce9107f208d..5d0bf8d7fd57563cfd87664bb88c9c59d2bd278f 100644 (file)
@@ -1,5 +1,7 @@
 /* $IdPath$
- * Defines prototypes for replacement functions if needed.
+ * Includes standard headers and defines prototypes for replacement functions
+ * if needed.  This is the *only* header file which should include other
+ * header files!
  *
  *  Copyright (C) 2001  Peter Johnson
  *
 #ifndef YASM_UTIL_H
 #define YASM_UTIL_H
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
 #ifdef STDC_HEADERS
 # include <stddef.h>
+# include <stdlib.h>
+# include <string.h>
 #endif
 
+#include <libintl.h>
+#define _(String)      gettext(String)
+
 #if !defined(HAVE_MERGESORT)
 int mergesort(void *base, size_t nmemb, size_t size,
              int (*compar)(const void *, const void *));
@@ -62,19 +75,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 # include "compat-queue.h"
 #endif
 
-#include "ternary.h"
-
-#ifndef DMALLOC
-/* strdup() implementation with error checking (using xmalloc). */
-char *xstrdup(const char *str);
-
-/* Error-checking memory allocation routines in xmalloc.c. */
-void *xmalloc(size_t size);
-void *xcalloc(size_t nelem, size_t elsize);
-void *xrealloc(void *oldmem, size_t size);
-void xfree(void *p);
-#endif
-
 #ifdef HAVE_SYS_CDEFS_H
 # include <sys/cdefs.h>
 #endif
@@ -93,4 +93,19 @@ void xfree(void *p);
 # endif
 #endif
 
+#ifdef DMALLOC
+# include <dmalloc.h>
+#else
+/* strdup() implementation with error checking (using xmalloc). */
+char *xstrdup(const char *str);
+
+/* Error-checking memory allocation routines in xmalloc.c. */
+void *xmalloc(size_t size);
+void *xcalloc(size_t nelem, size_t elsize);
+void *xrealloc(void *oldmem, size_t size);
+void xfree(void *p);
+#endif
+
+#include "coretype.h"
+
 #endif
index 77353c19363d41ed845eae9cfb14f2c66f2d354a..da38bd920665b1098bf396ee4a2bbb382f0c99ca 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * Memory allocation routines with error checking.  Idea from GNU libiberty.
  *
  *  Copyright (C) 2001  Peter Johnson
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include "util.h"
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-#endif
-
-#include <libintl.h>
-#define _(String)      gettext(String)
+RCSID("$IdPath$");
 
 #include "errwarn.h"
 
-#ifndef DMALLOC
 
-RCSID("$IdPath$");
+#ifndef DMALLOC
 
 void *
 xmalloc(size_t size)
index c0b3027221ec3c82b3b140d2214eeec068f0d09c..77cccba03306d2a74be9452876873dfe30e18980 100644 (file)
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * strdup() implementation with error checking (using xmalloc).
  *
  * Copyright (c) 1988, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "util.h"
+RCSID("$IdPath$");
+
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strdup.c   8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "util.h"
 
-#ifdef STDC_HEADERS
-# include <stddef.h>
-# include <string.h>
-#else
+#ifndef STDC_HEADERS
 size_t strlen(const char *);
 # ifndef HAVE_MEMCPY
 void bcopy(const void *, void *, size_t);
@@ -54,8 +49,6 @@ void memcpy(void *, const void *, size_t);
 
 #ifndef DMALLOC
 
-RCSID("$IdPath$");
-
 char *
 xstrdup(const char *str)
 {
index 64a71889c74e075bdca15a61a1926e0248588687..4e35c4070ad8e28f5ac466ff6ae708b8fbf7dc3a 100644 (file)
--- a/strsep.c
+++ b/strsep.c
@@ -1,4 +1,4 @@
-/* $IdPath$
+/*
  * strsep() implementation for systems that don't have it.
  *
  * Copyright (c) 1990, 1993
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "util.h"
+RCSID("$IdPath$");
+
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strsep.c   8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "util.h"
-
-#include <stdio.h>
-
-#ifdef STDC_HEADERS
-#include <string.h>
-#endif
-
-RCSID("$IdPath$");
 
 /*
  * Get next token from string *stringp, where tokens are possibly-empty
diff --git a/util.h b/util.h
index a56c3e9cd0bd40160468827477f03ce9107f208d..5d0bf8d7fd57563cfd87664bb88c9c59d2bd278f 100644 (file)
--- a/util.h
+++ b/util.h
@@ -1,5 +1,7 @@
 /* $IdPath$
- * Defines prototypes for replacement functions if needed.
+ * Includes standard headers and defines prototypes for replacement functions
+ * if needed.  This is the *only* header file which should include other
+ * header files!
  *
  *  Copyright (C) 2001  Peter Johnson
  *
 #ifndef YASM_UTIL_H
 #define YASM_UTIL_H
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
 #ifdef STDC_HEADERS
 # include <stddef.h>
+# include <stdlib.h>
+# include <string.h>
 #endif
 
+#include <libintl.h>
+#define _(String)      gettext(String)
+
 #if !defined(HAVE_MERGESORT)
 int mergesort(void *base, size_t nmemb, size_t size,
              int (*compar)(const void *, const void *));
@@ -62,19 +75,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 # include "compat-queue.h"
 #endif
 
-#include "ternary.h"
-
-#ifndef DMALLOC
-/* strdup() implementation with error checking (using xmalloc). */
-char *xstrdup(const char *str);
-
-/* Error-checking memory allocation routines in xmalloc.c. */
-void *xmalloc(size_t size);
-void *xcalloc(size_t nelem, size_t elsize);
-void *xrealloc(void *oldmem, size_t size);
-void xfree(void *p);
-#endif
-
 #ifdef HAVE_SYS_CDEFS_H
 # include <sys/cdefs.h>
 #endif
@@ -93,4 +93,19 @@ void xfree(void *p);
 # endif
 #endif
 
+#ifdef DMALLOC
+# include <dmalloc.h>
+#else
+/* strdup() implementation with error checking (using xmalloc). */
+char *xstrdup(const char *str);
+
+/* Error-checking memory allocation routines in xmalloc.c. */
+void *xmalloc(size_t size);
+void *xcalloc(size_t nelem, size_t elsize);
+void *xrealloc(void *oldmem, size_t size);
+void xfree(void *p);
+#endif
+
+#include "coretype.h"
+
 #endif