The Great Renaming, Part 2: prefix strcasecmp and strncasecmp with yasm__.

svn path=/trunk/yasm/; revision=841
This commit is contained in:
Peter Johnson 2003-03-08 20:35:36 +00:00
parent 854ea00a2b
commit 9d0fa1135c
19 changed files with 74 additions and 65 deletions

View file

@ -74,7 +74,7 @@ load_module(const char *keyword)
/* See if the module has already been loaded. */
SLIST_FOREACH(m, &modules, link) {
if (strcasecmp(m->keyword, keyword) == 0)
if (yasm__strcasecmp(m->keyword, keyword) == 0)
return m;
}

View file

@ -325,8 +325,8 @@ main(int argc, char *argv[])
* for the active object format.
*/
for (i=0; cur_objfmt->dbgfmt_keywords[i]; i++)
if (strcasecmp(cur_objfmt->dbgfmt_keywords[i],
cur_dbgfmt->keyword) == 0)
if (yasm__strcasecmp(cur_objfmt->dbgfmt_keywords[i],
cur_dbgfmt->keyword) == 0)
matched_dbgfmt = 1;
if (!matched_dbgfmt) {
print_error(
@ -378,7 +378,7 @@ main(int argc, char *argv[])
* for the active parser.
*/
for (i=0; cur_parser->preproc_keywords[i]; i++)
if (strcasecmp(cur_parser->preproc_keywords[i],
if (yasm__strcasecmp(cur_parser->preproc_keywords[i],
cur_preproc->keyword) == 0)
matched_preproc = 1;
if (!matched_preproc) {

View file

@ -42,7 +42,7 @@ static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93";
#include <ctype.h>
int
strcasecmp(const char *s1, const char *s2)
yasm__strcasecmp(const char *s1, const char *s2)
{
const unsigned char
*us1 = (const unsigned char *)s1,
@ -55,7 +55,7 @@ strcasecmp(const char *s1, const char *s2)
}
int
strncasecmp(const char *s1, const char *s2, size_t n)
yasm__strncasecmp(const char *s1, const char *s2, size_t n)
{
const unsigned char
*us1 = (const unsigned char *)s1,

View file

@ -82,21 +82,24 @@ int mergesort(void *base, size_t nmemb, size_t size,
/*@null@*/ char *strsep(char **stringp, const char *delim);
#endif
#ifndef HAVE_STRCASECMP
#ifdef HAVE_STRCASECMP
# define yasm__strcasecmp(x, y) strcasecmp(x, y)
# define yasm__strncasecmp(x, y) strncasecmp(x, y)
#else
# ifdef HAVE_STRICMP
# define strcasecmp(x, y) stricmp(x, y)
# define strncasecmp(x, y) strnicmp(x, y)
# define yasm__strcasecmp(x, y) stricmp(x, y)
# define yasm__strncasecmp(x, y) strnicmp(x, y)
# elif HAVE_STRCMPI
# define strcasecmp(x, y) strcmpi(x, y)
# define strncasecmp(x, y) strncmpi(x, y)
# define yasm__strcasecmp(x, y) strcmpi(x, y)
# define yasm__strncasecmp(x, y) strncmpi(x, y)
# else
# define USE_OUR_OWN_STRCASECMP
# endif
#endif
#if defined(USE_OUR_OWN_STRCASECMP) || defined(lint)
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
int yasm__strcasecmp(const char *s1, const char *s2);
int yasm__strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#if !defined(HAVE_TOASCII) || defined(lint)

View file

@ -65,7 +65,7 @@ yasm_x86__directive(const char *name, yasm_valparamhead *valparams,
const yasm_intnum *intn;
long lval;
if (strcasecmp(name, "bits") == 0) {
if (yasm__strcasecmp(name, "bits") == 0) {
if ((vp = yasm_vps_first(valparams)) && !vp->val &&
vp->param != NULL &&
(intn = yasm_expr_get_intnum(&vp->param, NULL)) != NULL &&

View file

@ -361,7 +361,7 @@ bin_objfmt_sections_switch(yasm_sectionhead *headp,
/* Check for ALIGN qualifier */
while ((vp = yasm_vps_next(vp))) {
if (strcasecmp(vp->val, "align") == 0 && vp->param) {
if (yasm__strcasecmp(vp->val, "align") == 0 && vp->param) {
/*@dependent@*/ /*@null@*/ const yasm_intnum *align;
unsigned long bitcnt;
@ -444,7 +444,7 @@ bin_objfmt_directive(const char *name, yasm_valparamhead *valparams,
yasm_section *sect;
yasm_valparam *vp;
if (strcasecmp(name, "org") == 0) {
if (yasm__strcasecmp(name, "org") == 0) {
/*@dependent@*/ /*@null@*/ const yasm_intnum *start = NULL;
/* ORG takes just a simple integer as param */

View file

@ -744,14 +744,14 @@ coff_objfmt_sections_switch(yasm_sectionhead *headp,
flags = COFF_STYP_TEXT;
while ((vp = yasm_vps_next(vp))) {
if (strcasecmp(vp->val, "code") == 0 ||
strcasecmp(vp->val, "text") == 0) {
if (yasm__strcasecmp(vp->val, "code") == 0 ||
yasm__strcasecmp(vp->val, "text") == 0) {
flags = COFF_STYP_TEXT;
flags_override = 1;
} else if (strcasecmp(vp->val, "data") == 0) {
} else if (yasm__strcasecmp(vp->val, "data") == 0) {
flags = COFF_STYP_DATA;
flags_override = 1;
} else if (strcasecmp(vp->val, "bss") == 0) {
} else if (yasm__strcasecmp(vp->val, "bss") == 0) {
flags = COFF_STYP_BSS;
flags_override = 1;
resonly = 1;

View file

@ -550,7 +550,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
unsigned long lindex = cur_lindex;
/* Handle (mostly) output-format independent directives here */
if (strcasecmp(name, "extern") == 0) {
if (yasm__strcasecmp(name, "extern") == 0) {
vp = yasm_vps_first(valparams);
if (vp->val) {
sym = yasm_symrec_declare(vp->val, YASM_SYM_EXTERN, lindex);
@ -559,7 +559,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
lindex);
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "EXTERN");
} else if (strcasecmp(name, "global") == 0) {
} else if (yasm__strcasecmp(name, "global") == 0) {
vp = yasm_vps_first(valparams);
if (vp->val) {
sym = yasm_symrec_declare(vp->val, YASM_SYM_GLOBAL, lindex);
@ -568,7 +568,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
lindex);
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "GLOBAL");
} else if (strcasecmp(name, "common") == 0) {
} else if (yasm__strcasecmp(name, "common") == 0) {
vp = yasm_vps_first(valparams);
if (vp->val) {
vp2 = yasm_vps_next(vp);
@ -597,8 +597,8 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
}
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "COMMON");
} else if (strcasecmp(name, "section") == 0 ||
strcasecmp(name, "segment") == 0) {
} else if (yasm__strcasecmp(name, "section") == 0 ||
yasm__strcasecmp(name, "segment") == 0) {
yasm_section *new_section =
nasm_parser_objfmt->sections_switch(&nasm_parser_sections,
valparams, objext_valparams,
@ -609,7 +609,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
yasm_bcs_last(yasm_section_get_bytecodes(new_section));
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "SECTION");
} else if (strcasecmp(name, "absolute") == 0) {
} else if (yasm__strcasecmp(name, "absolute") == 0) {
/* it can be just an ID or a complete expression, so handle both. */
vp = yasm_vps_first(valparams);
if (vp->val)
@ -625,7 +625,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
vp->param = NULL;
}
nasm_parser_prev_bc = (yasm_bytecode *)NULL;
} else if (strcasecmp(name, "cpu") == 0) {
} else if (yasm__strcasecmp(name, "cpu") == 0) {
yasm_vps_foreach(vp, valparams) {
if (vp->val)
nasm_parser_arch->parse.switch_cpu(vp->val, lindex);

View file

@ -21,8 +21,8 @@
#define nasm_free(p) if (p) xfree(p)
#define nasm_strdup xstrdup
#define nasm_strndup xstrndup
#define nasm_stricmp strcasecmp
#define nasm_strnicmp strncasecmp
#define nasm_stricmp yasm__strcasecmp
#define nasm_strnicmp yasm__strncasecmp
/*
* Convert a string into a number, using NASM number rules. Sets

View file

@ -65,7 +65,7 @@ yasm_x86__directive(const char *name, yasm_valparamhead *valparams,
const yasm_intnum *intn;
long lval;
if (strcasecmp(name, "bits") == 0) {
if (yasm__strcasecmp(name, "bits") == 0) {
if ((vp = yasm_vps_first(valparams)) && !vp->val &&
vp->param != NULL &&
(intn = yasm_expr_get_intnum(&vp->param, NULL)) != NULL &&

View file

@ -325,8 +325,8 @@ main(int argc, char *argv[])
* for the active object format.
*/
for (i=0; cur_objfmt->dbgfmt_keywords[i]; i++)
if (strcasecmp(cur_objfmt->dbgfmt_keywords[i],
cur_dbgfmt->keyword) == 0)
if (yasm__strcasecmp(cur_objfmt->dbgfmt_keywords[i],
cur_dbgfmt->keyword) == 0)
matched_dbgfmt = 1;
if (!matched_dbgfmt) {
print_error(
@ -378,7 +378,7 @@ main(int argc, char *argv[])
* for the active parser.
*/
for (i=0; cur_parser->preproc_keywords[i]; i++)
if (strcasecmp(cur_parser->preproc_keywords[i],
if (yasm__strcasecmp(cur_parser->preproc_keywords[i],
cur_preproc->keyword) == 0)
matched_preproc = 1;
if (!matched_preproc) {

View file

@ -74,7 +74,7 @@ load_module(const char *keyword)
/* See if the module has already been loaded. */
SLIST_FOREACH(m, &modules, link) {
if (strcasecmp(m->keyword, keyword) == 0)
if (yasm__strcasecmp(m->keyword, keyword) == 0)
return m;
}

View file

@ -361,7 +361,7 @@ bin_objfmt_sections_switch(yasm_sectionhead *headp,
/* Check for ALIGN qualifier */
while ((vp = yasm_vps_next(vp))) {
if (strcasecmp(vp->val, "align") == 0 && vp->param) {
if (yasm__strcasecmp(vp->val, "align") == 0 && vp->param) {
/*@dependent@*/ /*@null@*/ const yasm_intnum *align;
unsigned long bitcnt;
@ -444,7 +444,7 @@ bin_objfmt_directive(const char *name, yasm_valparamhead *valparams,
yasm_section *sect;
yasm_valparam *vp;
if (strcasecmp(name, "org") == 0) {
if (yasm__strcasecmp(name, "org") == 0) {
/*@dependent@*/ /*@null@*/ const yasm_intnum *start = NULL;
/* ORG takes just a simple integer as param */

View file

@ -744,14 +744,14 @@ coff_objfmt_sections_switch(yasm_sectionhead *headp,
flags = COFF_STYP_TEXT;
while ((vp = yasm_vps_next(vp))) {
if (strcasecmp(vp->val, "code") == 0 ||
strcasecmp(vp->val, "text") == 0) {
if (yasm__strcasecmp(vp->val, "code") == 0 ||
yasm__strcasecmp(vp->val, "text") == 0) {
flags = COFF_STYP_TEXT;
flags_override = 1;
} else if (strcasecmp(vp->val, "data") == 0) {
} else if (yasm__strcasecmp(vp->val, "data") == 0) {
flags = COFF_STYP_DATA;
flags_override = 1;
} else if (strcasecmp(vp->val, "bss") == 0) {
} else if (yasm__strcasecmp(vp->val, "bss") == 0) {
flags = COFF_STYP_BSS;
flags_override = 1;
resonly = 1;

View file

@ -550,7 +550,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
unsigned long lindex = cur_lindex;
/* Handle (mostly) output-format independent directives here */
if (strcasecmp(name, "extern") == 0) {
if (yasm__strcasecmp(name, "extern") == 0) {
vp = yasm_vps_first(valparams);
if (vp->val) {
sym = yasm_symrec_declare(vp->val, YASM_SYM_EXTERN, lindex);
@ -559,7 +559,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
lindex);
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "EXTERN");
} else if (strcasecmp(name, "global") == 0) {
} else if (yasm__strcasecmp(name, "global") == 0) {
vp = yasm_vps_first(valparams);
if (vp->val) {
sym = yasm_symrec_declare(vp->val, YASM_SYM_GLOBAL, lindex);
@ -568,7 +568,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
lindex);
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "GLOBAL");
} else if (strcasecmp(name, "common") == 0) {
} else if (yasm__strcasecmp(name, "common") == 0) {
vp = yasm_vps_first(valparams);
if (vp->val) {
vp2 = yasm_vps_next(vp);
@ -597,8 +597,8 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
}
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "COMMON");
} else if (strcasecmp(name, "section") == 0 ||
strcasecmp(name, "segment") == 0) {
} else if (yasm__strcasecmp(name, "section") == 0 ||
yasm__strcasecmp(name, "segment") == 0) {
yasm_section *new_section =
nasm_parser_objfmt->sections_switch(&nasm_parser_sections,
valparams, objext_valparams,
@ -609,7 +609,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
yasm_bcs_last(yasm_section_get_bytecodes(new_section));
} else
cur_we->error(lindex, N_("invalid argument to [%s]"), "SECTION");
} else if (strcasecmp(name, "absolute") == 0) {
} else if (yasm__strcasecmp(name, "absolute") == 0) {
/* it can be just an ID or a complete expression, so handle both. */
vp = yasm_vps_first(valparams);
if (vp->val)
@ -625,7 +625,7 @@ nasm_parser_directive(const char *name, yasm_valparamhead *valparams,
vp->param = NULL;
}
nasm_parser_prev_bc = (yasm_bytecode *)NULL;
} else if (strcasecmp(name, "cpu") == 0) {
} else if (yasm__strcasecmp(name, "cpu") == 0) {
yasm_vps_foreach(vp, valparams) {
if (vp->val)
nasm_parser_arch->parse.switch_cpu(vp->val, lindex);

View file

@ -21,8 +21,8 @@
#define nasm_free(p) if (p) xfree(p)
#define nasm_strdup xstrdup
#define nasm_strndup xstrndup
#define nasm_stricmp strcasecmp
#define nasm_strnicmp strncasecmp
#define nasm_stricmp yasm__strcasecmp
#define nasm_strnicmp yasm__strncasecmp
/*
* Convert a string into a number, using NASM number rules. Sets

View file

@ -42,7 +42,7 @@ static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93";
#include <ctype.h>
int
strcasecmp(const char *s1, const char *s2)
yasm__strcasecmp(const char *s1, const char *s2)
{
const unsigned char
*us1 = (const unsigned char *)s1,
@ -55,7 +55,7 @@ strcasecmp(const char *s1, const char *s2)
}
int
strncasecmp(const char *s1, const char *s2, size_t n)
yasm__strncasecmp(const char *s1, const char *s2, size_t n)
{
const unsigned char
*us1 = (const unsigned char *)s1,

View file

@ -82,21 +82,24 @@ int mergesort(void *base, size_t nmemb, size_t size,
/*@null@*/ char *strsep(char **stringp, const char *delim);
#endif
#ifndef HAVE_STRCASECMP
#ifdef HAVE_STRCASECMP
# define yasm__strcasecmp(x, y) strcasecmp(x, y)
# define yasm__strncasecmp(x, y) strncasecmp(x, y)
#else
# ifdef HAVE_STRICMP
# define strcasecmp(x, y) stricmp(x, y)
# define strncasecmp(x, y) strnicmp(x, y)
# define yasm__strcasecmp(x, y) stricmp(x, y)
# define yasm__strncasecmp(x, y) strnicmp(x, y)
# elif HAVE_STRCMPI
# define strcasecmp(x, y) strcmpi(x, y)
# define strncasecmp(x, y) strncmpi(x, y)
# define yasm__strcasecmp(x, y) strcmpi(x, y)
# define yasm__strncasecmp(x, y) strncmpi(x, y)
# else
# define USE_OUR_OWN_STRCASECMP
# endif
#endif
#if defined(USE_OUR_OWN_STRCASECMP) || defined(lint)
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
int yasm__strcasecmp(const char *s1, const char *s2);
int yasm__strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#if !defined(HAVE_TOASCII) || defined(lint)

17
util.h
View file

@ -82,21 +82,24 @@ int mergesort(void *base, size_t nmemb, size_t size,
/*@null@*/ char *strsep(char **stringp, const char *delim);
#endif
#ifndef HAVE_STRCASECMP
#ifdef HAVE_STRCASECMP
# define yasm__strcasecmp(x, y) strcasecmp(x, y)
# define yasm__strncasecmp(x, y) strncasecmp(x, y)
#else
# ifdef HAVE_STRICMP
# define strcasecmp(x, y) stricmp(x, y)
# define strncasecmp(x, y) strnicmp(x, y)
# define yasm__strcasecmp(x, y) stricmp(x, y)
# define yasm__strncasecmp(x, y) strnicmp(x, y)
# elif HAVE_STRCMPI
# define strcasecmp(x, y) strcmpi(x, y)
# define strncasecmp(x, y) strncmpi(x, y)
# define yasm__strcasecmp(x, y) strcmpi(x, y)
# define yasm__strncasecmp(x, y) strncmpi(x, y)
# else
# define USE_OUR_OWN_STRCASECMP
# endif
#endif
#if defined(USE_OUR_OWN_STRCASECMP) || defined(lint)
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
int yasm__strcasecmp(const char *s1, const char *s2);
int yasm__strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#if !defined(HAVE_TOASCII) || defined(lint)