mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
(chibi win32 process-win32): New library
Implement Win32 specific process library. Currently the library only provides `exit` procedure.
This commit is contained in:
parent
da7b68f82e
commit
e46bd03239
5 changed files with 23 additions and 1 deletions
3
Makefile
3
Makefile
|
@ -29,6 +29,7 @@ CHIBI_COMPILED_LIBS = lib/chibi/filesystem$(SO) lib/chibi/weak$(SO) \
|
||||||
lib/chibi/emscripten$(SO)
|
lib/chibi/emscripten$(SO)
|
||||||
CHIBI_POSIX_COMPILED_LIBS = lib/chibi/process$(SO) lib/chibi/time$(SO) \
|
CHIBI_POSIX_COMPILED_LIBS = lib/chibi/process$(SO) lib/chibi/time$(SO) \
|
||||||
lib/chibi/system$(SO) lib/chibi/stty$(SO) lib/chibi/net$(SO)
|
lib/chibi/system$(SO) lib/chibi/stty$(SO) lib/chibi/net$(SO)
|
||||||
|
CHIBI_WIN32_COMPILED_LIBS = lib/chibi/win32/process-win32$(SO)
|
||||||
CHIBI_CRYPTO_COMPILED_LIBS = lib/chibi/crypto/crypto$(SO)
|
CHIBI_CRYPTO_COMPILED_LIBS = lib/chibi/crypto/crypto$(SO)
|
||||||
CHIBI_IO_COMPILED_LIBS = lib/chibi/io/io$(SO)
|
CHIBI_IO_COMPILED_LIBS = lib/chibi/io/io$(SO)
|
||||||
CHIBI_OPT_COMPILED_LIBS = lib/chibi/optimize/rest$(SO) \
|
CHIBI_OPT_COMPILED_LIBS = lib/chibi/optimize/rest$(SO) \
|
||||||
|
@ -37,6 +38,8 @@ EXTRA_COMPILED_LIBS ?=
|
||||||
|
|
||||||
ifndef EXCLUDE_POSIX_LIBS
|
ifndef EXCLUDE_POSIX_LIBS
|
||||||
CHIBI_COMPILED_LIBS += $(CHIBI_POSIX_COMPILED_LIBS)
|
CHIBI_COMPILED_LIBS += $(CHIBI_POSIX_COMPILED_LIBS)
|
||||||
|
else
|
||||||
|
CHIBI_COMPILED_LIBS += $(CHIBI_WIN32_COMPILED_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
COMPILED_LIBS = $(CHIBI_COMPILED_LIBS) $(CHIBI_IO_COMPILED_LIBS) \
|
COMPILED_LIBS = $(CHIBI_COMPILED_LIBS) $(CHIBI_IO_COMPILED_LIBS) \
|
||||||
|
|
7
lib/chibi/win32/process-win32.scm
Normal file
7
lib/chibi/win32/process-win32.scm
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
(define (exit . code?)
|
||||||
|
(%exit (if (pair? code?)
|
||||||
|
(let ((c (car code?)))
|
||||||
|
(cond ((integer? c) c)
|
||||||
|
((eq? #t c) 0)
|
||||||
|
(else 1)))
|
||||||
|
0)))
|
5
lib/chibi/win32/process-win32.sld
Normal file
5
lib/chibi/win32/process-win32.sld
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
(define-library (chibi win32 process-win32)
|
||||||
|
(import (scheme base))
|
||||||
|
(export %exit)
|
||||||
|
(include-shared "process-win32")
|
||||||
|
(include "process-win32.scm"))
|
5
lib/chibi/win32/process-win32.stub
Normal file
5
lib/chibi/win32/process-win32.stub
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
;;> An interface to Win32 MSVCRT provided process functions and Win32 APIs
|
||||||
|
|
||||||
|
(c-system-include "stdlib.h")
|
||||||
|
|
||||||
|
(define-c void (%exit exit) (int))
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
(define-library (scheme process-context)
|
(define-library (scheme process-context)
|
||||||
(import (chibi) (srfi 98) (only (chibi process) exit))
|
(import (chibi) (srfi 98))
|
||||||
|
(cond-expand (windows (import (only (chibi win32 process-win32) exit)))
|
||||||
|
(else (import (only (chibi process) exit))))
|
||||||
(export get-environment-variable get-environment-variables
|
(export get-environment-variable get-environment-variables
|
||||||
command-line exit emergency-exit)
|
command-line exit emergency-exit)
|
||||||
;; TODO: Make exit unwind and finalize properly.
|
;; TODO: Make exit unwind and finalize properly.
|
||||||
|
|
Loading…
Add table
Reference in a new issue