From 606012371ebf3e7848f9ae0a495bd10df2d2d15f Mon Sep 17 00:00:00 2001 From: dtrg Date: Sun, 30 Jul 2006 23:45:18 +0000 Subject: [PATCH] Added support for the ANSI C language runtime and preprocessor. --- lang/cem/cpp.ansi/pmfile | 132 +++++++++++++++++ lang/cem/libcc.ansi/pmfile | 296 +++++++++++++++++++++++++++++++++++++ lang/cem/pmfile | 1 + pmfile | 47 +----- 4 files changed, 432 insertions(+), 44 deletions(-) create mode 100644 lang/cem/cpp.ansi/pmfile create mode 100644 lang/cem/libcc.ansi/pmfile diff --git a/lang/cem/cpp.ansi/pmfile b/lang/cem/cpp.ansi/pmfile new file mode 100644 index 000000000..b21c677a7 --- /dev/null +++ b/lang/cem/cpp.ansi/pmfile @@ -0,0 +1,132 @@ +-- $Source$ +-- $State$ + +local d = ROOTDIR.."lang/cem/cpp.ansi/" + +local extract_parameters = simple { + outputs = { + "%U%/pathlength.h", + "%U%/errout.h", + "%U%/idfsize.h", + "%U%/numsize.h", + "%U%/nparams.h", + "%U%/ifdepth.h", + "%U%/macbuf.h", + "%U%/strsize.h", + "%U%/botch_free.h", + "%U%/debug.h", + "%U%/parbufsize.h", + "%U%/textsize.h", + "%U%/inputtype.h", + "%U%/obufsize.h", + "%U%/dobits.h", + "%U%/ln_prefix.h", + }, + + command = { + "cd %out[1]:dirname% && %in[1]% %in[2]%" + }, + + file (d.."make.hfiles"), + file (d.."Parameters") +} + +local lpars = LLgen { + simple { + outputs = {"%U%/tokenfile.g"}, + command = { + "%in[1]% < %in[2]% > %out[1]%" + }, + file (d.."make.tokfile"), + file (d.."tokenname.c") + }, + file (d.."expression.g"), +} + +local allocd_header = simple { + class = "allocd_header", + command = { + "%in[1]% < %in[2]% > %out[1]%" + }, + + file (d.."make.allocd") +} + +local cfile_with_headers = cfile { + class = "cfile_with_headers", + dynamicheaders = { + file (d), + extract_parameters, + allocd_header { outputs = {"%U%/replace.h"}, (d.."replace.str") }, + allocd_header { outputs = {"%U%/macro.h"}, (d.."macro.str") }, + lpars + } +} + +tool_cpp_ansi = cprogram { + cfile_with_headers (d.."LLlex.c"), + cfile_with_headers (d.."LLmessage.c"), + cfile_with_headers (d.."ch3bin.c"), + cfile_with_headers (d.."ch3mon.c"), + cfile_with_headers (d.."domacro.c"), + cfile_with_headers (d.."error.c"), + cfile_with_headers (d.."idf.c"), + cfile_with_headers (d.."init.c"), + cfile_with_headers (d.."input.c"), + cfile_with_headers (d.."main.c"), + cfile_with_headers (d.."options.c"), + cfile_with_headers (d.."preprocess.c"), + cfile_with_headers (d.."replace.c"), + cfile_with_headers (d.."skip.c"), + cfile_with_headers (d.."tokenname.c"), + cfile_with_headers (d.."expr.c"), + + foreach { + rule = cfile_with_headers, + ith { lpars, from=2 } + }, + + cfile_with_headers { + simple { + outputs = {"%U%-symbol2str.c"}, + command = { + "%in[1]% < %in[2]% > %out[1]%" + }, + + file (d.."make.tokcase"), + file (d.."tokenname.c") + } + }, + + cfile_with_headers { + CEXTRAFLAGS = "-I"..d, + tabgen (d.."char.tab") + }, + + cfile_with_headers { + simple { + outputs = {"%U%-next.c"}, + command = { + "%in% > %out%" + }, + + file (d.."make.next"), + + file (d.."macro.str"), + file (d.."replace.str"), + } + }, + + lib_input, + lib_assert, + lib_alloc, + lib_print, + lib_system, + lib_string, + + outputs = {"%U%/cpp.ansi"}, + install = { + pm.install( BINDIR..PLATDEP.."/cpp.ansi"), + pm.install(d.."ncpp.6", BINDIR.."/man/man6/cpp.ansi.6"), + } +} diff --git a/lang/cem/libcc.ansi/pmfile b/lang/cem/libcc.ansi/pmfile new file mode 100644 index 000000000..4d6f140ac --- /dev/null +++ b/lang/cem/libcc.ansi/pmfile @@ -0,0 +1,296 @@ +-- $Source$ +-- $State$ + +local d = ROOTDIR.."lang/cem/libcc.ansi/" + +local crt = ackfile { + ACKINCLUDES = {PARENT, "-I%ROOTDIR%h"}, + file (d.."head_ac.e"), + install = pm.install("%BINDIR%%PLATIND%/%ARCH%/head_ac") +} + +local libc = acklibrary { + ACKBUILDFLAGS = {PARENT, "-ansi"}, + ACKINCLUDES = {PARENT, "-I%ROOTDIR%h", "-I"..d.."headers", "-I%ROOTDIR%include/_tail_cc"}, + outputs = {"%U%/tail_ac.a"}, + + -- assert + + ackfile (d.."assert/assert.c"), + + -- ctype + + ackfile (d.."ctype/tolower.c"), + ackfile (d.."ctype/toupper.c"), + ackfile { + tabgen (d.."ctype/char.tab") + }, + foreach { + rule = ackfile, + simple { + outputs = { + "%U%/isalnum.c", + "%U%/isalpha.c", + "%U%/iscntrl.c", + "%U%/isdigit.c", + "%U%/isgraph.c", + "%U%/islower.c", + "%U%/isprint.c", + "%U%/ispunct.c", + "%U%/isspace.c", + "%U%/isupper.c", + "%U%/isxdigit.c", + "%U%/isascii.c", + }, + command = { + "cd %out[1]:dirname% && %in[1]%" + }, + + file (d.."ctype/genfiles") + } + }, + + -- errno + + ackfile (d.."errno/errlist.c"), + + -- locale + + ackfile (d.."locale/localeconv.c"), + ackfile (d.."locale/setlocale.c"), + + -- math + + ackfile (d.."math/asin.c"), + ackfile (d.."math/atan2.c"), + ackfile (d.."math/atan.c"), + ackfile (d.."math/ceil.c"), + ackfile (d.."math/fabs.c"), + ackfile (d.."math/pow.c"), + ackfile (d.."math/log10.c"), + ackfile (d.."math/log.c"), + ackfile (d.."math/sin.c"), + ackfile (d.."math/sinh.c"), + ackfile (d.."math/sqrt.c"), + ackfile (d.."math/tan.c"), + ackfile (d.."math/tanh.c"), + ackfile (d.."math/exp.c"), + ackfile (d.."math/ldexp.c"), + ackfile (d.."math/fmod.c"), + ackfile (d.."math/floor.c"), + ackfile (d.."math/hugeval.c"), + ackfile (d.."math/frexp.e"), + ackfile (d.."math/modf.e"), + ackfile (d.."math/isnan.c"), + + -- misc + + ackfile (d.."misc/getgrent.c"), + ackfile (d.."misc/getopt.c"), + ackfile (d.."misc/getpass.c"), + ackfile (d.."misc/getpw.c"), + ackfile (d.."misc/getw.c"), + ackfile (d.."misc/putw.c"), + ackfile (d.."misc/putenv.c"), + ackfile (d.."misc/environ.c"), + ackfile (d.."misc/popen.c"), + ackfile (d.."misc/sleep.c"), + ackfile (d.."misc/termcap.c"), + ackfile (d.."misc/fdopen.c"), + ackfile (d.."misc/closedir.c"), + group { + ACKINCLUDES = {PARENT, "-DUFS"}, + ackfile (d.."misc/getdents.c") + }, + ackfile (d.."misc/opendir.c"), + ackfile (d.."misc/readdir.c"), + ackfile (d.."misc/rewinddir.c"), + ackfile (d.."misc/seekdir.c"), + ackfile (d.."misc/telldir.c"), + ackfile (d.."misc/isatty.c"), + ackfile (d.."misc/mktemp.c"), + ackfile (d.."misc/hypot.c"), + + -- setjmp + + ackfile (d.."setjmp/setjmp.e"), + ackfile (d.."setjmp/sigmisc.c"), + + -- signal + + ackfile (d.."signal/raise.c"), + + -- stdio + + ackfile (d.."stdio/tmpfile.c"), + ackfile (d.."stdio/tmpnam.c"), + ackfile (d.."stdio/rename.c"), + ackfile (d.."stdio/remove.c"), + ackfile (d.."stdio/fopen.c"), + ackfile (d.."stdio/freopen.c"), + ackfile (d.."stdio/setbuf.c"), + ackfile (d.."stdio/setvbuf.c"), + ackfile (d.."stdio/perror.c"), + ackfile (d.."stdio/fprintf.c"), + ackfile (d.."stdio/printf.c"), + ackfile (d.."stdio/sprintf.c"), + ackfile (d.."stdio/vfprintf.c"), + ackfile (d.."stdio/vprintf.c"), + ackfile (d.."stdio/vsprintf.c"), + ackfile (d.."stdio/doprnt.c"), + ackfile (d.."stdio/icompute.c"), + ackfile (d.."stdio/fscanf.c"), + ackfile (d.."stdio/scanf.c"), + ackfile (d.."stdio/sscanf.c"), + ackfile (d.."stdio/doscan.c"), + ackfile (d.."stdio/fgetc.c"), + ackfile (d.."stdio/fgets.c"), + ackfile (d.."stdio/getc.c"), + ackfile (d.."stdio/getchar.c"), + ackfile (d.."stdio/gets.c"), + ackfile (d.."stdio/putc.c"), + ackfile (d.."stdio/putchar.c"), + ackfile (d.."stdio/fputc.c"), + ackfile (d.."stdio/puts.c"), + ackfile (d.."stdio/fputs.c"), + ackfile (d.."stdio/ungetc.c"), + ackfile (d.."stdio/fread.c"), + ackfile (d.."stdio/fwrite.c"), + ackfile (d.."stdio/fgetpos.c"), + ackfile (d.."stdio/fsetpos.c"), + ackfile (d.."stdio/rewind.c"), + ackfile (d.."stdio/fseek.c"), + ackfile (d.."stdio/ftell.c"), + ackfile (d.."stdio/clearerr.c"), + ackfile (d.."stdio/feof.c"), + ackfile (d.."stdio/ferror.c"), + ackfile (d.."stdio/fileno.c"), + ackfile (d.."stdio/fltpr.c"), + ackfile (d.."stdio/ecvt.c"), + ackfile (d.."stdio/fillbuf.c"), + ackfile (d.."stdio/fclose.c"), + ackfile (d.."stdio/flushbuf.c"), + ackfile (d.."stdio/fflush.c"), + ackfile (d.."stdio/isatty.c"), + ackfile (d.."stdio/data.c"), + + -- stdlib + + ackfile (d.."stdlib/abort.c"), + ackfile (d.."stdlib/abs.c"), + ackfile (d.."stdlib/atof.c"), + ackfile (d.."stdlib/atoi.c"), + ackfile (d.."stdlib/atol.c"), + ackfile (d.."stdlib/bsearch.c"), + ackfile (d.."stdlib/div.c"), + ackfile (d.."stdlib/atexit.c"), + ackfile (d.."stdlib/exit.c"), + ackfile (d.."stdlib/getenv.c"), + ackfile (d.."stdlib/labs.c"), + ackfile (d.."stdlib/ldiv.c"), + ackfile (d.."stdlib/mblen.c"), + ackfile (d.."stdlib/mbstowcs.c"), + ackfile (d.."stdlib/mbtowc.c"), + ackfile (d.."stdlib/qsort.c"), + ackfile (d.."stdlib/rand.c"), + ackfile (d.."stdlib/strtod.c"), + ackfile (d.."stdlib/strtol.c"), + ackfile (d.."stdlib/system.c"), + ackfile (d.."stdlib/wcstombs.c"), + ackfile (d.."stdlib/wctomb.c"), + ackfile (d.."stdlib/ext_comp.c"), + ackfile { + simple { + outputs = {"%U%/malloc.c"}, + command = { + "rm -f %out% && for i in %in[2-]%; do %in[1]% $i >> %out%; done" + }, + file (d.."stdlib/malloc/add_file"), + file (d.."stdlib/malloc/READ_ME"), + file (d.."stdlib/malloc/size_type.h"), + file (d.."stdlib/malloc/param.h"), + file (d.."stdlib/malloc/impl.h"), + file (d.."stdlib/malloc/check.h"), + file (d.."stdlib/malloc/log.h"), + file (d.."stdlib/malloc/phys.h"), + file (d.."stdlib/malloc/mal.c"), + file (d.."stdlib/malloc/log.c"), + file (d.."stdlib/malloc/phys.c"), + file (d.."stdlib/malloc/check.c"), + } + }, + + -- string + + ackfile (d.."string/memchr.c"), + ackfile (d.."string/memcmp.c"), + ackfile (d.."string/memcpy.c"), + ackfile (d.."string/memmove.c"), + ackfile (d.."string/memset.c"), + ackfile (d.."string/strcat.c"), + ackfile (d.."string/strchr.c"), + ackfile (d.."string/strcmp.c"), + ackfile (d.."string/strcoll.c"), + ackfile (d.."string/strcpy.c"), + ackfile (d.."string/strcspn.c"), + ackfile (d.."string/strerror.c"), + ackfile (d.."string/strncat.c"), + ackfile (d.."string/strncpy.c"), + ackfile (d.."string/strrchr.c"), + ackfile (d.."string/strstr.c"), + ackfile (d.."string/strlen.c"), + ackfile (d.."string/strtok.c"), + ackfile (d.."string/strpbrk.c"), + ackfile (d.."string/strspn.c"), + ackfile (d.."string/strncmp.c"), + ackfile (d.."string/strxfrm.c"), + + -- time + + ackfile (d.."time/ctime.c"), + ackfile (d.."time/asctime.c"), + ackfile (d.."time/localtime.c"), + ackfile (d.."time/clock.c"), + ackfile (d.."time/difftime.c"), + ackfile (d.."time/gmtime.c"), + ackfile (d.."time/mktime.c"), + ackfile (d.."time/strftime.c"), + ackfile (d.."time/time.c"), + ackfile (d.."time/tzset.c"), + ackfile (d.."time/misc.c"), + + install = { + pm.install("%BINDIR%%PLATIND%/%ARCH%/tail_ac") + } +} + +local headers = group { + install = { + pm.install(d.."headers/assert.h", "%BINDIR%include/assert.h"), + pm.install(d.."headers/ctype.h", "%BINDIR%include/ctype.h"), + pm.install(d.."headers/dirent.h", "%BINDIR%include/dirent.h"), + pm.install(d.."headers/errno.h", "%BINDIR%include/errno.h"), + pm.install(d.."headers/float.h", "%BINDIR%include/float.h"), + pm.install(d.."headers/grp.h", "%BINDIR%include/grp.h"), + pm.install(d.."headers/limits.h", "%BINDIR%include/limits.h"), + pm.install(d.."headers/locale.h", "%BINDIR%include/locale.h"), + pm.install(d.."headers/math.h", "%BINDIR%include/math.h"), + pm.install(d.."headers/mathconst.h", "%BINDIR%include/mathconst.h"), + pm.install(d.."headers/setjmp.h", "%BINDIR%include/setjmp.h"), + pm.install(d.."headers/signal.h", "%BINDIR%include/signal.h"), + pm.install(d.."headers/stdarg.h", "%BINDIR%include/stdarg.h"), + pm.install(d.."headers/stddef.h", "%BINDIR%include/stddef.h"), + pm.install(d.."headers/stdio.h", "%BINDIR%include/stdio.h"), + pm.install(d.."headers/stdlib.h", "%BINDIR%include/stdlib.h"), + pm.install(d.."headers/string.h", "%BINDIR%include/string.h"), + pm.install(d.."headers/time.h", "%BINDIR%include/time.h"), + pm.install(d.."headers/sys/dirent.h", "%BINDIR%include/sys/dirent.h"), + pm.install(d.."headers/sys/errno.h", "%BINDIR%include/sys/errno.h"), + } +} + +lang_cem_ansi_runtime = group { + crt, + libc, + headers +} diff --git a/lang/cem/pmfile b/lang/cem/pmfile index e9453cff2..ff7212b82 100644 --- a/lang/cem/pmfile +++ b/lang/cem/pmfile @@ -6,3 +6,4 @@ local d = ROOTDIR.."lang/cem/" include (d.."cemcom/pmfile") include (d.."cemcom.ansi/pmfile") include (d.."libcc/pmfile") +include (d.."libcc.ansi/pmfile") diff --git a/pmfile b/pmfile index 6f49839a2..93bc2e97f 100644 --- a/pmfile +++ b/pmfile @@ -37,6 +37,7 @@ include "util/cmisc/pmfile" include "util/ack/pmfile" include "util/arch/pmfile" include "util/cpp/pmfile" +include "lang/cem/cpp.ansi/pmfile" include "util/cgg/pmfile" include "util/ncgg/pmfile" include "util/ceg/pmfile" @@ -75,6 +76,7 @@ include "mach/z8000/pmfile" lang_runtimes = group { lang_cem_runtime, + lang_cem_ansi_runtime, lang_pc_runtime, lang_m2_runtime, lang_occam_runtime, @@ -107,6 +109,7 @@ default = group { tool_aal, tool_ack, tool_cpp, + tool_cpp_ansi, tool_cgg, tool_ncgg, -- tool_ceg, @@ -173,47 +176,3 @@ configure = simple { f:close() end } - --- Revision history --- $Log$ --- Revision 1.15 2006-07-27 22:51:38 dtrg --- Added support for the K&R C language runtime. --- --- Revision 1.14 2006/07/27 22:14:55 dtrg --- Added support for the Modula-2 language runtime. --- --- Revision 1.13 2006/07/27 22:07:38 dtrg --- Added support for the Pascal language runtime. --- --- Revision 1.12 2006/07/27 21:58:13 dtrg --- Added support for the Basic and Occam language runtimes. --- --- Revision 1.11 2006/07/26 23:08:09 dtrg --- Added support for the Basic compiler. --- --- Revision 1.10 2006/07/26 18:23:32 dtrg --- Added support for the Occam compiler. --- --- Revision 1.9 2006/07/26 17:12:19 dtrg --- Added support for the Modula-2 compiler. --- --- Revision 1.8 2006/07/22 21:24:41 dtrg --- Really added support for the Pascal compiler. --- --- Revision 1.7 2006/07/22 21:03:07 dtrg --- Added support for the Pascal compiler. --- --- Revision 1.6 2006/07/22 20:10:41 dtrg --- Added support for the esize object inspection tool. --- --- Revision 1.5 2006/07/22 20:04:41 dtrg --- Added support for the led link editor. --- --- Revision 1.4 2006/07/22 12:31:19 dtrg --- Added support for the top target peephole optimiser. --- --- Revision 1.3 2006/07/22 00:52:01 dtrg --- Added support for the ego global optimisation suite. --- --- Revision 1.2 2006/07/20 23:24:42 dtrg --- Fixed revision history. \ No newline at end of file -- 2.34.1