Add coretype.h, make util.h do a lot more, use util.h to simplify include

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
0.3
Peter Johnson 24 years ago
parent 405df52913
commit a7ac50c918
  1. 21
      frontends/yasm/yasm-options.c
  2. 21
      frontends/yasm/yasm.c
  3. 13
      libyasm/bitvect.c
  4. 23
      libyasm/bytecode.c
  5. 23
      libyasm/bytecode.h
  6. 69
      libyasm/coretype.h
  7. 17
      libyasm/errwarn.c
  8. 27
      libyasm/expr.c
  9. 50
      libyasm/expr.h
  10. 10
      libyasm/file.c
  11. 25
      libyasm/floatnum.c
  12. 35
      libyasm/floatnum.h
  13. 20
      libyasm/intnum.c
  14. 35
      libyasm/intnum.h
  15. 14
      libyasm/linemgr.c
  16. 13
      libyasm/mergesort.c
  17. 8
      libyasm/objfmt.h
  18. 4
      libyasm/optimizer.h
  19. 6
      libyasm/parser.h
  20. 4
      libyasm/preproc.h
  21. 26
      libyasm/section.c
  22. 13
      libyasm/section.h
  23. 14
      libyasm/strcasecmp.c
  24. 18
      libyasm/strsep.c
  25. 21
      libyasm/symrec.c
  26. 20
      libyasm/symrec.h
  27. 11
      libyasm/tests/memexpr_test.c
  28. 43
      libyasm/util.h
  29. 17
      libyasm/xmalloc.c
  30. 17
      libyasm/xstrdup.c
  31. 13
      mergesort.c
  32. 27
      modules/arch/x86/expr.c
  33. 27
      modules/arch/x86/x86expr.c
  34. 10
      modules/objfmts/dbg/dbg-objfmt.c
  35. 10
      modules/objfmts/dbg/objfmt.c
  36. 8
      modules/optimizers/basic/basic-optimizer.c
  37. 8
      modules/optimizers/basic/optimizer.c
  38. 8
      modules/optimizers/dbg/optimizer.c
  39. 17
      modules/parsers/nasm/bison.y.in
  40. 17
      modules/parsers/nasm/nasm-bison.y
  41. 15
      modules/parsers/nasm/nasm-parser.c
  42. 15
      modules/parsers/nasm/parser.c
  43. 20
      modules/parsers/nasm/token.l.in
  44. 14
      modules/preprocs/raw/preproc.c
  45. 14
      modules/preprocs/raw/raw-preproc.c
  46. 27
      src/arch/x86/expr.c
  47. 27
      src/arch/x86/x86expr.c
  48. 13
      src/bitvect.c
  49. 23
      src/bytecode.c
  50. 23
      src/bytecode.h
  51. 69
      src/coretype.h
  52. 17
      src/errwarn.c
  53. 27
      src/expr.c
  54. 50
      src/expr.h
  55. 10
      src/file.c
  56. 25
      src/floatnum.c
  57. 35
      src/floatnum.h
  58. 14
      src/globals.c
  59. 20
      src/intnum.c
  60. 35
      src/intnum.h
  61. 14
      src/linemgr.c
  62. 21
      src/main.c
  63. 13
      src/mergesort.c
  64. 8
      src/objfmt.h
  65. 10
      src/objfmts/dbg/dbg-objfmt.c
  66. 10
      src/objfmts/dbg/objfmt.c
  67. 4
      src/optimizer.h
  68. 8
      src/optimizers/basic/basic-optimizer.c
  69. 8
      src/optimizers/basic/optimizer.c
  70. 8
      src/optimizers/dbg/optimizer.c
  71. 21
      src/options.c
  72. 23
      src/parser.c
  73. 6
      src/parser.h
  74. 17
      src/parsers/nasm/bison.y.in
  75. 17
      src/parsers/nasm/nasm-bison.y
  76. 15
      src/parsers/nasm/nasm-parser.c
  77. 15
      src/parsers/nasm/parser.c
  78. 20
      src/parsers/nasm/token.l.in
  79. 4
      src/preproc.h
  80. 14
      src/preprocs/raw/preproc.c
  81. 14
      src/preprocs/raw/raw-preproc.c
  82. 26
      src/section.c
  83. 13
      src/section.h
  84. 14
      src/strcasecmp.c
  85. 18
      src/strsep.c
  86. 21
      src/symrec.c
  87. 20
      src/symrec.h
  88. 12
      src/ternary.c
  89. 11
      src/tests/memexpr_test.c
  90. 43
      src/util.h
  91. 17
      src/xmalloc.c
  92. 17
      src/xstrdup.c
  93. 18
      strsep.c
  94. 43
      util.h

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Generic Options Support Header File
*
* Copyright (c) 2001 Stanislav Karchebny <berk@madfire.net>
@ -27,25 +27,8 @@
* 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"

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Program entry point, command line parsing
*
* Copyright (C) 2001 Peter Johnson
@ -19,21 +19,9 @@
* 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
@ -53,11 +41,6 @@
#include "preproc.h"
#include "parser.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#ifndef countof
#define countof(x,y) (sizeof(x)/sizeof(y))

@ -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 */

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Bytecode utility functions
*
* Copyright (C) 2001 Peter Johnson
@ -19,35 +19,16 @@
* 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 */

@ -22,31 +22,10 @@
#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;

@ -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

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
@ -19,23 +19,15 @@
* 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
@ -45,11 +37,6 @@
#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. */

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Expression handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,26 +19,8 @@
* 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"
@ -49,11 +31,6 @@
#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 {

@ -22,58 +22,8 @@
#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 *);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Little-endian file functions.
*
* Copyright (C) 2001 Peter Johnson
@ -19,17 +19,11 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Floating point number functions.
*
* Copyright (C) 2001 Peter Johnson
@ -21,38 +21,17 @@
* 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

@ -24,41 +24,6 @@
#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);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Integer number functions.
*
* Copyright (C) 2001 Peter Johnson
@ -19,33 +19,17 @@
* 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

@ -22,41 +22,6 @@
#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);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Global variables
*
* Copyright (C) 2001 Peter Johnson
@ -19,21 +19,13 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* mergesort() implementation for systems that don't have it.
*
* Copyright (c) 1992, 1993
@ -31,19 +31,10 @@
* 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 */

@ -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;

@ -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;

@ -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 */

@ -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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Section utility functions
*
* Copyright (C) 2001 Peter Johnson
@ -19,25 +19,8 @@
* 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"
@ -47,11 +30,6 @@
#include "section.h"
#include "objfmt.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
struct section {
STAILQ_ENTRY(section) link;

@ -22,18 +22,11 @@
#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);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* strcasecmp() implementation for systems that don't have it or stricmp()
* or strcmpi().
*
@ -29,25 +29,17 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* strsep() implementation for systems that don't have it.
*
* Copyright (c) 1990, 1993
@ -28,24 +28,14 @@
* 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

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Symbol table handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,20 +19,10 @@
* 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"
@ -43,11 +33,6 @@
#include "bytecode.h"
#include "section.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
/* DEFINED is set with EXTERN and COMMON below */
typedef enum {

@ -22,21 +22,6 @@
#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. */

@ -18,16 +18,7 @@
* 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"

@ -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
*
@ -22,10 +24,21 @@
#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

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Memory allocation routines with error checking. Idea from GNU libiberty.
*
* Copyright (C) 2001 Peter Johnson
@ -19,24 +19,13 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* strdup() implementation with error checking (using xmalloc).
*
* Copyright (c) 1988, 1993
@ -28,21 +28,16 @@
* 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)
{

@ -1,4 +1,4 @@
/* $IdPath$
/*
* mergesort() implementation for systems that don't have it.
*
* Copyright (c) 1992, 1993
@ -31,19 +31,10 @@
* 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 */

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Expression handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,26 +19,8 @@
* 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"
@ -49,11 +31,6 @@
#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 {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Expression handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,26 +19,8 @@
* 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"
@ -49,11 +31,6 @@
#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 {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging object format (used to debug object format module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,17 +19,11 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging object format (used to debug object format module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,17 +19,11 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging optimizer (used to debug optimizer module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,15 +19,11 @@
* 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 = {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging optimizer (used to debug optimizer module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,15 +19,11 @@
* 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 = {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging optimizer (used to debug optimizer module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,15 +19,11 @@
* 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 = {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
@ -20,21 +20,13 @@
* 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"
@ -48,11 +40,6 @@
#include "section.h"
#include "objfmt.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#define YYDEBUG 1

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
@ -20,21 +20,13 @@
* 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"
@ -48,11 +40,6 @@
#include "section.h"
#include "objfmt.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#define YYDEBUG 1

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible parser
*
* Copyright (C) 2001 Peter Johnson
@ -19,27 +19,16 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible parser
*
* Copyright (C) 2001 Peter Johnson
@ -19,27 +19,16 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible lex lexer
*
* Copyright (C) 2001 Peter Johnson
@ -20,19 +20,8 @@
* 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"
@ -46,11 +35,6 @@
#include "bison.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#define YY_NEVER_INTERACTIVE 1

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
@ -19,23 +19,13 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
@ -19,23 +19,13 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Expression handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,26 +19,8 @@
* 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"
@ -49,11 +31,6 @@
#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 {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Expression handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,26 +19,8 @@
* 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"
@ -49,11 +31,6 @@
#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 {

@ -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 */

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Bytecode utility functions
*
* Copyright (C) 2001 Peter Johnson
@ -19,35 +19,16 @@
* 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 */

@ -22,31 +22,10 @@
#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;

@ -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

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
@ -19,23 +19,15 @@
* 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
@ -45,11 +37,6 @@
#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. */

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Expression handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,26 +19,8 @@
* 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"
@ -49,11 +31,6 @@
#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 {

@ -22,58 +22,8 @@
#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 *);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Little-endian file functions.
*
* Copyright (C) 2001 Peter Johnson
@ -19,17 +19,11 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Floating point number functions.
*
* Copyright (C) 2001 Peter Johnson
@ -21,38 +21,17 @@
* 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

@ -24,41 +24,6 @@
#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);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Global variables
*
* Copyright (C) 2001 Peter Johnson
@ -19,21 +19,13 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Integer number functions.
*
* Copyright (C) 2001 Peter Johnson
@ -19,33 +19,17 @@
* 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

@ -22,41 +22,6 @@
#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);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Global variables
*
* Copyright (C) 2001 Peter Johnson
@ -19,21 +19,13 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Program entry point, command line parsing
*
* Copyright (C) 2001 Peter Johnson
@ -19,21 +19,9 @@
* 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
@ -53,11 +41,6 @@
#include "preproc.h"
#include "parser.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#ifndef countof
#define countof(x,y) (sizeof(x)/sizeof(y))

@ -1,4 +1,4 @@
/* $IdPath$
/*
* mergesort() implementation for systems that don't have it.
*
* Copyright (c) 1992, 1993
@ -31,19 +31,10 @@
* 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 */

@ -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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging object format (used to debug object format module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,17 +19,11 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging object format (used to debug object format module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,17 +19,11 @@
* 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)

@ -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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging optimizer (used to debug optimizer module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,15 +19,11 @@
* 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 = {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging optimizer (used to debug optimizer module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,15 +19,11 @@
* 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 = {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Debugging optimizer (used to debug optimizer module interface)
*
* Copyright (C) 2001 Peter Johnson
@ -19,15 +19,11 @@
* 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 = {

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Generic Options Support Header File
*
* Copyright (c) 2001 Stanislav Karchebny <berk@madfire.net>
@ -27,25 +27,8 @@
* 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"

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Generic functions for all parsers
*
* Copyright (C) 2001 Peter Johnson
@ -19,33 +19,14 @@
* 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.

@ -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 */

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
@ -20,21 +20,13 @@
* 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"
@ -48,11 +40,6 @@
#include "section.h"
#include "objfmt.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#define YYDEBUG 1

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
@ -20,21 +20,13 @@
* 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"
@ -48,11 +40,6 @@
#include "section.h"
#include "objfmt.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#define YYDEBUG 1

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible parser
*
* Copyright (C) 2001 Peter Johnson
@ -19,27 +19,16 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible parser
*
* Copyright (C) 2001 Peter Johnson
@ -19,27 +19,16 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* NASM-compatible lex lexer
*
* Copyright (C) 2001 Peter Johnson
@ -20,19 +20,8 @@
* 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"
@ -46,11 +35,6 @@
#include "bison.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
#define YY_NEVER_INTERACTIVE 1

@ -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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
@ -19,23 +19,13 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
@ -19,23 +19,13 @@
* 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;

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Section utility functions
*
* Copyright (C) 2001 Peter Johnson
@ -19,25 +19,8 @@
* 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"
@ -47,11 +30,6 @@
#include "section.h"
#include "objfmt.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
struct section {
STAILQ_ENTRY(section) link;

@ -22,18 +22,11 @@
#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);

@ -1,4 +1,4 @@
/* $IdPath$
/*
* strcasecmp() implementation for systems that don't have it or stricmp()
* or strcmpi().
*
@ -29,25 +29,17 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* strsep() implementation for systems that don't have it.
*
* Copyright (c) 1990, 1993
@ -28,24 +28,14 @@
* 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

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Symbol table handling
*
* Copyright (C) 2001 Michael Urman, Peter Johnson
@ -19,20 +19,10 @@
* 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"
@ -43,11 +33,6 @@
#include "bytecode.h"
#include "section.h"
#ifdef DMALLOC
# include <dmalloc.h>
#endif
RCSID("$IdPath$");
/* DEFINED is set with EXTERN and COMMON below */
typedef enum {

@ -22,21 +22,6 @@
#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. */

@ -20,23 +20,13 @@
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. */

@ -18,16 +18,7 @@
* 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"

@ -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
*
@ -22,10 +24,21 @@
#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

@ -1,4 +1,4 @@
/* $IdPath$
/*
* Memory allocation routines with error checking. Idea from GNU libiberty.
*
* Copyright (C) 2001 Peter Johnson
@ -19,24 +19,13 @@
* 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)

@ -1,4 +1,4 @@
/* $IdPath$
/*
* strdup() implementation with error checking (using xmalloc).
*
* Copyright (c) 1988, 1993
@ -28,21 +28,16 @@
* 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)
{

@ -1,4 +1,4 @@
/* $IdPath$
/*
* strsep() implementation for systems that don't have it.
*
* Copyright (c) 1990, 1993
@ -28,24 +28,14 @@
* 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

@ -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
*
@ -22,10 +24,21 @@
#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

Loading…
Cancel
Save