--- /dev/null
+MODULE LinLibW ["libc.so%%libver%%"];
+
+ (*
+ %%osname%%
+ %%machine%%
+ *)
+
+ IMPORT Libc := LinLibc;
+
+ CONST
+%%defs-lc%%
+ TYPE
+ (* int, wchar_t, wint_t, size_t, mbstate_t *)
+%%defs-basictypes%%
+ PtrWSTR* = POINTER [untagged] TO ARRAY [untagged] OF wchar_t;
+
+ PROCEDURE [ccall] setlocale* (category: int; locale: Libc.PtrSTR): Libc.PtrSTR;
+
+ PROCEDURE [ccall] mbsinit* (VAR [nil] ps: mbstate_t): int;
+
+ PROCEDURE [ccall] wctomb* (s: Libc.PtrSTR; wchar: wchar_t): int;
+ PROCEDURE [ccall] wcstombs* (s: Libc.PtrSTR; pwcs: PtrWSTR; n: size_t): size_t;
+
+ PROCEDURE [ccall] wcrtomb* (s: Libc.PtrSTR; wc: wchar_t; VAR [nil] ps: mbstate_t): size_t;
+ PROCEDURE [ccall] wcsrtombs* (dst: Libc.PtrSTR; VAR src: PtrWSTR; len: size_t; VAR [nil] ps: mbstate_t): size_t;
+ PROCEDURE [ccall] wcsnrtombs* (dst: Libc.PtrSTR; VAR src: PtrWSTR; nwc: size_t; len: size_t; VAR [nil] ps: mbstate_t): size_t;
+
+ PROCEDURE [ccall] mbtowc* (pwc: PtrWSTR; s: Libc.PtrSTR; n: size_t): int;
+ PROCEDURE [ccall] mbstowcs* (pwcs: PtrWSTR; s: Libc.PtrSTR; n: size_t): size_t;
+ PROCEDURE [ccall] mblen* (s: Libc.PtrSTR; n: size_t): int;
+
+ PROCEDURE [ccall] mbrtowc* (wc: PtrWSTR; s: Libc.PtrSTR; n: size_t; VAR [nil] mbs: mbstate_t): size_t;
+ PROCEDURE [ccall] mbsrtowcs* (dst: PtrWSTR; VAR src: Libc.PtrSTR; len: size_t; VAR [nil] ps: mbstate_t): size_t;
+ PROCEDURE [ccall] mbsnrtowcs* (dst: PtrWSTR; VAR src: Libc.PtrSTR; nmc: size_t; len: size_t; VAR [nil] ps: mbstate_t): size_t;
+ PROCEDURE [ccall] mbrlen* (s: Libc.PtrSTR; n: size_t; VAR [nil] ps: mbstate_t): size_t;
+
+ PROCEDURE [ccall] iswalpha* (wc: wint_t): int;
+ PROCEDURE [ccall] iswlower* (wc: wint_t): int;
+ PROCEDURE [ccall] iswupper* (wc: wint_t): int;
+ PROCEDURE [ccall] towlower* (wc: wint_t): wint_t;
+ PROCEDURE [ccall] towupper* (wc: wint_t): wint_t;
+
+ PROCEDURE [ccall] wprintf* (fmt: PtrWSTR): int;
+ PROCEDURE [ccall] fputws* (ws: PtrWSTR; fp: Libc.PtrFILE): int;
+ PROCEDURE [ccall] fgetws* (ws: PtrWSTR; n: int; fp: Libc.PtrFILE): PtrWSTR;
+
+END LinLibW.
\ No newline at end of file
--- /dev/null
+#include <sys/types.h>
+#include <wctype.h>
+#include <wchar.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define TABS "\t\t"
+
+#define FALSE (0)
+#define TRUE (1)
+
+static void D (const char *s, int sz, int set, int export)
+{
+ int res;
+
+ res = printf("%s%s", TABS, s);
+ if (export) {
+ res = printf("*");
+ }
+ res = printf(" = ");
+ if (sz == 1) {
+ res = printf("SHORTCHAR");
+ } else if (sz == 2) {
+ res = printf("SHORTINT");
+ } else if (sz == 4) {
+ if (set) {
+ res = printf("SET");
+ } else {
+ res = printf("INTEGER");
+ }
+ } else if (sz == 8) {
+ if (set) {
+ res = printf("ARRAY [untagged] 2 OF SET");
+ } else {
+ res = printf("LONGINT");
+ }
+ } else {
+ res = printf("ARRAY [untagged] ");
+ if (sz % 4 == 0) {
+ if (set) {
+ res = printf("%d OF SET", sz / 4);
+ } else {
+ res = printf("%d OF INTEGER", sz / 4);
+ }
+ } else {
+ res = printf("%d OF SHORTCHAR", sz);
+ }
+ }
+ res = printf(";\n");
+}
+
+int main ()
+{\
+ D("int", sizeof(int), FALSE, TRUE);
+ D("wchar_t", sizeof(wchar_t), FALSE, TRUE);
+ D("wint_t", sizeof(wint_t), FALSE, TRUE);
+ D("size_t", sizeof(size_t), FALSE, TRUE);
+ D("mbstate_t", sizeof(mbstate_t), FALSE, TRUE);
+
+ return 0;
+}
./run-dev0 <<DATA
ConsCompiler.Compile('Lin/Mod', 'Dl.txt')
ConsCompiler.Compile('Lin/Mod', 'Libc.txt')
+ConsCompiler.Compile('Lin/Mod', 'LibW.txt')
ConsCompiler.Compile('Lin/Mod', 'Iconv.txt')
# Linux only
./run-dev0 <<DATA
ConsCompiler.Compile('Lin/Mod', 'Dl.txt')
ConsCompiler.Compile('Lin/Mod', 'Libc.txt')
+ConsCompiler.Compile('Lin/Mod', 'LibW.txt')
ConsCompiler.Compile('Lin/Mod', 'Iconv.txt')
# Linux only
--- /dev/null
+# This is BSD Makefile
+# BSD GNU
+# ${.TARGET} $@
+# ${.ALLSRC} $^
+# ${.IMPSRC} $<
+
+INCDIR ?= /usr/include
+
+PY = python2.7
+
+DEFS = defs-basictypes defs-lc
+
+all: LibW.txt ${DEFS}
+
+LibW.txt: LibW.txt.templ ${DEFS} libver osname machine
+ ${PY} ./untempl.py LibW.txt.templ ${.TARGET}
+
+defs-basictypes: sizeofs
+ ./sizeofs > ${.TARGET}
+
+defs-lc:
+ ./dumpdefs.py 2 1 i ${INCDIR}/locale.h | grep " LC_" > ${.TARGET}
+
+clean:
+ rm -f ${DEFS} Net.txt sizeofs
--- /dev/null
+../gen-Libc/dumpdefs.py
\ No newline at end of file
--- /dev/null
+.89.2
\ No newline at end of file
--- /dev/null
+i386
\ No newline at end of file
--- /dev/null
+OpenBSD 6.0
\ No newline at end of file
--- /dev/null
+../gen-Libc/untempl.py
\ No newline at end of file