*** empty log message ***

This commit is contained in:
hyung-hwan 2007-02-21 04:18:09 +00:00
parent 29ee370eee
commit 3d2904adb8
14 changed files with 98 additions and 149 deletions

View File

@ -15,7 +15,7 @@ all: lib
lib: $(C_OBJS)
$(AR) cr lib$(OUT).a $(C_OBJS)
if [ "$(RANLIB)" = "ranlib" ]; then ranlib libaseawk.a; fi
if [ "$(RANLIB)" = "ranlib" ]; then ranlib lib$(OUT).a; fi
clean:
rm -rf $(OBJS) lib$(OUT).a *.o

View File

@ -1,20 +1,26 @@
SRCS = lsp.c name.c mem.c env.c err.c read.c eval.c print.c misc.c \
OUT = aselsp
C_SRCS = lsp.c name.c mem.c env.c err.c read.c eval.c print.c misc.c \
prim.c prim_prog.c prim_let.c prim_compar.c prim_math.c
OBJS = $(SRCS:.c=.o)
OUT = libaselsp.a
C_OBJS = $(C_SRCS:.c=.o)
CC = @CC@
AR = ar
RANLIB = @RANLIB@
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/..
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
all: $(OBJS)
$(AR) cr $(OUT) $(OBJS)
all: lib
lib: $(C_OBJS)
$(AR) cr lib$(OUT).a $(C_OBJS)
if [ "$(RANLIB)" = "ranlib" ]; then ranlib lib$(OUT).a; fi
clean:
rm -rf $(OBJS) $(OUT) *.o
rm -rf $(OBJS) lib$(OUT).a *.o
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -c $<

View File

@ -6,7 +6,7 @@ OBJS = $(SRCS:.c=.obj)
CC = cl
LD = link
CFLAGS = /nologo /O2 /MT /W3 /GR- /Za -I../.. -DSSE_CHAR_IS_WCHAR
CFLAGS = /nologo /O2 /MT /W3 /GR- /Za -I../..
all: lib

View File

@ -1,4 +1,4 @@
SUBDIRS=awk lsp
SUBDIRS=awk lsp utl
all:
@for i in $(SUBDIRS); \

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.173 2007-02-21 03:49:49 bacon Exp $
* $Id: awk.c,v 1.174 2007-02-21 04:09:28 bacon Exp $
*/
#include <ase/awk/awk.h>
@ -96,17 +96,6 @@ static void awk_dprintf (const ase_char_t* fmt, ...)
va_end (ap);
}
#if defined(_WIN32)
#define awk_fgets _fgetts
#define awk_fgetc _fgettc
#elif defined(ASE_CHAR_IS_MCHAR)
#define awk_fgets fgets
#define awk_fgetc fgetc
#else
#define awk_fgets fgetws
#define awk_fgetc fgetwc
#endif
static ase_ssize_t awk_srcio_in (
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
@ -129,7 +118,7 @@ static ase_ssize_t awk_srcio_in (
else if (cmd == ASE_AWK_IO_READ)
{
if (size <= 0) return -1;
c = awk_fgetc ((FILE*)src_io->input_handle);
c = ase_fgetc ((FILE*)src_io->input_handle);
if (c == ASE_CHAR_EOF) return 0;
*data = (ase_char_t)c;
return 1;
@ -195,7 +184,7 @@ static ase_ssize_t awk_extio_pipe (
case ASE_AWK_IO_READ:
{
if (awk_fgets (data, size, (FILE*)epa->handle) == ASE_NULL)
if (ase_fgets (data, size, (FILE*)epa->handle) == ASE_NULL)
{
if (ferror((FILE*)epa->handle)) return -1;
return 0;
@ -274,7 +263,7 @@ static ase_ssize_t awk_extio_file (
case ASE_AWK_IO_READ:
{
if (awk_fgets (data, size, (FILE*)epa->handle) == ASE_NULL)
if (ase_fgets (data, size, (FILE*)epa->handle) == ASE_NULL)
{
if (ferror((FILE*)epa->handle)) return -1;
return 0;
@ -333,7 +322,7 @@ static ase_ssize_t awk_extio_console (
}
else if (cmd == ASE_AWK_IO_READ)
{
while (awk_fgets (data, size, (FILE*)epa->handle) == ASE_NULL)
while (ase_fgets (data, size, (FILE*)epa->handle) == ASE_NULL)
{
if (ferror((FILE*)epa->handle)) return -1;

View File

@ -1,7 +1,7 @@
CC = cl
CFLAGS = /nologo /MT /W3 /GR- -I..\..\.. -D_WIN32_WINNT=0x0400
LDFLAGS = /libpath:..\..\awk
LIBS = aseawk.lib kernel32.lib user32.lib
LDFLAGS = /libpath:..\..\awk /libpath:..\..\utl
LIBS = aseawk.lib aseutl.lib kernel32.lib user32.lib
!if !defined(CPU) || "$(CPU)" == ""
CPU = $(PROCESSOR_ARCHITECTURE)

View File

@ -1,16 +1,17 @@
#include <ase/lsp/lsp.h>
#include "../../etc/printf.c"
#include "../../etc/main.c"
#include <ase/utl/ctype.h>
#include <ase/utl/stdio.h>
#include <ase/utl/main.h>
#include <string.h>
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
#endif
#include <string.h>
#include <wctype.h>
#include <stdlib.h>
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
@ -20,21 +21,11 @@
#include <mcheck.h>
#endif
#if defined(_WIN32)
#define lsp_fgets _fgetts
#define lsp_fgetc _fgettc
#define lsp_fputs _fputts
#define lsp_fputc _fputtc
#elif defined(ASE_CHAR_IS_MCHAR)
#define lsp_fgets fgets
#define lsp_fgetc fgetc
#define lsp_fputs fputs
#define lsp_fputc fputc
#else
#define lsp_fgets fgetws
#define lsp_fgetc fgetwc
#define lsp_fputs fputws
#define lsp_fputc fputwc
#if defined(vms) || defined(__vms)
/* it seems that the main function should be placed in the main object file
* in OpenVMS. otherwise, the first function in the main object file seems
* to become the main function resulting in program start-up failure. */
#include <ase/utl/main.c>
#endif
static ase_ssize_t get_input (
@ -49,7 +40,7 @@ static ase_ssize_t get_input (
case ASE_LSP_IO_READ:
{
/*
if (lsp_fgets (data, size, stdin) == ASE_NULL)
if (ase_fgets (data, size, stdin) == ASE_NULL)
{
if (ferror(stdin)) return -1;
return 0;
@ -60,7 +51,7 @@ static ase_ssize_t get_input (
ase_cint_t c;
if (size <= 0) return -1;
c = lsp_fgetc (stdin);
c = ase_fgetc (stdin);
if (c == ASE_CHAR_EOF)
{
@ -106,7 +97,7 @@ struct prmfns_data_t
};
#endif
static void* __lsp_malloc (ase_size_t n, void* custom_data)
static void* lsp_malloc (ase_size_t n, void* custom_data)
{
#ifdef _WIN32
return HeapAlloc (((prmfns_data_t*)custom_data)->heap, 0, n);
@ -115,7 +106,7 @@ static void* __lsp_malloc (ase_size_t n, void* custom_data)
#endif
}
static void* __lsp_realloc (void* ptr, ase_size_t n, void* custom_data)
static void* lsp_realloc (void* ptr, ase_size_t n, void* custom_data)
{
#ifdef _WIN32
/* HeapReAlloc behaves differently from realloc */
@ -128,7 +119,7 @@ static void* __lsp_realloc (void* ptr, ase_size_t n, void* custom_data)
#endif
}
static void __lsp_free (void* ptr, void* custom_data)
static void lsp_free (void* ptr, void* custom_data)
{
#ifdef _WIN32
HeapFree (((prmfns_data_t*)custom_data)->heap, 0, ptr);
@ -147,70 +138,11 @@ static void* lsp_memset (void* dst, int val, ase_size_t n)
return memset (dst, val, n);
}
#if defined(ASE_CHAR_IS_MCHAR)
#if (__TURBOC__<=513) /* turboc 2.01 or earlier */
static int lsp_isupper (int c) { return isupper (c); }
static int lsp_islower (int c) { return islower (c); }
static int lsp_isalpha (int c) { return isalpha (c); }
static int lsp_isdigit (int c) { return isdigit (c); }
static int lsp_isxdigit (int c) { return isxdigit (c); }
static int lsp_isalnum (int c) { return isalnum (c); }
static int lsp_isspace (int c) { return isspace (c); }
static int lsp_isprint (int c) { return isprint (c); }
static int lsp_isgraph (int c) { return isgraph (c); }
static int lsp_iscntrl (int c) { return iscntrl (c); }
static int lsp_ispunct (int c) { return ispunct (c); }
static int lsp_toupper (int c) { return toupper (c); }
static int lsp_tolower (int c) { return tolower (c); }
#else
#define lsp_isupper isupper
#define lsp_islower islower
#define lsp_isalpha isalpha
#define lsp_isdigit isdigit
#define lsp_isxdigit isxdigit
#define lsp_isalnum isalnum
#define lsp_isspace isspace
#define lsp_isprint isprint
#define lsp_isgraph isgraph
#define lsp_iscntrl iscntrl
#define lsp_ispunct ispunct
#define lsp_toupper tolower
#define lsp_tolower tolower
#endif
#else
#define lsp_isupper iswupper
#define lsp_islower iswlower
#define lsp_isalpha iswalpha
#define lsp_isdigit iswdigit
#define lsp_isxdigit iswxdigit
#define lsp_isalnum iswalnum
#define lsp_isspace iswspace
#define lsp_isprint iswprint
#define lsp_isgraph iswgraph
#define lsp_iscntrl iswcntrl
#define lsp_ispunct iswpunct
#define lsp_toupper towlower
#define lsp_tolower towlower
#endif
static void lsp_abort (void* custom_data)
{
abort ();
}
static int lsp_sprintf (
ase_char_t* buf, ase_size_t len, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vsprintf (buf, len, fmt, ap);
va_end (ap);
return n;
}
static void lsp_aprintf (const ase_char_t* fmt, ...)
{
va_list ap;
@ -265,27 +197,27 @@ int lsp_main (int argc, ase_char_t* argv[])
}
memset (&prmfns, 0, sizeof(prmfns));
prmfns.malloc = __lsp_malloc;
prmfns.realloc = __lsp_realloc;
prmfns.free = __lsp_free;
prmfns.is_upper = (ase_lsp_isctype_t)lsp_isupper;
prmfns.is_lower = (ase_lsp_isctype_t)lsp_islower;
prmfns.is_alpha = (ase_lsp_isctype_t)lsp_isalpha;
prmfns.is_digit = (ase_lsp_isctype_t)lsp_isdigit;
prmfns.is_xdigit = (ase_lsp_isctype_t)lsp_isxdigit;
prmfns.is_alnum = (ase_lsp_isctype_t)lsp_isalnum;
prmfns.is_space = (ase_lsp_isctype_t)lsp_isspace;
prmfns.is_print = (ase_lsp_isctype_t)lsp_isprint;
prmfns.is_graph = (ase_lsp_isctype_t)lsp_isgraph;
prmfns.is_cntrl = (ase_lsp_isctype_t)lsp_iscntrl;
prmfns.is_punct = (ase_lsp_isctype_t)lsp_ispunct;
prmfns.to_upper = (ase_lsp_toctype_t)lsp_toupper;
prmfns.to_lower = (ase_lsp_toctype_t)lsp_tolower;
prmfns.malloc = lsp_malloc;
prmfns.realloc = lsp_realloc;
prmfns.free = lsp_free;
prmfns.memcpy = lsp_memcpy;
prmfns.memset = lsp_memset;
prmfns.sprintf = lsp_sprintf;
prmfns.is_upper = (ase_lsp_isctype_t)ase_isupper;
prmfns.is_lower = (ase_lsp_isctype_t)ase_islower;
prmfns.is_alpha = (ase_lsp_isctype_t)ase_isalpha;
prmfns.is_digit = (ase_lsp_isctype_t)ase_isdigit;
prmfns.is_xdigit = (ase_lsp_isctype_t)ase_isxdigit;
prmfns.is_alnum = (ase_lsp_isctype_t)ase_isalnum;
prmfns.is_space = (ase_lsp_isctype_t)ase_isspace;
prmfns.is_print = (ase_lsp_isctype_t)ase_isprint;
prmfns.is_graph = (ase_lsp_isctype_t)ase_isgraph;
prmfns.is_cntrl = (ase_lsp_isctype_t)ase_iscntrl;
prmfns.is_punct = (ase_lsp_isctype_t)ase_ispunct;
prmfns.to_upper = (ase_lsp_toctype_t)ase_toupper;
prmfns.to_lower = (ase_lsp_toctype_t)ase_tolower;
prmfns.sprintf = ase_sprintf;
prmfns.aprintf = lsp_aprintf;
prmfns.dprintf = lsp_dprintf;
prmfns.abort = lsp_abort;

View File

@ -3,8 +3,8 @@ OBJS = $(SRCS:.c=.o)
CC = @CC@
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/..
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/lsp
LIBS = @LIBS@ -laselsp -lm
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/lsp -L@abs_top_builddir@/utl
LIBS = @LIBS@ -laselsp -laseutl -lm
all: aselsp

View File

@ -1,8 +1,8 @@
CC = bcc32
LD = ilink32
CFLAGS = -I..\..\.. -I$(XPKIT)
LDFLAGS = -L..\..\lsp
LIBS = import32.lib cw32mt.lib aselsp.lib
CFLAGS = -I..\..\..
LDFLAGS = -L..\..\lsp -L..\..\utl
LIBS = import32.lib cw32mt.lib aselsp.lib aseutl.lib
STARTUP = c0x32w.obj
all: aselsp

View File

@ -1,7 +1,7 @@
CC = cl
CFLAGS = /nologo /MT /GX /W3 /GR- /D_WIN32_WINNT=0x0400 -I..\..\..
LDFLAGS = /libpath:..\..\lsp
LIBS = aselsp.lib user32.lib
LDFLAGS = /libpath:..\..\lsp /libpath:..\..\utl
LIBS = aselsp.lib aseutl.lib user32.lib
all: aselsp

View File

@ -14,7 +14,7 @@ all: lib
lib: $(C_OBJS)
$(AR) cr lib$(OUT).a $(C_OBJS)
if [ "$(RANLIB)" = "ranlib" ]; then ranlib libaseawk.a; fi
if [ "$(RANLIB)" = "ranlib" ]; then ranlib lib$(OUT).a; fi
clean:
rm -rf $(OBJS) lib$(OUT).a *.o

View File

@ -7,8 +7,7 @@ CC = bcc32
LD = ilink32
AR = tlib
CFLAGS_COMMON = -O2 -WM -WU -RT- -w -q -I../..
CFLAGS = $(CFLAGS_COMMON) -DNDEBUG
CFLAGS = -O2 -WM -WU -RT- -w -q -I../.. -DNDEBUG
LDFLAGS = -Tpd -ap -Gn -c -q
STARTUP = c0d32w.obj

23
ase/utl/makefile.msw.cl Normal file
View File

@ -0,0 +1,23 @@
OUT = aseutl
C_SRCS = main.c ctype.c stdio.c
C_OBJS = $(C_SRCS:.c=.obj)
CC = cl
LD = link
CFLAGS = /nologo /O2 /MT /W3 /GR- /Za -I../.. -DNDEBUG
all: lib
lib: $(C_OBJS)
$(LD) /lib @<<
/nologo /out:$(OUT).lib $(C_OBJS)
<<
clean:
del $(OBJS) $(OUT).lib *.obj
.SUFFIXES: .c .obj
.c.obj:
$(CC) $(CFLAGS) /c $<

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio.h,v 1.1 2007-02-20 14:04:22 bacon Exp $
* $Id: stdio.h,v 1.2 2007-02-21 04:09:28 bacon Exp $
*/
#ifndef _ASE_STDIO_H_
@ -19,14 +19,14 @@
#define ase_fprintf _ftprintf
#define ase_vfprintf _vftprintf
#define awk_fgets _fgetts
#define awk_fgetc _fgettc
#define ase_fgets _fgetts
#define ase_fgetc _fgettc
#elif defined(ASE_CHAR_IS_MCHAR)
#define awk_fgets fgets
#define awk_fgetc fgetc
#define ase_fgets fgets
#define ase_fgetc fgetc
#else
#define awk_fgets fgetws
#define awk_fgetc fgetwc
#define ase_fgets fgetws
#define ase_fgetc fgetwc
#endif
#ifdef __cplusplus