AC_PROG_YACC
AC_PROG_INSTALL
+AC_HEADER_STDC
+AC_CHECK_FUNCS(memcpy)
+AC_REPLACE_FUNCS(strdup)
+
AC_OUTPUT(Makefile src/Makefile include/Makefile)
AC_PROG_YACC
AC_PROG_INSTALL
+AC_HEADER_STDC
+AC_CHECK_FUNCS(memcpy)
+AC_REPLACE_FUNCS(strdup)
+
AC_OUTPUT(Makefile src/Makefile include/Makefile)
-/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
- * Various utility functions for ANSI C compatibility header file
+/* $Id: util.h,v 1.2 2001/06/28 08:48:32 peter Exp $
+ * Defines prototypes for replacement functions if needed.
*
* Copyright (C) 2001 Peter Johnson
*
#ifndef _UTIL_H_
#define _UTIL_H_
-char *y_strdup(char *str);
+#ifndef HAVE_STRDUP
+char *strdup(const char *str);
+#endif
#endif
-/* $Id: errwarn.c,v 1.10 2001/06/13 06:05:08 peter Exp $
+/* $Id: errwarn.c,v 1.11 2001/06/28 08:48:32 peter Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdio.h>
+
+#ifdef STDC_HEADERS
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#endif
+
#include <ctype.h>
+
+#include "util.h"
+
#include "errwarn.h"
#include "globals.h"
-#include "util.h"
unsigned int error_count = 0;
unsigned int warning_count = 0;
}
}
} else {
- dest = y_strdup(src);
+ dest = strdup(src);
if(!dest)
Fatal(FATAL_NOMEM);
}
-/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
- * Various utility functions for ANSI C compatibility header file
+/* $Id: util.h,v 1.2 2001/06/28 08:48:32 peter Exp $
+ * Defines prototypes for replacement functions if needed.
*
* Copyright (C) 2001 Peter Johnson
*
#ifndef _UTIL_H_
#define _UTIL_H_
-char *y_strdup(char *str);
+#ifndef HAVE_STRDUP
+char *strdup(const char *str);
+#endif
#endif
-/* $Id: token.l.in,v 1.6 2001/06/13 05:43:59 mu Exp $
+/* $Id: token.l.in,v 1.7 2001/06/28 08:48:32 peter Exp $
* Main lexer
*
* Copyright (C) 2001 Peter Johnson
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
%{
-#include <stdlib.h>
-#include <string.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+#include "util.h"
+
#include "symrec.h"
#include "bytecode.h"
#include "errwarn.h"
-#include "util.h"
#include "bison.tab.h"
%}
<DIRECTIVE2>{WS}+ ;
<DIRECTIVE>[a-z]+ {
BEGIN DIRECTIVE2;
- yylval.str_val = y_strdup(yytext);
+ yylval.str_val = strdup(yytext);
if(!yylval.str_val)
Fatal(FATAL_NOMEM);
return DIRECTIVE_NAME;
}
/* everything printable except for ' ', '[' and ']'. */
<DIRECTIVE2>[!-@a-z\\^-`{|}~]+ {
- yylval.str_val = y_strdup(yytext);
+ yylval.str_val = strdup(yytext);
if(!yylval.str_val)
Fatal(FATAL_NOMEM);
return DIRECTIVE_VAL;
/* special non-local ..@label */
\.\.@[a-z0-9_$#@~.?]+ {
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
yylval.syminfo.line = line_number;
if (locallabel_base == NULL)
{
Warning (WARN_NO_BASE_LABEL, (char *)NULL, yytext);
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
}
else
/* label */
[a-z_?][a-z0-9_$#@~.?]* {
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
yylval.syminfo.line = line_number;
bytecode.c \
errwarn.c \
main.c \
- symrec.c \
- util.c
+ symrec.c
noinst_SCRIPTS = gen_instr.pl
-/* $Id: errwarn.c,v 1.10 2001/06/13 06:05:08 peter Exp $
+/* $Id: errwarn.c,v 1.11 2001/06/28 08:48:32 peter Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdio.h>
+
+#ifdef STDC_HEADERS
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#endif
+
#include <ctype.h>
+
+#include "util.h"
+
#include "errwarn.h"
#include "globals.h"
-#include "util.h"
unsigned int error_count = 0;
unsigned int warning_count = 0;
}
}
} else {
- dest = y_strdup(src);
+ dest = strdup(src);
if(!dest)
Fatal(FATAL_NOMEM);
}
-/* $Id: token.l.in,v 1.6 2001/06/13 05:43:59 mu Exp $
+/* $Id: token.l.in,v 1.7 2001/06/28 08:48:32 peter Exp $
* Main lexer
*
* Copyright (C) 2001 Peter Johnson
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
%{
-#include <stdlib.h>
-#include <string.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+#include "util.h"
+
#include "symrec.h"
#include "bytecode.h"
#include "errwarn.h"
-#include "util.h"
#include "bison.tab.h"
%}
<DIRECTIVE2>{WS}+ ;
<DIRECTIVE>[a-z]+ {
BEGIN DIRECTIVE2;
- yylval.str_val = y_strdup(yytext);
+ yylval.str_val = strdup(yytext);
if(!yylval.str_val)
Fatal(FATAL_NOMEM);
return DIRECTIVE_NAME;
}
/* everything printable except for ' ', '[' and ']'. */
<DIRECTIVE2>[!-@a-z\\^-`{|}~]+ {
- yylval.str_val = y_strdup(yytext);
+ yylval.str_val = strdup(yytext);
if(!yylval.str_val)
Fatal(FATAL_NOMEM);
return DIRECTIVE_VAL;
/* special non-local ..@label */
\.\.@[a-z0-9_$#@~.?]+ {
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
yylval.syminfo.line = line_number;
if (locallabel_base == NULL)
{
Warning (WARN_NO_BASE_LABEL, (char *)NULL, yytext);
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
}
else
/* label */
[a-z_?][a-z0-9_$#@~.?]* {
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
yylval.syminfo.line = line_number;
-/* $Id: token.l.in,v 1.6 2001/06/13 05:43:59 mu Exp $
+/* $Id: token.l.in,v 1.7 2001/06/28 08:48:32 peter Exp $
* Main lexer
*
* Copyright (C) 2001 Peter Johnson
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
%{
-#include <stdlib.h>
-#include <string.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+#include "util.h"
+
#include "symrec.h"
#include "bytecode.h"
#include "errwarn.h"
-#include "util.h"
#include "bison.tab.h"
%}
<DIRECTIVE2>{WS}+ ;
<DIRECTIVE>[a-z]+ {
BEGIN DIRECTIVE2;
- yylval.str_val = y_strdup(yytext);
+ yylval.str_val = strdup(yytext);
if(!yylval.str_val)
Fatal(FATAL_NOMEM);
return DIRECTIVE_NAME;
}
/* everything printable except for ' ', '[' and ']'. */
<DIRECTIVE2>[!-@a-z\\^-`{|}~]+ {
- yylval.str_val = y_strdup(yytext);
+ yylval.str_val = strdup(yytext);
if(!yylval.str_val)
Fatal(FATAL_NOMEM);
return DIRECTIVE_VAL;
/* special non-local ..@label */
\.\.@[a-z0-9_$#@~.?]+ {
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
yylval.syminfo.line = line_number;
if (locallabel_base == NULL)
{
Warning (WARN_NO_BASE_LABEL, (char *)NULL, yytext);
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
}
else
/* label */
[a-z_?][a-z0-9_$#@~.?]* {
- yylval.syminfo.name = y_strdup (yytext);
+ yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
yylval.syminfo.line = line_number;
+++ /dev/null
-/* $Id: util.c,v 1.1 2001/06/13 05:24:50 peter Exp $
- * Various utility functions for ANSI C compatibility
- *
- * 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
- */
-#include <stdlib.h>
-#include <string.h>
-#include "util.h"
-
-char *y_strdup(char *str)
-{
- size_t len;
- char *copy;
-
- len = strlen(str) + 1;
- if((copy = malloc(len)) == NULL)
- return (char *)NULL;
- memcpy(copy, str, len);
- return copy;
-}
-/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
- * Various utility functions for ANSI C compatibility header file
+/* $Id: util.h,v 1.2 2001/06/28 08:48:32 peter Exp $
+ * Defines prototypes for replacement functions if needed.
*
* Copyright (C) 2001 Peter Johnson
*
#ifndef _UTIL_H_
#define _UTIL_H_
-char *y_strdup(char *str);
+#ifndef HAVE_STRDUP
+char *strdup(const char *str);
+#endif
#endif
-/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
- * Various utility functions for ANSI C compatibility header file
+/* $Id: util.h,v 1.2 2001/06/28 08:48:32 peter Exp $
+ * Defines prototypes for replacement functions if needed.
*
* Copyright (C) 2001 Peter Johnson
*
#ifndef _UTIL_H_
#define _UTIL_H_
-char *y_strdup(char *str);
+#ifndef HAVE_STRDUP
+char *strdup(const char *str);
+#endif
#endif