diff --git a/lang/cem/libcc.ansi/build.lua b/lang/cem/libcc.ansi/build.lua index c49bdf0e2..b40ec30ec 100644 --- a/lang/cem/libcc.ansi/build.lua +++ b/lang/cem/libcc.ansi/build.lua @@ -2,12 +2,12 @@ include("plat/build.lua") tabgen { name = "ctype_tab", - srcs = { "./pure/ctype/char.tab" } + srcs = { "./core/ctype/char.tab" } } normalrule { name = "ctype_files", - ins = { "./pure/ctype/genfiles" }, + ins = { "./core/ctype/genfiles" }, outleaves = { "isalnum.c", "isalpha.c", @@ -33,14 +33,14 @@ for _, plat in ipairs(vars.plats) do srcs = { "+ctype_files", "+ctype_tab", - "./pure/string/*.c", - "./pure/stdlib/*.c", - "./pure/locale/*.c", - "./pure/setjmp/*.c", - "./pure/setjmp/*.e", - "./pure/math/*.c", -- hypot.c - "./pure/math/*.e", - "./pure/ctype/*.c", + "./core/string/*.c", + "./core/stdlib/*.c", + "./core/locale/*.c", + "./core/setjmp/*.c", + "./core/setjmp/*.e", + "./core/math/*.c", -- hypot.c + "./core/math/*.e", + "./core/ctype/*.c", "./errno/*.c", "./malloc/*.c", "./misc/environ.c", -- don't build everything here as it's all obsolete @@ -56,7 +56,7 @@ for _, plat in ipairs(vars.plats) do "lang/cem/libcc.ansi/headers+pkg", "plat/"..plat.."/include+pkg", "./malloc/malloc.h", - "./pure/math/localmath.h", + "./core/math/localmath.h", "./stdio/loc_incl.h", "./stdlib/ext_fmt.h", "./time/loc_time.h", diff --git a/lang/cem/libcc.ansi/core/README.md b/lang/cem/libcc.ansi/core/README.md new file mode 100644 index 000000000..48243c8c6 --- /dev/null +++ b/lang/cem/libcc.ansi/core/README.md @@ -0,0 +1,19 @@ +This directory contains the libc core: functions here may depend on other +libc functions _only_ (so, no `unistd.h` stuff). Plats don't get to configure +this, so nothing here should add any overhead if the function isn't linked. + +Examples of what goes here: + + - `strcmp()` --- because it's pure code. + - `setjmp()` --- in EM, it's portable. + - `assert()` --- because it only calls other core functions (`fputs()` + and `abort()`). + +Examples of what doesn't go here: + + - `malloc()` --- because it calls the `unistd.h` function `sbrk()` (and so a + plat might want to swap it out). + - stdio --- because it calls the `unistd.h` functions `read()`, `write()` + etc. + - `signal()` --- because it can't be implemented portably and needs to go + in the plat. diff --git a/lang/cem/libcc.ansi/pure/ctype/char.tab b/lang/cem/libcc.ansi/core/ctype/char.tab similarity index 100% rename from lang/cem/libcc.ansi/pure/ctype/char.tab rename to lang/cem/libcc.ansi/core/ctype/char.tab diff --git a/lang/cem/libcc.ansi/pure/ctype/genfiles b/lang/cem/libcc.ansi/core/ctype/genfiles similarity index 100% rename from lang/cem/libcc.ansi/pure/ctype/genfiles rename to lang/cem/libcc.ansi/core/ctype/genfiles diff --git a/lang/cem/libcc.ansi/pure/ctype/tolower.c b/lang/cem/libcc.ansi/core/ctype/tolower.c similarity index 100% rename from lang/cem/libcc.ansi/pure/ctype/tolower.c rename to lang/cem/libcc.ansi/core/ctype/tolower.c diff --git a/lang/cem/libcc.ansi/pure/ctype/toupper.c b/lang/cem/libcc.ansi/core/ctype/toupper.c similarity index 100% rename from lang/cem/libcc.ansi/pure/ctype/toupper.c rename to lang/cem/libcc.ansi/core/ctype/toupper.c diff --git a/lang/cem/libcc.ansi/pure/locale/localeconv.c b/lang/cem/libcc.ansi/core/locale/localeconv.c similarity index 100% rename from lang/cem/libcc.ansi/pure/locale/localeconv.c rename to lang/cem/libcc.ansi/core/locale/localeconv.c diff --git a/lang/cem/libcc.ansi/pure/locale/setlocale.c b/lang/cem/libcc.ansi/core/locale/setlocale.c similarity index 100% rename from lang/cem/libcc.ansi/pure/locale/setlocale.c rename to lang/cem/libcc.ansi/core/locale/setlocale.c diff --git a/lang/cem/libcc.ansi/pure/math/asin.c b/lang/cem/libcc.ansi/core/math/asin.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/asin.c rename to lang/cem/libcc.ansi/core/math/asin.c diff --git a/lang/cem/libcc.ansi/pure/math/atan.c b/lang/cem/libcc.ansi/core/math/atan.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/atan.c rename to lang/cem/libcc.ansi/core/math/atan.c diff --git a/lang/cem/libcc.ansi/pure/math/atan2.c b/lang/cem/libcc.ansi/core/math/atan2.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/atan2.c rename to lang/cem/libcc.ansi/core/math/atan2.c diff --git a/lang/cem/libcc.ansi/pure/math/ceil.c b/lang/cem/libcc.ansi/core/math/ceil.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/ceil.c rename to lang/cem/libcc.ansi/core/math/ceil.c diff --git a/lang/cem/libcc.ansi/pure/math/exp.c b/lang/cem/libcc.ansi/core/math/exp.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/exp.c rename to lang/cem/libcc.ansi/core/math/exp.c diff --git a/lang/cem/libcc.ansi/pure/math/fabs.c b/lang/cem/libcc.ansi/core/math/fabs.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/fabs.c rename to lang/cem/libcc.ansi/core/math/fabs.c diff --git a/lang/cem/libcc.ansi/pure/math/floor.c b/lang/cem/libcc.ansi/core/math/floor.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/floor.c rename to lang/cem/libcc.ansi/core/math/floor.c diff --git a/lang/cem/libcc.ansi/pure/math/fmod.c b/lang/cem/libcc.ansi/core/math/fmod.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/fmod.c rename to lang/cem/libcc.ansi/core/math/fmod.c diff --git a/lang/cem/libcc.ansi/pure/math/frexp.e b/lang/cem/libcc.ansi/core/math/frexp.e similarity index 100% rename from lang/cem/libcc.ansi/pure/math/frexp.e rename to lang/cem/libcc.ansi/core/math/frexp.e diff --git a/lang/cem/libcc.ansi/pure/math/hugeval.c b/lang/cem/libcc.ansi/core/math/hugeval.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/hugeval.c rename to lang/cem/libcc.ansi/core/math/hugeval.c diff --git a/lang/cem/libcc.ansi/pure/math/hypot.c b/lang/cem/libcc.ansi/core/math/hypot.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/hypot.c rename to lang/cem/libcc.ansi/core/math/hypot.c diff --git a/lang/cem/libcc.ansi/pure/math/isnan.c b/lang/cem/libcc.ansi/core/math/isnan.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/isnan.c rename to lang/cem/libcc.ansi/core/math/isnan.c diff --git a/lang/cem/libcc.ansi/pure/math/ldexp.c b/lang/cem/libcc.ansi/core/math/ldexp.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/ldexp.c rename to lang/cem/libcc.ansi/core/math/ldexp.c diff --git a/lang/cem/libcc.ansi/pure/math/localmath.h b/lang/cem/libcc.ansi/core/math/localmath.h similarity index 100% rename from lang/cem/libcc.ansi/pure/math/localmath.h rename to lang/cem/libcc.ansi/core/math/localmath.h diff --git a/lang/cem/libcc.ansi/pure/math/log.c b/lang/cem/libcc.ansi/core/math/log.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/log.c rename to lang/cem/libcc.ansi/core/math/log.c diff --git a/lang/cem/libcc.ansi/pure/math/log10.c b/lang/cem/libcc.ansi/core/math/log10.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/log10.c rename to lang/cem/libcc.ansi/core/math/log10.c diff --git a/lang/cem/libcc.ansi/pure/math/modf.e b/lang/cem/libcc.ansi/core/math/modf.e similarity index 100% rename from lang/cem/libcc.ansi/pure/math/modf.e rename to lang/cem/libcc.ansi/core/math/modf.e diff --git a/lang/cem/libcc.ansi/pure/math/pow.c b/lang/cem/libcc.ansi/core/math/pow.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/pow.c rename to lang/cem/libcc.ansi/core/math/pow.c diff --git a/lang/cem/libcc.ansi/pure/math/sin.c b/lang/cem/libcc.ansi/core/math/sin.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/sin.c rename to lang/cem/libcc.ansi/core/math/sin.c diff --git a/lang/cem/libcc.ansi/pure/math/sinh.c b/lang/cem/libcc.ansi/core/math/sinh.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/sinh.c rename to lang/cem/libcc.ansi/core/math/sinh.c diff --git a/lang/cem/libcc.ansi/pure/math/sqrt.c b/lang/cem/libcc.ansi/core/math/sqrt.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/sqrt.c rename to lang/cem/libcc.ansi/core/math/sqrt.c diff --git a/lang/cem/libcc.ansi/pure/math/tan.c b/lang/cem/libcc.ansi/core/math/tan.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/tan.c rename to lang/cem/libcc.ansi/core/math/tan.c diff --git a/lang/cem/libcc.ansi/pure/math/tanh.c b/lang/cem/libcc.ansi/core/math/tanh.c similarity index 100% rename from lang/cem/libcc.ansi/pure/math/tanh.c rename to lang/cem/libcc.ansi/core/math/tanh.c diff --git a/lang/cem/libcc.ansi/pure/setjmp/setjmp.e b/lang/cem/libcc.ansi/core/setjmp/setjmp.e similarity index 100% rename from lang/cem/libcc.ansi/pure/setjmp/setjmp.e rename to lang/cem/libcc.ansi/core/setjmp/setjmp.e diff --git a/lang/cem/libcc.ansi/pure/setjmp/sigmisc.c b/lang/cem/libcc.ansi/core/setjmp/sigmisc.c similarity index 100% rename from lang/cem/libcc.ansi/pure/setjmp/sigmisc.c rename to lang/cem/libcc.ansi/core/setjmp/sigmisc.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/abs.c b/lang/cem/libcc.ansi/core/stdlib/abs.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/abs.c rename to lang/cem/libcc.ansi/core/stdlib/abs.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/atoi.c b/lang/cem/libcc.ansi/core/stdlib/atoi.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/atoi.c rename to lang/cem/libcc.ansi/core/stdlib/atoi.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/atol.c b/lang/cem/libcc.ansi/core/stdlib/atol.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/atol.c rename to lang/cem/libcc.ansi/core/stdlib/atol.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/bsearch.c b/lang/cem/libcc.ansi/core/stdlib/bsearch.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/bsearch.c rename to lang/cem/libcc.ansi/core/stdlib/bsearch.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/div.c b/lang/cem/libcc.ansi/core/stdlib/div.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/div.c rename to lang/cem/libcc.ansi/core/stdlib/div.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/getenv.c b/lang/cem/libcc.ansi/core/stdlib/getenv.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/getenv.c rename to lang/cem/libcc.ansi/core/stdlib/getenv.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/labs.c b/lang/cem/libcc.ansi/core/stdlib/labs.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/labs.c rename to lang/cem/libcc.ansi/core/stdlib/labs.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/ldiv.c b/lang/cem/libcc.ansi/core/stdlib/ldiv.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/ldiv.c rename to lang/cem/libcc.ansi/core/stdlib/ldiv.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/mblen.c b/lang/cem/libcc.ansi/core/stdlib/mblen.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/mblen.c rename to lang/cem/libcc.ansi/core/stdlib/mblen.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/mbstowcs.c b/lang/cem/libcc.ansi/core/stdlib/mbstowcs.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/mbstowcs.c rename to lang/cem/libcc.ansi/core/stdlib/mbstowcs.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/mbtowc.c b/lang/cem/libcc.ansi/core/stdlib/mbtowc.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/mbtowc.c rename to lang/cem/libcc.ansi/core/stdlib/mbtowc.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/putenv.c b/lang/cem/libcc.ansi/core/stdlib/putenv.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/putenv.c rename to lang/cem/libcc.ansi/core/stdlib/putenv.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/qsort.c b/lang/cem/libcc.ansi/core/stdlib/qsort.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/qsort.c rename to lang/cem/libcc.ansi/core/stdlib/qsort.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/rand.c b/lang/cem/libcc.ansi/core/stdlib/rand.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/rand.c rename to lang/cem/libcc.ansi/core/stdlib/rand.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/setenv.c b/lang/cem/libcc.ansi/core/stdlib/setenv.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/setenv.c rename to lang/cem/libcc.ansi/core/stdlib/setenv.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/strtol.c b/lang/cem/libcc.ansi/core/stdlib/strtol.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/strtol.c rename to lang/cem/libcc.ansi/core/stdlib/strtol.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/wcstombs.c b/lang/cem/libcc.ansi/core/stdlib/wcstombs.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/wcstombs.c rename to lang/cem/libcc.ansi/core/stdlib/wcstombs.c diff --git a/lang/cem/libcc.ansi/pure/stdlib/wctomb.c b/lang/cem/libcc.ansi/core/stdlib/wctomb.c similarity index 100% rename from lang/cem/libcc.ansi/pure/stdlib/wctomb.c rename to lang/cem/libcc.ansi/core/stdlib/wctomb.c diff --git a/lang/cem/libcc.ansi/pure/string/memchr.c b/lang/cem/libcc.ansi/core/string/memchr.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/memchr.c rename to lang/cem/libcc.ansi/core/string/memchr.c diff --git a/lang/cem/libcc.ansi/pure/string/memcmp.c b/lang/cem/libcc.ansi/core/string/memcmp.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/memcmp.c rename to lang/cem/libcc.ansi/core/string/memcmp.c diff --git a/lang/cem/libcc.ansi/pure/string/memcpy.c b/lang/cem/libcc.ansi/core/string/memcpy.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/memcpy.c rename to lang/cem/libcc.ansi/core/string/memcpy.c diff --git a/lang/cem/libcc.ansi/pure/string/memmove.c b/lang/cem/libcc.ansi/core/string/memmove.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/memmove.c rename to lang/cem/libcc.ansi/core/string/memmove.c diff --git a/lang/cem/libcc.ansi/pure/string/memset.c b/lang/cem/libcc.ansi/core/string/memset.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/memset.c rename to lang/cem/libcc.ansi/core/string/memset.c diff --git a/lang/cem/libcc.ansi/pure/string/strcat.c b/lang/cem/libcc.ansi/core/string/strcat.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strcat.c rename to lang/cem/libcc.ansi/core/string/strcat.c diff --git a/lang/cem/libcc.ansi/pure/string/strchr.c b/lang/cem/libcc.ansi/core/string/strchr.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strchr.c rename to lang/cem/libcc.ansi/core/string/strchr.c diff --git a/lang/cem/libcc.ansi/pure/string/strcmp.c b/lang/cem/libcc.ansi/core/string/strcmp.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strcmp.c rename to lang/cem/libcc.ansi/core/string/strcmp.c diff --git a/lang/cem/libcc.ansi/pure/string/strcoll.c b/lang/cem/libcc.ansi/core/string/strcoll.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strcoll.c rename to lang/cem/libcc.ansi/core/string/strcoll.c diff --git a/lang/cem/libcc.ansi/pure/string/strcpy.c b/lang/cem/libcc.ansi/core/string/strcpy.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strcpy.c rename to lang/cem/libcc.ansi/core/string/strcpy.c diff --git a/lang/cem/libcc.ansi/pure/string/strcspn.c b/lang/cem/libcc.ansi/core/string/strcspn.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strcspn.c rename to lang/cem/libcc.ansi/core/string/strcspn.c diff --git a/lang/cem/libcc.ansi/pure/string/strdup.c b/lang/cem/libcc.ansi/core/string/strdup.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strdup.c rename to lang/cem/libcc.ansi/core/string/strdup.c diff --git a/lang/cem/libcc.ansi/pure/string/strlen.c b/lang/cem/libcc.ansi/core/string/strlen.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strlen.c rename to lang/cem/libcc.ansi/core/string/strlen.c diff --git a/lang/cem/libcc.ansi/pure/string/strncat.c b/lang/cem/libcc.ansi/core/string/strncat.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strncat.c rename to lang/cem/libcc.ansi/core/string/strncat.c diff --git a/lang/cem/libcc.ansi/pure/string/strncmp.c b/lang/cem/libcc.ansi/core/string/strncmp.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strncmp.c rename to lang/cem/libcc.ansi/core/string/strncmp.c diff --git a/lang/cem/libcc.ansi/pure/string/strncpy.c b/lang/cem/libcc.ansi/core/string/strncpy.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strncpy.c rename to lang/cem/libcc.ansi/core/string/strncpy.c diff --git a/lang/cem/libcc.ansi/pure/string/strpbrk.c b/lang/cem/libcc.ansi/core/string/strpbrk.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strpbrk.c rename to lang/cem/libcc.ansi/core/string/strpbrk.c diff --git a/lang/cem/libcc.ansi/pure/string/strrchr.c b/lang/cem/libcc.ansi/core/string/strrchr.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strrchr.c rename to lang/cem/libcc.ansi/core/string/strrchr.c diff --git a/lang/cem/libcc.ansi/pure/string/strspn.c b/lang/cem/libcc.ansi/core/string/strspn.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strspn.c rename to lang/cem/libcc.ansi/core/string/strspn.c diff --git a/lang/cem/libcc.ansi/pure/string/strstr.c b/lang/cem/libcc.ansi/core/string/strstr.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strstr.c rename to lang/cem/libcc.ansi/core/string/strstr.c diff --git a/lang/cem/libcc.ansi/pure/string/strtok.c b/lang/cem/libcc.ansi/core/string/strtok.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strtok.c rename to lang/cem/libcc.ansi/core/string/strtok.c diff --git a/lang/cem/libcc.ansi/pure/string/strxfrm.c b/lang/cem/libcc.ansi/core/string/strxfrm.c similarity index 100% rename from lang/cem/libcc.ansi/pure/string/strxfrm.c rename to lang/cem/libcc.ansi/core/string/strxfrm.c diff --git a/lang/cem/libcc.ansi/pure/README.md b/lang/cem/libcc.ansi/pure/README.md deleted file mode 100644 index 484205837..000000000 --- a/lang/cem/libcc.ansi/pure/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains _only_ pure-code libc functions with no dependencies -on anything other than other pure functions (for example: strcmp, div). There -should be no reason why any platform won't want these in its libc.