2002-05-01 04:53:55 +08:00
|
|
|
/* nasmlib.h header file for nasmlib.c
|
2002-05-01 04:51:32 +08:00
|
|
|
*
|
|
|
|
* The Netwide Assembler is copyright (C) 1996 Simon Tatham and
|
|
|
|
* Julian Hall. All rights reserved. The software is
|
2007-12-29 22:44:23 +08:00
|
|
|
* redistributable under the license given in the file "LICENSE"
|
2002-05-01 04:51:32 +08:00
|
|
|
* distributed in the NASM archive.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NASM_NASMLIB_H
|
|
|
|
#define NASM_NASMLIB_H
|
|
|
|
|
2007-10-03 12:53:51 +08:00
|
|
|
#include "compiler.h"
|
|
|
|
|
2007-09-12 09:29:43 +08:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdio.h>
|
2007-10-03 12:53:51 +08:00
|
|
|
#include <string.h>
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
2007-09-12 09:29:43 +08:00
|
|
|
|
2002-05-01 04:52:08 +08:00
|
|
|
/*
|
|
|
|
* If this is defined, the wrappers around malloc et al will
|
|
|
|
* transform into logging variants, which will cause NASM to create
|
|
|
|
* a file called `malloc.log' when run, and spew details of all its
|
|
|
|
* memory management into that. That can then be analysed to detect
|
|
|
|
* memory leaks and potentially other problems too.
|
|
|
|
*/
|
|
|
|
/* #define LOGALLOC */
|
|
|
|
|
2007-09-20 12:40:37 +08:00
|
|
|
/*
|
|
|
|
* -------------------------
|
|
|
|
* Error reporting functions
|
|
|
|
* -------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An error reporting function should look like this.
|
|
|
|
*/
|
|
|
|
typedef void (*efunc) (int severity, const char *fmt, ...);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These are the error severity codes which get passed as the first
|
|
|
|
* argument to an efunc.
|
|
|
|
*/
|
|
|
|
|
2007-10-20 05:42:29 +08:00
|
|
|
#define ERR_DEBUG 0x00000008 /* put out debugging message */
|
2007-09-20 12:40:37 +08:00
|
|
|
#define ERR_WARNING 0x00000000 /* warn only: no further action */
|
|
|
|
#define ERR_NONFATAL 0x00000001 /* terminate assembly after phase */
|
|
|
|
#define ERR_FATAL 0x00000002 /* instantly fatal: exit with error */
|
|
|
|
#define ERR_PANIC 0x00000003 /* internal error: panic instantly
|
|
|
|
* and dump core for reference */
|
|
|
|
#define ERR_MASK 0x0000000F /* mask off the above codes */
|
|
|
|
#define ERR_NOFILE 0x00000010 /* don't give source file name/line */
|
|
|
|
#define ERR_USAGE 0x00000020 /* print a usage message */
|
|
|
|
#define ERR_PASS1 0x00000040 /* only print this error on pass one */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These codes define specific types of suppressible warning.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ERR_WARN_MASK 0x0000FF00 /* the mask for this feature */
|
2007-10-20 05:42:29 +08:00
|
|
|
#define ERR_WARN_SHR 8 /* how far to shift right */
|
2007-09-20 12:40:37 +08:00
|
|
|
|
2007-10-17 02:32:58 +08:00
|
|
|
#define WARN(x) ((x) << ERR_WARN_SHR)
|
|
|
|
|
|
|
|
#define ERR_WARN_MNP WARN(1) /* macro-num-parameters warning */
|
|
|
|
#define ERR_WARN_MSR WARN(2) /* macro self-reference */
|
|
|
|
#define ERR_WARN_OL WARN(3) /* orphan label (no colon, and
|
2007-09-20 12:40:37 +08:00
|
|
|
* alone on line) */
|
2007-10-17 02:32:58 +08:00
|
|
|
#define ERR_WARN_NOV WARN(4) /* numeric overflow */
|
|
|
|
#define ERR_WARN_GNUELF WARN(5) /* using GNU ELF extensions */
|
|
|
|
#define ERR_WARN_FL_OVERFLOW WARN(6) /* FP overflow */
|
|
|
|
#define ERR_WARN_FL_DENORM WARN(7) /* FP denormal */
|
|
|
|
#define ERR_WARN_FL_UNDERFLOW WARN(8) /* FP underflow */
|
|
|
|
#define ERR_WARN_FL_TOOLONG WARN(9) /* FP too many digits */
|
2007-10-17 02:48:07 +08:00
|
|
|
#define ERR_WARN_MAX 9 /* the highest numbered one */
|
2007-09-20 12:40:37 +08:00
|
|
|
|
2002-05-01 04:51:32 +08:00
|
|
|
/*
|
|
|
|
* Wrappers around malloc, realloc and free. nasm_malloc will
|
|
|
|
* fatal-error and die rather than return NULL; nasm_realloc will
|
|
|
|
* do likewise, and will also guarantee to work right on being
|
|
|
|
* passed a NULL pointer; nasm_free will do nothing if it is passed
|
|
|
|
* a NULL pointer.
|
|
|
|
*/
|
2005-01-16 06:15:51 +08:00
|
|
|
void nasm_set_malloc_error(efunc);
|
2002-05-01 04:52:08 +08:00
|
|
|
#ifndef LOGALLOC
|
2005-01-16 06:15:51 +08:00
|
|
|
void *nasm_malloc(size_t);
|
2007-09-26 05:27:34 +08:00
|
|
|
void *nasm_zalloc(size_t);
|
2005-01-16 06:15:51 +08:00
|
|
|
void *nasm_realloc(void *, size_t);
|
|
|
|
void nasm_free(void *);
|
2007-04-14 00:47:53 +08:00
|
|
|
char *nasm_strdup(const char *);
|
|
|
|
char *nasm_strndup(char *, size_t);
|
2002-05-01 04:52:08 +08:00
|
|
|
#else
|
2007-04-14 00:47:53 +08:00
|
|
|
void *nasm_malloc_log(char *, int, size_t);
|
2007-09-26 05:27:34 +08:00
|
|
|
void *nasm_zalloc_log(char *, int, size_t);
|
2007-04-14 00:47:53 +08:00
|
|
|
void *nasm_realloc_log(char *, int, void *, size_t);
|
|
|
|
void nasm_free_log(char *, int, void *);
|
|
|
|
char *nasm_strdup_log(char *, int, const char *);
|
|
|
|
char *nasm_strndup_log(char *, int, char *, size_t);
|
2002-05-01 04:52:08 +08:00
|
|
|
#define nasm_malloc(x) nasm_malloc_log(__FILE__,__LINE__,x)
|
2008-01-22 08:28:04 +08:00
|
|
|
#define nasm_zalloc(x) nasm_zalloc_log(__FILE__,__LINE__,x)
|
2002-05-01 04:52:08 +08:00
|
|
|
#define nasm_realloc(x,y) nasm_realloc_log(__FILE__,__LINE__,x,y)
|
|
|
|
#define nasm_free(x) nasm_free_log(__FILE__,__LINE__,x)
|
|
|
|
#define nasm_strdup(x) nasm_strdup_log(__FILE__,__LINE__,x)
|
2002-05-01 04:52:49 +08:00
|
|
|
#define nasm_strndup(x,y) nasm_strndup_log(__FILE__,__LINE__,x,y)
|
2002-05-01 04:52:08 +08:00
|
|
|
#endif
|
2002-05-01 04:51:32 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ANSI doesn't guarantee the presence of `stricmp' or
|
|
|
|
* `strcasecmp'.
|
|
|
|
*/
|
2007-10-03 12:53:51 +08:00
|
|
|
#if defined(HAVE_STRCASECMP)
|
2002-05-01 04:59:21 +08:00
|
|
|
#define nasm_stricmp strcasecmp
|
2007-10-03 12:53:51 +08:00
|
|
|
#elif defined(HAVE_STRICMP)
|
|
|
|
#define nasm_stricmp stricmp
|
2002-05-01 04:59:21 +08:00
|
|
|
#else
|
2007-04-14 00:47:53 +08:00
|
|
|
int nasm_stricmp(const char *, const char *);
|
2002-05-01 04:59:21 +08:00
|
|
|
#endif
|
|
|
|
|
2007-10-03 12:53:51 +08:00
|
|
|
#if defined(HAVE_STRNCASECMP)
|
2002-05-01 04:59:21 +08:00
|
|
|
#define nasm_strnicmp strncasecmp
|
2007-10-03 12:53:51 +08:00
|
|
|
#elif defined(HAVE_STRNICMP)
|
|
|
|
#define nasm_strnicmp strnicmp
|
2002-05-01 04:59:21 +08:00
|
|
|
#else
|
2007-04-14 00:47:53 +08:00
|
|
|
int nasm_strnicmp(const char *, const char *, int);
|
2002-05-01 04:59:21 +08:00
|
|
|
#endif
|
2002-05-01 04:51:32 +08:00
|
|
|
|
2007-10-03 12:53:51 +08:00
|
|
|
#if defined(HAVE_STRSEP)
|
2007-08-26 13:48:54 +08:00
|
|
|
#define nasm_strsep strsep
|
|
|
|
#else
|
|
|
|
char *nasm_strsep(char **stringp, const char *delim);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-05-01 04:51:32 +08:00
|
|
|
/*
|
|
|
|
* Convert a string into a number, using NASM number rules. Sets
|
2007-10-11 05:58:45 +08:00
|
|
|
* `*error' to true if an error occurs, and false otherwise.
|
2002-05-01 04:51:32 +08:00
|
|
|
*/
|
2007-10-11 15:05:31 +08:00
|
|
|
int64_t readnum(char *str, bool *error);
|
2002-05-01 04:51:32 +08:00
|
|
|
|
2002-05-01 04:53:55 +08:00
|
|
|
/*
|
|
|
|
* Convert a character constant into a number. Sets
|
2007-10-11 05:58:45 +08:00
|
|
|
* `*warn' to true if an overflow occurs, and false otherwise.
|
2002-05-01 04:53:55 +08:00
|
|
|
* str points to and length covers the middle of the string,
|
|
|
|
* without the quotes.
|
|
|
|
*/
|
2007-10-11 15:05:31 +08:00
|
|
|
int64_t readstrnum(char *str, int length, bool *warn);
|
2002-05-01 04:53:55 +08:00
|
|
|
|
2002-05-01 04:51:32 +08:00
|
|
|
/*
|
|
|
|
* seg_init: Initialise the segment-number allocator.
|
|
|
|
* seg_alloc: allocate a hitherto unused segment number.
|
|
|
|
*/
|
|
|
|
void seg_init(void);
|
2007-04-12 10:40:54 +08:00
|
|
|
int32_t seg_alloc(void);
|
2002-05-01 04:51:32 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* many output formats will be able to make use of this: a standard
|
|
|
|
* function to add an extension to the name of the input file
|
|
|
|
*/
|
2002-05-01 04:52:08 +08:00
|
|
|
#ifdef NASM_NASM_H
|
2007-04-14 00:47:53 +08:00
|
|
|
void standard_extension(char *inname, char *outname, char *extension,
|
2005-01-16 06:15:51 +08:00
|
|
|
efunc error);
|
2002-05-01 04:52:08 +08:00
|
|
|
#endif
|
2002-05-01 04:51:32 +08:00
|
|
|
|
2007-11-09 11:30:22 +08:00
|
|
|
/*
|
|
|
|
* Utility macros...
|
|
|
|
*
|
|
|
|
* This is a useful #define which I keep meaning to use more often:
|
|
|
|
* the number of elements of a statically defined array.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define elements(x) ( sizeof(x) / sizeof(*(x)) )
|
|
|
|
|
|
|
|
|
2002-05-01 04:51:32 +08:00
|
|
|
/*
|
|
|
|
* some handy macros that will probably be of use in more than one
|
|
|
|
* output format: convert integers into little-endian byte packed
|
|
|
|
* format in memory
|
|
|
|
*/
|
|
|
|
|
2007-11-14 01:46:38 +08:00
|
|
|
#if X86_MEMORY
|
|
|
|
|
|
|
|
#define WRITECHAR(p,v) \
|
|
|
|
do { \
|
|
|
|
*(uint8_t *)(p) = (v); \
|
|
|
|
(p) += 1; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITESHORT(p,v) \
|
|
|
|
do { \
|
|
|
|
*(uint16_t *)(p) = (v); \
|
|
|
|
(p) += 2; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITELONG(p,v) \
|
|
|
|
do { \
|
|
|
|
*(uint32_t *)(p) = (v); \
|
|
|
|
(p) += 4; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITEDLONG(p,v) \
|
|
|
|
do { \
|
|
|
|
*(uint64_t *)(p) = (v); \
|
|
|
|
(p) += 8; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITEADDR(p,v,s) \
|
|
|
|
do { \
|
|
|
|
uint64_t _v = (v); \
|
|
|
|
memcpy((p), &_v, (s)); \
|
|
|
|
(p) += (s); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#else /* !X86_MEMORY */
|
|
|
|
|
2008-02-17 07:25:02 +08:00
|
|
|
#define WRITECHAR(p,v) \
|
|
|
|
do { \
|
|
|
|
uint8_t *_p = (uint8_t *)(p); \
|
|
|
|
uint8_t _v = (v); \
|
|
|
|
_p[0] = _v; \
|
|
|
|
(p) = (void *)(_p + 1); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITESHORT(p,v) \
|
|
|
|
do { \
|
|
|
|
uint8_t *_p = (uint8_t *)(p); \
|
|
|
|
uint16_t _v = (v); \
|
|
|
|
_p[0] = _v; \
|
|
|
|
_p[1] = _v >> 8; \
|
|
|
|
(p) = (void *)(_p + 2); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITELONG(p,v) \
|
|
|
|
do { \
|
|
|
|
uint8_t *_p = (uint8_t *)(p); \
|
|
|
|
uint32_t _v = (v); \
|
|
|
|
_p[0] = _v; \
|
|
|
|
_p[1] = _v >> 8; \
|
|
|
|
_p[2] = _v >> 16; \
|
|
|
|
_p[3] = _v >> 24; \
|
|
|
|
(p) = (void *)(_p + 4); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITEDLONG(p,v) \
|
|
|
|
do { \
|
|
|
|
uint8_t *_p = (uint8_t *)(p); \
|
|
|
|
uint64_t _v = (v); \
|
|
|
|
_p[0] = _v; \
|
|
|
|
_p[1] = _v >> 8; \
|
|
|
|
_p[2] = _v >> 16; \
|
|
|
|
_p[3] = _v >> 24; \
|
|
|
|
_p[4] = _v >> 32; \
|
|
|
|
_p[5] = _v >> 40; \
|
|
|
|
_p[6] = _v >> 48; \
|
|
|
|
_p[7] = _v >> 56; \
|
|
|
|
(p) = (void *)(_p + 8); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define WRITEADDR(p,v,s) \
|
2007-11-14 01:37:59 +08:00
|
|
|
do { \
|
|
|
|
int _s = (s); \
|
|
|
|
uint64_t _v = (v); \
|
|
|
|
while (_s--) { \
|
|
|
|
WRITECHAR(p,_v); \
|
|
|
|
_v >>= 8; \
|
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
2007-11-14 01:46:38 +08:00
|
|
|
#endif
|
|
|
|
|
2002-05-01 04:51:32 +08:00
|
|
|
/*
|
|
|
|
* and routines to do the same thing to a file
|
|
|
|
*/
|
2007-11-14 01:37:59 +08:00
|
|
|
#define fwriteint8_t(d,f) putc(d,f)
|
2007-11-14 02:37:23 +08:00
|
|
|
void fwriteint16_t(uint16_t data, FILE * fp);
|
|
|
|
void fwriteint32_t(uint32_t data, FILE * fp);
|
|
|
|
void fwriteint64_t(uint64_t data, FILE * fp);
|
|
|
|
void fwriteaddr(uint64_t data, int size, FILE * fp);
|
2002-05-01 04:51:32 +08:00
|
|
|
|
|
|
|
/*
|
2008-01-22 08:33:00 +08:00
|
|
|
* Routines to manage a dynamic random access array of int64_ts which
|
2002-05-01 04:51:32 +08:00
|
|
|
* may grow in size to be more than the largest single malloc'able
|
|
|
|
* chunk.
|
|
|
|
*/
|
|
|
|
|
2008-01-22 08:33:00 +08:00
|
|
|
#define RAA_BLKSHIFT 15 /* 2**this many longs allocated at once */
|
|
|
|
#define RAA_BLKSIZE (1 << RAA_BLKSHIFT)
|
|
|
|
#define RAA_LAYERSHIFT 15 /* 2**this many _pointers_ allocated */
|
|
|
|
#define RAA_LAYERSIZE (1 << RAA_LAYERSHIFT)
|
2002-05-01 04:53:55 +08:00
|
|
|
|
|
|
|
typedef struct RAA RAA;
|
|
|
|
typedef union RAA_UNION RAA_UNION;
|
|
|
|
typedef struct RAA_LEAF RAA_LEAF;
|
|
|
|
typedef struct RAA_BRANCH RAA_BRANCH;
|
|
|
|
|
|
|
|
struct RAA {
|
|
|
|
/*
|
|
|
|
* Number of layers below this one to get to the real data. 0
|
|
|
|
* means this structure is a leaf, holding RAA_BLKSIZE real
|
|
|
|
* data items; 1 and above mean it's a branch, holding
|
|
|
|
* RAA_LAYERSIZE pointers to the next level branch or leaf
|
|
|
|
* structures.
|
|
|
|
*/
|
|
|
|
int layers;
|
2008-01-22 08:33:00 +08:00
|
|
|
|
2002-05-01 04:53:55 +08:00
|
|
|
/*
|
|
|
|
* Number of real data items spanned by one position in the
|
2008-01-22 08:33:00 +08:00
|
|
|
* `data' array at this level. This number is 0 trivially, for
|
2002-05-01 04:53:55 +08:00
|
|
|
* a leaf (level 0): for a level 1 branch it should be
|
2008-01-22 08:33:00 +08:00
|
|
|
* RAA_BLKSHIFT, and for a level 2 branch it's
|
|
|
|
* RAA_LAYERSHIFT+RAA_BLKSHIFT.
|
2002-05-01 04:53:55 +08:00
|
|
|
*/
|
2008-01-22 08:33:00 +08:00
|
|
|
int shift;
|
|
|
|
|
2002-05-01 04:53:55 +08:00
|
|
|
union RAA_UNION {
|
2005-01-16 06:15:51 +08:00
|
|
|
struct RAA_LEAF {
|
2007-11-08 11:03:46 +08:00
|
|
|
int64_t data[RAA_BLKSIZE];
|
2005-01-16 06:15:51 +08:00
|
|
|
} l;
|
|
|
|
struct RAA_BRANCH {
|
|
|
|
struct RAA *data[RAA_LAYERSIZE];
|
|
|
|
} b;
|
2002-05-01 04:53:55 +08:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2005-01-16 06:15:51 +08:00
|
|
|
struct RAA *raa_init(void);
|
|
|
|
void raa_free(struct RAA *);
|
2007-11-08 11:03:46 +08:00
|
|
|
int64_t raa_read(struct RAA *, int32_t);
|
|
|
|
struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value);
|
2002-05-01 04:51:32 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Routines to manage a dynamic sequential-access array, under the
|
|
|
|
* same restriction on maximum mallocable block. This array may be
|
|
|
|
* written to in two ways: a contiguous chunk can be reserved of a
|
2007-04-12 10:40:54 +08:00
|
|
|
* given size with a pointer returned OR single-byte data may be
|
2002-05-01 04:51:32 +08:00
|
|
|
* written. The array can also be read back in the same two ways:
|
|
|
|
* as a series of big byte-data blocks or as a list of structures
|
|
|
|
* of a given size.
|
|
|
|
*/
|
|
|
|
|
2002-05-01 04:53:55 +08:00
|
|
|
struct SAA {
|
|
|
|
/*
|
|
|
|
* members `end' and `elem_len' are only valid in first link in
|
|
|
|
* list; `rptr' and `rpos' are used for reading
|
|
|
|
*/
|
2007-10-05 04:42:56 +08:00
|
|
|
size_t elem_len; /* Size of each element */
|
|
|
|
size_t blk_len; /* Size of each allocation block */
|
|
|
|
size_t nblks; /* Total number of allocated blocks */
|
|
|
|
size_t nblkptrs; /* Total number of allocation block pointers */
|
|
|
|
size_t length; /* Total allocated length of the array */
|
|
|
|
size_t datalen; /* Total data length of the array */
|
|
|
|
char **wblk; /* Write block pointer */
|
|
|
|
size_t wpos; /* Write position inside block */
|
|
|
|
size_t wptr; /* Absolute write position */
|
|
|
|
char **rblk; /* Read block pointer */
|
|
|
|
size_t rpos; /* Read position inside block */
|
|
|
|
size_t rptr; /* Absolute read position */
|
|
|
|
char **blk_ptrs; /* Pointer to pointer blocks */
|
2002-05-01 04:53:55 +08:00
|
|
|
};
|
2002-05-01 04:51:32 +08:00
|
|
|
|
2007-10-05 04:42:56 +08:00
|
|
|
struct SAA *saa_init(size_t elem_len); /* 1 == byte */
|
2005-01-16 06:15:51 +08:00
|
|
|
void saa_free(struct SAA *);
|
|
|
|
void *saa_wstruct(struct SAA *); /* return a structure of elem_len */
|
2007-10-05 04:42:56 +08:00
|
|
|
void saa_wbytes(struct SAA *, const void *, size_t); /* write arbitrary bytes */
|
2008-02-25 11:14:17 +08:00
|
|
|
void saa_wleb128u(struct SAA *, int); /* write unsigned LEB128 value */
|
|
|
|
void saa_wleb128s(struct SAA *, int); /* write signed LEB128 value */
|
2005-01-16 06:15:51 +08:00
|
|
|
void saa_rewind(struct SAA *); /* for reading from beginning */
|
|
|
|
void *saa_rstruct(struct SAA *); /* return NULL on EOA */
|
2007-10-05 04:42:56 +08:00
|
|
|
const void *saa_rbytes(struct SAA *, size_t *); /* return 0 on EOA */
|
|
|
|
void saa_rnbytes(struct SAA *, void *, size_t); /* read a given no. of bytes */
|
|
|
|
/* random access */
|
|
|
|
void saa_fread(struct SAA *, size_t, void *, size_t);
|
|
|
|
void saa_fwrite(struct SAA *, size_t, const void *, size_t);
|
|
|
|
|
|
|
|
/* dump to file */
|
2005-01-16 06:15:51 +08:00
|
|
|
void saa_fpwrite(struct SAA *, FILE *);
|
2002-05-01 04:51:32 +08:00
|
|
|
|
2002-05-01 04:52:49 +08:00
|
|
|
/*
|
|
|
|
* Binary search routine. Returns index into `array' of an entry
|
|
|
|
* matching `string', or <0 if no match. `array' is taken to
|
|
|
|
* contain `size' elements.
|
2007-08-30 00:25:46 +08:00
|
|
|
*
|
|
|
|
* bsi() is case sensitive, bsii() is case insensitive.
|
2002-05-01 04:52:49 +08:00
|
|
|
*/
|
2007-11-09 11:15:33 +08:00
|
|
|
int bsi(const char *string, const char **array, int size);
|
|
|
|
int bsii(const char *string, const char **array, int size);
|
2002-05-01 04:53:55 +08:00
|
|
|
|
2007-04-14 00:47:53 +08:00
|
|
|
char *src_set_fname(char *newname);
|
2007-04-12 10:40:54 +08:00
|
|
|
int32_t src_set_linnum(int32_t newline);
|
|
|
|
int32_t src_get_linnum(void);
|
2002-05-01 04:53:55 +08:00
|
|
|
/*
|
|
|
|
* src_get may be used if you simply want to know the source file and line.
|
|
|
|
* It is also used if you maintain private status about the source location
|
|
|
|
* It return 0 if the information was the same as the last time you
|
|
|
|
* checked, -1 if the name changed and (new-old) if just the line changed.
|
|
|
|
*/
|
2007-04-14 00:47:53 +08:00
|
|
|
int src_get(int32_t *xline, char **xname);
|
2002-05-01 04:53:55 +08:00
|
|
|
|
2007-04-14 00:47:53 +08:00
|
|
|
void nasm_quote(char **str);
|
|
|
|
char *nasm_strcat(char *one, char *two);
|
2002-05-01 04:53:55 +08:00
|
|
|
|
2007-04-14 00:47:53 +08:00
|
|
|
void null_debug_routine(const char *directive, const char *params);
|
2002-05-01 04:53:55 +08:00
|
|
|
extern struct dfmt null_debug_form;
|
|
|
|
extern struct dfmt *null_debug_arr[2];
|
2007-04-12 10:40:54 +08:00
|
|
|
|
2007-04-18 04:23:11 +08:00
|
|
|
const char *prefix_name(int);
|
|
|
|
|
2002-05-01 04:51:32 +08:00
|
|
|
#endif
|