Merge from default.

--HG--
branch : dtrg-videocore-branch-branch
This commit is contained in:
David Given 2016-03-13 21:13:09 +01:00
commit ff0c78cc78
30 changed files with 328 additions and 167 deletions

6
.travis.yml Normal file
View file

@ -0,0 +1,6 @@
before_install:
- sudo apt-get install ed
language: c
script:
- make PREFIX=/tmp/acki -j4

View file

@ -52,7 +52,7 @@ endef
# --- Add a raw to the queue # --- Add a raw to the queue
define file define rawfile
$(eval q += $1) $(eval q += $1)
endef endef

View file

@ -29,13 +29,13 @@ $g: $D/maketokentab $(OBJDIR)/$D/Lpars.h
$(eval $q: $(OBJDIR)/$D/Lpars.h) $(eval $q: $(OBJDIR)/$D/Lpars.h)
$(eval $q: $(INCDIR)/print.h) $(eval $q: $(INCDIR)/print.h)
$(call file, $(LIBEM_MES)) $(call rawfile, $(LIBEM_MES))
$(call file, $(LIBEMK)) $(call rawfile, $(LIBEMK))
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/em_bem) $(call cprogram, $(BINDIR)/em_bem)
$(call installto, $(PLATDEP)/em_bem) $(call installto, $(PLATDEP)/em_bem)

View file

@ -134,16 +134,16 @@ $(call build-cemcom-ansi-next, \
$(eval $q: $(OBJDIR)/$D/Lpars.h) $(eval $q: $(OBJDIR)/$D/Lpars.h)
$(call file, $(LIBEM_MES)) $(call rawfile, $(LIBEM_MES))
$(call file, $(LIBEMK)) $(call rawfile, $(LIBEMK))
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBINPUT)) $(call rawfile, $(LIBINPUT))
$(call file, $(LIBASSERT)) $(call rawfile, $(LIBASSERT))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBFLT_ARITH)) $(call rawfile, $(LIBFLT_ARITH))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call cprogram, $(BINDIR)/cemcom.ansi) $(call cprogram, $(BINDIR)/cemcom.ansi)
$(call installto, $(PLATDEP)/em_cemcom.ansi) $(call installto, $(PLATDEP)/em_cemcom.ansi)
$(eval CEMCOMANSI := $o) $(eval CEMCOMANSI := $o)

View file

@ -71,12 +71,12 @@ define build-cpp-ansi-impl
$(call llgen, $(OBJDIR)/$D, $(OBJDIR)/$D/tokenfile.g $D/expression.g) $(call llgen, $(OBJDIR)/$D, $(OBJDIR)/$D/tokenfile.g $D/expression.g)
$(call file, $(LIBINPUT)) $(call rawfile, $(LIBINPUT))
$(call file, $(LIBASSERT)) $(call rawfile, $(LIBASSERT))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call tabgen, $D/char.tab) $(call tabgen, $D/char.tab)

View file

@ -6,9 +6,61 @@
*/ */
/* $Id$ */ /* $Id$ */
#ifndef _MALLOC_H #ifndef _STDLIB_H
#define _MALLOC_H #define _STDLIB_H
#include <stdlib.h> #include <stddef.h>
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define RAND_MAX 32767
#define MB_CUR_MAX sizeof(wchar_t)
typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t;
extern double atof(const char *_nptr);
extern int atoi(const char *_nptr);
extern long atol(const char *_nptr);
extern double strtod(const char *_nptr, char **_endptr);
extern long strtol(const char *_nptr, char **_endptr, int _base);
extern unsigned long strtoul(const char *_nptr, char **_endptr, int _base);
extern int rand(void);
extern void srand(unsigned int _seed);
extern void* calloc(size_t _nmemb, size_t _size);
extern void free(void *_ptr);
extern void* malloc(size_t _size);
extern void* realloc(void *_ptr, size_t _size);
extern void abort(void);
extern int atexit(void (*_func)(void));
extern void exit(int _status);
extern void _Exit(int _status);
extern char* getenv(const char *_name);
extern int setenv(const char *_name, const char *_value, int _overwrite);
extern int unsetenv(const char *_name);
extern int putenv(char *_string);
extern int system(const char *_string);
extern void* bsearch(const void *_key, const void *_base,
size_t _nmemb, size_t _size,
int (*_compar)(const void *, const void *));
extern void qsort(void *_base, size_t _nmemb, size_t _size,
int (*_compar)(const void *, const void *));
extern int abs(int _j);
extern div_t div(int _numer, int _denom);
extern long labs(long _j);
extern ldiv_t ldiv(long _numer, long _denom);
extern int mblen(const char *_s, size_t _n);
extern int mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
extern int wctomb(char *_s, wchar_t _wchar);
extern size_t mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n);
extern size_t wcstombs(char *_s, const wchar_t *_pwcs, size_t _n);
/* Extensions (not part of the standard) */
#define atof(n) strtod(n, (char **)NULL)
#define atoi(n) ((int)strtol(n, (char **)NULL, 10))
#define atol(n) strtol(n, (char **)NULL, 10)
#define atoll(n) strtoll(n, (char **)NULL, 10)
#define mblen(s, n) mbtowc((wchar_t *)0, s, n)
#endif #endif

View file

@ -108,16 +108,16 @@ $(eval $q: $(INCDIR)/em_codeEK.h)
$(eval $q: $(INCDIR)/print.h) $(eval $q: $(INCDIR)/print.h)
$(eval $q: $(INCDIR)/system.h) $(eval $q: $(INCDIR)/system.h)
$(call file, $(LIBEM_MES)) $(call rawfile, $(LIBEM_MES))
$(call file, $(LIBEMK)) $(call rawfile, $(LIBEMK))
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBINPUT)) $(call rawfile, $(LIBINPUT))
$(call file, $(LIBASSERT)) $(call rawfile, $(LIBASSERT))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBFLT_ARITH)) $(call rawfile, $(LIBFLT_ARITH))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call cprogram, $(BINDIR)/em_m2) $(call cprogram, $(BINDIR)/em_m2)
$(call installto, $(PLATDEP)/em_m2) $(call installto, $(PLATDEP)/em_m2)

View file

@ -95,7 +95,7 @@ $(eval g := \
$(foreach f, $g, \ $(foreach f, $g, \
$(call reset) \ $(call reset) \
$(call file, lang/m2/libm2/$f) \ $(call rawfile, lang/m2/libm2/$f) \
$(call installto, $(PLATIND)/include/modula2/$f)) $(call installto, $(PLATIND)/include/modula2/$f))
endef endef

View file

@ -111,16 +111,16 @@ $(eval $q: $(INCDIR)/em_codeEK.h)
$(eval $q: $(INCDIR)/print.h) $(eval $q: $(INCDIR)/print.h)
$(eval $q: $(INCDIR)/system.h) $(eval $q: $(INCDIR)/system.h)
$(call file, $(LIBEM_MES)) $(call rawfile, $(LIBEM_MES))
$(call file, $(LIBEMK)) $(call rawfile, $(LIBEMK))
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBINPUT)) $(call rawfile, $(LIBINPUT))
$(call file, $(LIBASSERT)) $(call rawfile, $(LIBASSERT))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBFLT_ARITH)) $(call rawfile, $(LIBFLT_ARITH))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call cprogram, $(BINDIR)/em_pc) $(call cprogram, $(BINDIR)/em_pc)
$(call installto, $(PLATDEP)/em_pc) $(call installto, $(PLATDEP)/em_pc)

View file

@ -38,7 +38,7 @@ $(OBJDIR)/$D/preprocessed-comm2.y: mach/proto/as/comm2.y $(CPPANSI) \
-Ih \ -Ih \
mach/proto/as/comm2.y > $$@ mach/proto/as/comm2.y > $$@
$(call file, $(LIBOBJECT)) $(call rawfile, $(LIBOBJECT))
$(call cprogram, $(BINDIR)/$(PLATFORM)/as) $(call cprogram, $(BINDIR)/$(PLATFORM)/as)
$(call installto, $(PLATDEP)/$(PLATFORM)/as) $(call installto, $(PLATDEP)/$(PLATFORM)/as)

View file

@ -265,3 +265,4 @@ typedef struct sect_t sect_t;
#endif #endif
extern FILE *fopen(); /* some systems don't have this in stdio.h */ extern FILE *fopen(); /* some systems don't have this in stdio.h */

View file

@ -116,6 +116,10 @@ extern valu_t load();
extern FILE *ffcreat(); extern FILE *ffcreat();
extern FILE *fftemp(); extern FILE *fftemp();
extern void fatal(const char* s, ...);
extern void serror(const char* s, ...);
extern void warning(const char* s, ...);
/* ========== Machine dependent C declarations ========== */ /* ========== Machine dependent C declarations ========== */
#include "mach1.c" #include "mach1.c"

View file

@ -11,6 +11,7 @@
#include "comm0.h" #include "comm0.h"
#include "comm1.h" #include "comm1.h"
#include "y.tab.h" #include "y.tab.h"
#include <stdarg.h>
valu_t valu_t
load(ip) load(ip)
@ -27,7 +28,7 @@ register item_t *ip;
if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) { if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) {
if (pass == PASS_3) { if (pass == PASS_3) {
if (relonami != 0) if (relonami != 0)
serror("relocation error"); serror("relocation error (relonami=%d, type=%08x)", relonami, ip->i_type);
relonami = ip->i_valu+1; relonami = ip->i_valu+1;
} }
return(0); return(0);
@ -380,13 +381,28 @@ wr_fatal()
fatal("write error"); fatal("write error");
} }
/* VARARGS1 */ void diag(const char* tail, const char* s, va_list ap)
fatal(s, a1, a2, a3, a4)
char *s;
{ {
fflush(stdout);
if (modulename)
fprintf(stderr, "\"%s\", line %ld: ", modulename, lineno);
else
fprintf(stderr, "%s: ", progname);
vfprintf(stderr, s, ap);
fprintf(stderr, "%s", tail);
}
/* VARARGS1 */
void fatal(const char* s, ...)
{
va_list ap;
va_start(ap, s);
nerrors++; nerrors++;
diag(" (fatal)\n", s, a1, a2, a3, a4); diag(" (fatal)\n", s, ap);
stop(); stop();
va_end(ap);
} }
#if DEBUG == 2 #if DEBUG == 2
@ -400,37 +416,34 @@ char *file;
#if DEBUG == 1 #if DEBUG == 1
assert1() assert1()
{ {
diag(" (fatal)\n", "assertion failed"); fatal("assertion failed");
abort(); abort();
} }
#endif #endif
/* VARARGS1 */ void serror(const char* s, ...)
serror(s, a1, a2, a3, a4)
char *s;
{ {
va_list ap;
va_start(ap, s);
nerrors++; nerrors++;
diag("\n", s, a1, a2, a3, a4); diag("\n", s, ap);
stop();
va_end(ap);
} }
/* VARARGS1 */ /* VARARGS1 */
warning(s, a1, a2, a3, a4) void warning(const char* s, ...)
char *s;
{ {
diag(" (warning)\n", s, a1, a2, a3, a4); va_list ap;
} va_start(ap, s);
/* VARARGS1 */ nerrors++;
diag(tail, s, a1, a2, a3, a4) diag(" (warning)\n", s, ap);
char *tail, *s; stop();
{
fflush(stdout); va_end(ap);
if (modulename)
fprintf(stderr, "\"%s\", line %ld: ", modulename, lineno);
else
fprintf(stderr, "%s: ", progname);
fprintf(stderr, s, a1, a2, a3, a4);
fprintf(stderr, tail);
} }
nofit() nofit()

46
mach/proto/cg/build.mk Normal file
View file

@ -0,0 +1,46 @@
define build-cg-impl
$(call reset)
$(eval cflags += -Imach/$(ARCH)/cg -I$(OBJDIR)/$D -Imach/proto/cg)
$(eval objdir := $(ARCH))
$(call cfile, mach/proto/cg/codegen.c)
$(call cfile, mach/proto/cg/compute.c)
$(call cfile, mach/proto/cg/equiv.c)
$(call cfile, mach/proto/cg/fillem.c)
$(call cfile, mach/proto/cg/gencode.c)
$(call cfile, mach/proto/cg/glosym.c)
$(call cfile, mach/proto/cg/main.c)
$(call cfile, mach/proto/cg/move.c)
$(call cfile, mach/proto/cg/nextem.c)
$(call cfile, mach/proto/cg/reg.c)
$(call cfile, mach/proto/cg/regvar.c)
$(call cfile, mach/proto/cg/salloc.c)
$(call cfile, mach/proto/cg/state.c)
$(call cfile, mach/proto/cg/subr.c)
$(call cfile, mach/proto/cg/var.c)
$(eval $q: $(OBJDIR)/$D/tables.h)
$(eval CLEANABLES += $(OBJDIR)/$D/tables.h $(OBJDIR)/$D/tables.c)
$(OBJDIR)/$D/tables.c: $(OBJDIR)/$D/tables.h
$(OBJDIR)/$D/tables.h: $(CGG) $(CPPANSI) mach/$(ARCH)/cg/table
@echo CGG $$@
@mkdir -p $$(dir $$@)
$(hide) cd $$(dir $$@) && \
$(abspath $(CPPANSI)) -I$(abspath mach/$(ARCH)/cg) $(abspath mach/$(ARCH)/cg/table) | $(abspath $(CGG))
$(call cfile, $(OBJDIR)/$D/tables.c)
$(eval $q: $(INCDIR)/flt_arith.h)
$(call rawfile, $(LIBEM_DATA))
$(call rawfile, $(LIBFLT_ARITH))
$(call cprogram, $(BINDIR)/$(PLATFORM)/cg)
$(call installto, $(PLATDEP)/$(PLATFORM)/cg)
endef
build-cg = $(eval $(build-cg-impl))

View file

@ -36,8 +36,8 @@ $(call cfile, $(OBJDIR)/$D/tables.c)
$(eval $q: $(INCDIR)/flt_arith.h) $(eval $q: $(INCDIR)/flt_arith.h)
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBFLT_ARITH)) $(call rawfile, $(LIBFLT_ARITH))
$(call cprogram, $(BINDIR)/$(PLATFORM)/ncg) $(call cprogram, $(BINDIR)/$(PLATFORM)/ncg)
$(call installto, $(PLATDEP)/$(PLATFORM)/ncg) $(call installto, $(PLATDEP)/$(PLATFORM)/ncg)

View file

@ -17,7 +17,7 @@ define build-platform-impl
$(PLATIND)/descr/$(PLATFORM) \ $(PLATIND)/descr/$(PLATFORM) \
$(PLATFORM_HEADERS_$(PLATFORM)) \ $(PLATFORM_HEADERS_$(PLATFORM)) \
$(PLATDEP)/$(PLATFORM)/as \ $(PLATDEP)/$(PLATFORM)/as \
$(PLATDEP)/$(PLATFORM)/ncg \ $(if $(arch-cg-$(ARCH)), $(PLATDEP)/$(PLATFORM)/cg, $(PLATDEP)/$(PLATFORM)/ncg) \
$(ARCHITECTURE_$(ARCH))) $(ARCHITECTURE_$(ARCH)))
# libsys # libsys
@ -48,7 +48,7 @@ define build-platform-impl
# The tools themselves # The tools themselves
$(call build-as) $(call build-as)
$(call build-ncg) $(if $(arch-cg-$(ARCH)), $(call build-cg), $(call build-ncg))
# Build top only if the architecture asks for it. # Build top only if the architecture asks for it.

View file

@ -15,12 +15,21 @@ MAX_ARGV = 8
.sect .bss .sect .bss
STACKSIZE = 2*1024 STACKSIZE = 2*1024
.comm stack, STACKSIZE .comm stack, STACKSIZE
.comm oldstack, 2
.sect .text .sect .text
begtext: begtext:
! The absolute first thing we have to do is to clear the bss. (argify ! Check if bss would overlap BDOS. We must not overwrite
! requires it.) ! BDOS and crash CP/M. We cheat by comparing only high bytes
! of each address.
lxi b, __end
lda 0x0007
mov c, a ! c = high byte of BDOS address
mov a, b ! a = high byte of _end
cmp c
jnc __exit ! emergency exit if a >= c
! We have to clear the bss. (argify requires it.)
lxi h, begbss lxi h, begbss
lxi b, endbss lxi b, endbss
@ -36,8 +45,8 @@ begtext:
jnz 1b jnz 1b
! Set up the stack (now it's been cleared, since it's in the BSS). ! Set up the stack (now it's been cleared, since it's in the BSS).
lxi sp, oldstack + STACKSIZE lxi sp, stack + STACKSIZE
! C-ify the command line at 0x0080. ! C-ify the command line at 0x0080.
@ -54,43 +63,38 @@ begtext:
! Now argify it. ! Now argify it.
lxi b, 0x0081 ! bc = command line pointer lxi b, 0x0081 ! bc = command line pointer
lxi d, argv ! de = argv pointer lxi h, argv ! hl = argv pointer
ldax b ! peek for any leading whitespace
ora a
cpi ' '
jz 3f
1: xchg ! write out the next argument
mov m, c
inx h
mov m, b
inx h
xchg
lda argc ! exit if this was the last argument loop_of_argify:
ldax b ! a = next character
ora a ! check for end of string
jz end_of_argify
cpi ' ' ! scan for non-space
jz 2f
mov m, c ! put next argument in argv
inx h
mov m, b
inx h
lda argc ! increment argc
inr a inr a
sta argc sta argc
cpi MAX_ARGV cpi MAX_ARGV ! exit loop if argv is full
jz end_of_argify jz end_of_argify
2: inx b ! scan for whitespace 1: inx b ! scan for space
ldax b ldax b
ora a ora a
jz end_of_argify jz end_of_argify
cpi ' ' cpi ' '
jnz 2b jnz 1b
xra a ! replace the space with a \0 xra a ! replace the space with a '\0'
stax b stax b
3: inx b ! scan for non-whitespace 2: inx b
ldax b jmp loop_of_argify
ora a
jz end_of_argify
cpi ' '
jz 3b
jmp 1b
end_of_argify: end_of_argify:
! Add the fake parameter for the program name. ! Add the fake parameter for the program name.
@ -110,8 +114,8 @@ end_of_argify:
mvi h, 0 mvi h, 0
push h push h
call __m_a_i_n call __m_a_i_n
jmp EXIT ! FALLTHROUGH
! Emergency exit routine. ! Emergency exit routine.
.define EXIT, __exit .define EXIT, __exit

View file

@ -2,7 +2,7 @@
define build-simple-tool-impl define build-simple-tool-impl
$(call reset) $(call reset)
$(call cfile, util/amisc/$1.c) $(call cfile, util/amisc/$1.c)
$(call file, $(LIBOBJECT)) $(call rawfile, $(LIBOBJECT))
$(call cprogram, $(BINDIR)/$1) $(call cprogram, $(BINDIR)/$1)
$(eval INSTALLABLES += $o) $(eval INSTALLABLES += $o)
$(call installto, $(INSDIR)/bin/$1) $(call installto, $(INSDIR)/bin/$1)

View file

@ -6,10 +6,10 @@ define build-aal-impl
$(call cfile, $D/archiver.c) $(call cfile, $D/archiver.c)
$(call file, $(LIBOBJECT)) $(call rawfile, $(LIBOBJECT))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/aal) $(call cprogram, $(BINDIR)/aal)
$(call installto, $(INSDIR)/bin/aal) $(call installto, $(INSDIR)/bin/aal)

25
util/cgg/build.mk Normal file
View file

@ -0,0 +1,25 @@
D := util/cgg
define build-cgg-impl
$(call reset)
$(eval cflags += -I$D)
$(call yacc, $(OBJDIR)/$D, $D/bootgram.y)
$(call flex, $(OBJDIR)/$D, $D/bootlex.l)
$(call dependson, $(OBJDIR)/$D/y.tab.h)
$(call cfile, $D/main.c)
$(eval $q: $(INCDIR)/em_spec.h)
$(call rawfile, $(LIBEM_DATA))
$(call rawfile, $(LIBASSERT))
$(call rawfile, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/cgg)
$(eval CGG := $o)
endef
$(eval $(build-cgg-impl))

View file

@ -1009,3 +1009,8 @@ max(a,b) {
return(a); return(a);
return(b); return(b);
} }
int yywrap(void) {
return 1;
}

View file

@ -3,12 +3,13 @@ D := util/data
define util-data-impl define util-data-impl
$(eval g := \ $(eval g := \
$(OBJDIR)/$D/em_flag.c \
$(OBJDIR)/$D/em_pseu.c \
$(OBJDIR)/$D/em_mnem.c \
$(INCDIR)/em_spec.h \ $(INCDIR)/em_spec.h \
$(INCDIR)/em_pseu.h \ $(INCDIR)/em_pseu.h \
$(INCDIR)/em_mnem.h \ $(INCDIR)/em_mnem.h \
$(OBJDIR)/$D/em_flag.c \ )
$(OBJDIR)/$D/em_pseu.c \
$(OBJDIR)/$D/em_mnem.c)
$(eval CLEANABLES += $g) $(eval CLEANABLES += $g)
$(wordlist 2, $(words $g), $g): $(firstword $g) $(wordlist 2, $(words $g), $g): $(firstword $g)

View file

@ -6,8 +6,8 @@ $(call reset)
$(eval cflags += -DVERBOSE -DNOTCOMPACT) $(eval cflags += -DVERBOSE -DNOTCOMPACT)
$(eval cflags += -I$D/share -I$(OBJDIR)/$D) $(eval cflags += -I$D/share -I$(OBJDIR)/$D)
$(foreach f, $2, $(call cfile, $f)) $(foreach f, $2, $(call cfile, $f))
$(call file, $(LIBDIR)/libegocore.a) $(call rawfile, $(LIBDIR)/libegocore.a)
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call cprogram, $(BINDIR)/ego/$(strip $1)) $(call cprogram, $(BINDIR)/ego/$(strip $1))
$(call installto, $(PLATDEP)/ego/$(strip $1)) $(call installto, $(PLATDEP)/ego/$(strip $1))
$(eval EGO_MODULES += $q) $(eval EGO_MODULES += $q)
@ -166,9 +166,9 @@ $(call cfile, $D/em_ego/em_ego.c)
$(eval $q: $(INCDIR)/print.h $(INCDIR)/system.h) $(eval $q: $(INCDIR)/print.h $(INCDIR)/system.h)
$(eval $q: $(INCDIR)/em_path.h) $(eval $q: $(INCDIR)/em_path.h)
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/em_ego) $(call cprogram, $(BINDIR)/em_ego)
$(call installto, $(PLATDEP)/em_ego) $(call installto, $(PLATDEP)/em_ego)

View file

@ -114,9 +114,7 @@ start_child(p)
char *in_redirect = 0; /* standard input redirected */ char *in_redirect = 0; /* standard input redirected */
char *out_redirect = 0; /* standard output redirected */ char *out_redirect = 0; /* standard output redirected */
signal_child(SIGKILL); /* like families in China, this debugger is only signal_child(SIGKILL);
allowed one child
*/
if (p != run_command) { if (p != run_command) {
freenode(run_command); freenode(run_command);

View file

@ -16,8 +16,8 @@ define build-led-impl
$(call cfile, $D/sym.c) $(call cfile, $D/sym.c)
$(call cfile, $D/write.c) $(call cfile, $D/write.c)
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call file, $(LIBOBJECT)) $(call rawfile, $(LIBOBJECT))
$(call cprogram, $(BINDIR)/em_led) $(call cprogram, $(BINDIR)/em_led)
$(call installto, $(PLATDEP)/em_led) $(call installto, $(PLATDEP)/em_led)

View file

@ -14,13 +14,13 @@ define build-misc-impl
$(eval objdir := encode) $(eval objdir := encode)
$(call cfile, $D/convert.c) $(call cfile, $D/convert.c)
$(eval $q: $(INCDIR)/em_comp.h $(INCDIR)/em_codeEK.h) $(eval $q: $(INCDIR)/em_comp.h $(INCDIR)/em_codeEK.h)
$(call file, $(LIBREAD_EMEV)) $(call rawfile, $(LIBREAD_EMEV))
$(call file, $(LIBEMK)) $(call rawfile, $(LIBEMK))
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/em_encode) $(call cprogram, $(BINDIR)/em_encode)
$(call installto, $(PLATDEP)/em_encode) $(call installto, $(PLATDEP)/em_encode)
$(eval EM_ENCODE := $o) $(eval EM_ENCODE := $o)
@ -30,13 +30,13 @@ define build-misc-impl
$(eval objdir := decode) $(eval objdir := decode)
$(call cfile, $D/convert.c) $(call cfile, $D/convert.c)
$(eval $q: $(INCDIR)/em_comp.h $(INCDIR)/em_codeEK.h) $(eval $q: $(INCDIR)/em_comp.h $(INCDIR)/em_codeEK.h)
$(call file, $(LIBREAD_EMKV)) $(call rawfile, $(LIBREAD_EMKV))
$(call file, $(LIBEME)) $(call rawfile, $(LIBEME))
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/em_decode) $(call cprogram, $(BINDIR)/em_decode)
$(call installto, $(PLATDEP)/em_decode) $(call installto, $(PLATDEP)/em_decode)
$(eval EM_DECODE := $o) $(eval EM_DECODE := $o)

View file

@ -26,7 +26,7 @@ $(call cfile, $D/var.c)
$(call cfile, $D/hall.c) $(call cfile, $D/hall.c)
$(eval CLEANABLES += $(OBJDIR)/$D/enterkeyw.c) $(eval CLEANABLES += $(OBJDIR)/$D/enterkeyw.c)
$(OBJDIR)/$D/enterkeyw.c: $D/cvtkeywords $D/keywords $(OBJDIR)/$D/enterkeyw.c: $D/cvtkeywords $D/keywords $(OBJDIR)/$D/y.tab.h
@echo KEYWORDS $$@ @echo KEYWORDS $$@
@mkdir -p $$(dir $$@) @mkdir -p $$(dir $$@)
$(hide) cd $$(dir $$@) && sh $(abspath $D/cvtkeywords) $(abspath $D/keywords) $(hide) cd $$(dir $$@) && sh $(abspath $D/cvtkeywords) $(abspath $D/keywords)
@ -34,7 +34,7 @@ $(call cfile, $(OBJDIR)/$D/enterkeyw.c)
$(eval $q: $(INCDIR)/em_spec.h) $(eval $q: $(INCDIR)/em_spec.h)
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call cprogram, $(BINDIR)/ncgg) $(call cprogram, $(BINDIR)/ncgg)
$(eval NCGG := $o) $(eval NCGG := $o)

View file

@ -10,12 +10,14 @@ $(call yacc, $(OBJDIR)/$D, $D/mktab.y)
$(call flex, $(OBJDIR)/$D, $D/scan.l) $(call flex, $(OBJDIR)/$D, $D/scan.l)
$(call dependson, $(OBJDIR)/$D/y.tab.h) $(call dependson, $(OBJDIR)/$D/y.tab.h)
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, -lfl)
$(call cprogram, $(OBJDIR)/$D/mktab) $(call cprogram, $(OBJDIR)/$D/mktab)
endef endef
.PHONY: -lfl
-lfl:
define build-opt-impl define build-opt-impl
$(call reset) $(call reset)
@ -53,12 +55,12 @@ $g: $(OBJDIR)/$D/mktab $D/patterns $(BINDIR)/cpp.ansi
$(hide) $(BINDIR)/cpp.ansi < $D/patterns | $(OBJDIR)/$D/mktab > $$@ $(hide) $(BINDIR)/cpp.ansi < $D/patterns | $(OBJDIR)/$D/mktab > $$@
$(call cfile, $g) $(call cfile, $g)
$(call file, $(LIBEM_DATA)) $(call rawfile, $(LIBEM_DATA))
$(call file, $(LIBASSERT)) $(call rawfile, $(LIBASSERT))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(eval $q: $(INCDIR)/em_spec.h) $(eval $q: $(INCDIR)/em_spec.h)
@ -79,4 +81,4 @@ endef
$(eval $(build-opt-mktab-impl)) $(eval $(build-opt-mktab-impl))
$(eval $(call build-opt-impl, em_opt,)) $(eval $(call build-opt-impl, em_opt,))
$(eval $(call build-opt-impl, em_opt2, -DGLOBAL_OPT)) $(eval $(call build-opt-impl, em_opt2, -DGLOBAL_OPT))
$(eval $(build-opt-manpage-impl)) $(eval $(build-opt-manpage-impl))

View file

@ -294,6 +294,10 @@ main() {
return nerrors; return nerrors;
} }
int yywrap(void) {
return 1;
}
yyerror(s) char *s; { yyerror(s) char *s; {
fprintf(stderr,"line %d: %s\n",lino,s); fprintf(stderr,"line %d: %s\n",lino,s);

View file

@ -15,11 +15,11 @@ define build-topgen-impl
$(call llgen, $(OBJDIR)/$D, $D/topgen.g) $(call llgen, $(OBJDIR)/$D, $D/topgen.g)
$(call file, $(LIBASSERT)) $(call rawfile, $(LIBASSERT))
$(call file, $(LIBPRINT)) $(call rawfile, $(LIBPRINT))
$(call file, $(LIBALLOC)) $(call rawfile, $(LIBALLOC))
$(call file, $(LIBSYSTEM)) $(call rawfile, $(LIBSYSTEM))
$(call file, $(LIBSTRING)) $(call rawfile, $(LIBSTRING))
$(call cprogram, $(BINDIR)/topgen) $(call cprogram, $(BINDIR)/topgen)
TOPGEN := $o TOPGEN := $o