From cbc6480f7446e212a18372482627360fdb3cf8f1 Mon Sep 17 00:00:00 2001 From: Alexander Shiryaev Date: Wed, 16 Nov 2016 12:38:57 +0300 Subject: [PATCH] gen-LibW --- BlackBox/_FreeBSD_/Lin/Mod/gen-LibW/Makefile | 2 +- BlackBox/_Linux_/Lin/Mod/LibW.txt | 65 +++++++++++++++++++ BlackBox/_Linux_/Lin/Mod/gen-LibW/Makefile | 25 +++++++ BlackBox/_Linux_/Lin/Mod/gen-LibW/dumpdefs.py | 1 + BlackBox/_Linux_/Lin/Mod/gen-LibW/libver | 1 + BlackBox/_Linux_/Lin/Mod/gen-LibW/machine | 1 + BlackBox/_Linux_/Lin/Mod/gen-LibW/mklc.c | 28 ++++++++ BlackBox/_Linux_/Lin/Mod/gen-LibW/osname | 1 + BlackBox/_Linux_/Lin/Mod/gen-LibW/untempl.py | 1 + BlackBox/_OpenBSD_/Lin/Mod/gen-LibW/Makefile | 2 +- 10 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 BlackBox/_Linux_/Lin/Mod/LibW.txt create mode 100644 BlackBox/_Linux_/Lin/Mod/gen-LibW/Makefile create mode 120000 BlackBox/_Linux_/Lin/Mod/gen-LibW/dumpdefs.py create mode 100644 BlackBox/_Linux_/Lin/Mod/gen-LibW/libver create mode 100644 BlackBox/_Linux_/Lin/Mod/gen-LibW/machine create mode 100644 BlackBox/_Linux_/Lin/Mod/gen-LibW/mklc.c create mode 100644 BlackBox/_Linux_/Lin/Mod/gen-LibW/osname create mode 120000 BlackBox/_Linux_/Lin/Mod/gen-LibW/untempl.py diff --git a/BlackBox/_FreeBSD_/Lin/Mod/gen-LibW/Makefile b/BlackBox/_FreeBSD_/Lin/Mod/gen-LibW/Makefile index 28bde3a..40a0ef4 100644 --- a/BlackBox/_FreeBSD_/Lin/Mod/gen-LibW/Makefile +++ b/BlackBox/_FreeBSD_/Lin/Mod/gen-LibW/Makefile @@ -22,4 +22,4 @@ defs-lc: ./dumpdefs.py 2 1 i ${INCDIR}/locale.h | grep " LC_" > ${.TARGET} clean: - rm -f ${DEFS} Net.txt sizeofs + rm -f ${DEFS} LibW.txt sizeofs diff --git a/BlackBox/_Linux_/Lin/Mod/LibW.txt b/BlackBox/_Linux_/Lin/Mod/LibW.txt new file mode 100644 index 0000000..86cbd41 --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/LibW.txt @@ -0,0 +1,65 @@ +MODULE LinLibW ["libc.so.6"]; + + (* + GNU/Linux + i386 + *) + + IMPORT Libc := LinLibc; + + CONST + LC_CTYPE* = 0; + LC_NUMERIC* = 1; + LC_TIME* = 2; + LC_COLLATE* = 3; + LC_MONETARY* = 4; + LC_MESSAGES* = 5; + LC_ALL* = 6; + LC_PAPER* = 7; + LC_NAME* = 8; + LC_ADDRESS* = 9; + LC_TELEPHONE* = 10; + LC_MEASUREMENT* = 11; + LC_IDENTIFICATION* = 12; + + TYPE + (* int, wchar_t, wint_t, size_t, mbstate_t *) + int* = INTEGER; + wchar_t* = INTEGER; + wint_t* = INTEGER; + size_t* = INTEGER; + mbstate_t* = LONGINT; + + 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 diff --git a/BlackBox/_Linux_/Lin/Mod/gen-LibW/Makefile b/BlackBox/_Linux_/Lin/Mod/gen-LibW/Makefile new file mode 100644 index 0000000..5561368 --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/gen-LibW/Makefile @@ -0,0 +1,25 @@ +# 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 $@ + +defs-basictypes: sizeofs + ./sizeofs > $@ + +defs-lc: mklc + ./mklc > $@ + +clean: + rm -f ${DEFS} LibW.txt sizeofs mklc diff --git a/BlackBox/_Linux_/Lin/Mod/gen-LibW/dumpdefs.py b/BlackBox/_Linux_/Lin/Mod/gen-LibW/dumpdefs.py new file mode 120000 index 0000000..1730591 --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/gen-LibW/dumpdefs.py @@ -0,0 +1 @@ +../gen-Libc/dumpdefs.py \ No newline at end of file diff --git a/BlackBox/_Linux_/Lin/Mod/gen-LibW/libver b/BlackBox/_Linux_/Lin/Mod/gen-LibW/libver new file mode 100644 index 0000000..ed44321 --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/gen-LibW/libver @@ -0,0 +1 @@ +.6 \ No newline at end of file diff --git a/BlackBox/_Linux_/Lin/Mod/gen-LibW/machine b/BlackBox/_Linux_/Lin/Mod/gen-LibW/machine new file mode 100644 index 0000000..fd32fa4 --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/gen-LibW/machine @@ -0,0 +1 @@ +i386 \ No newline at end of file diff --git a/BlackBox/_Linux_/Lin/Mod/gen-LibW/mklc.c b/BlackBox/_Linux_/Lin/Mod/gen-LibW/mklc.c new file mode 100644 index 0000000..d467830 --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/gen-LibW/mklc.c @@ -0,0 +1,28 @@ +#include +#include + +#define PREFIX "\t\t" + +void D (const char *s, int ctl) +{ + printf("%s%s* = %d;\n", PREFIX, s, ctl); +} + +int main (int argc, char *argv[]) +{ + D("LC_CTYPE", LC_CTYPE); + D("LC_NUMERIC", LC_NUMERIC); + D("LC_TIME", LC_TIME); + D("LC_COLLATE", LC_COLLATE); + D("LC_MONETARY", LC_MONETARY); + D("LC_MESSAGES", LC_MESSAGES); + D("LC_ALL", LC_ALL); + D("LC_PAPER", LC_PAPER); + D("LC_NAME", LC_NAME); + D("LC_ADDRESS", LC_ADDRESS); + D("LC_TELEPHONE", LC_TELEPHONE); + D("LC_MEASUREMENT", LC_MEASUREMENT); + D("LC_IDENTIFICATION", LC_IDENTIFICATION); + + return 0; +} diff --git a/BlackBox/_Linux_/Lin/Mod/gen-LibW/osname b/BlackBox/_Linux_/Lin/Mod/gen-LibW/osname new file mode 100644 index 0000000..48fc79c --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/gen-LibW/osname @@ -0,0 +1 @@ +GNU/Linux \ No newline at end of file diff --git a/BlackBox/_Linux_/Lin/Mod/gen-LibW/untempl.py b/BlackBox/_Linux_/Lin/Mod/gen-LibW/untempl.py new file mode 120000 index 0000000..5800713 --- /dev/null +++ b/BlackBox/_Linux_/Lin/Mod/gen-LibW/untempl.py @@ -0,0 +1 @@ +../gen-Libc/untempl.py \ No newline at end of file diff --git a/BlackBox/_OpenBSD_/Lin/Mod/gen-LibW/Makefile b/BlackBox/_OpenBSD_/Lin/Mod/gen-LibW/Makefile index 28bde3a..40a0ef4 100644 --- a/BlackBox/_OpenBSD_/Lin/Mod/gen-LibW/Makefile +++ b/BlackBox/_OpenBSD_/Lin/Mod/gen-LibW/Makefile @@ -22,4 +22,4 @@ defs-lc: ./dumpdefs.py 2 1 i ${INCDIR}/locale.h | grep " LC_" > ${.TARGET} clean: - rm -f ${DEFS} Net.txt sizeofs + rm -f ${DEFS} LibW.txt sizeofs -- 2.29.2