├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── THANKS.asciidoc ├── c_src ├── scmi_env.cc ├── scmi_env.h ├── scmi_env_lib.cc ├── scmi_env_lib.h ├── scmi_iodev.cc ├── scmi_iodev.h ├── scmi_iodev_lib.cc └── scmi_iodev_lib.h ├── doc ├── README.md ├── edoc-info ├── overview.edoc ├── scm_app.md ├── scm_sup.md ├── scmd_parse.md ├── scmd_parse_numR.md ├── scmd_scan.md ├── scmd_scan_num10.md ├── scmd_scan_num16.md ├── scmd_scan_num2.md ├── scmd_scan_num8.md ├── scmd_types.md ├── scmd_types_impl.md ├── scmi_analyze.md ├── scmi_analyze_derived.md ├── scmi_analyze_macro.md ├── scmi_analyze_primitive.md ├── scmi_analyze_program.md ├── scmi_env.md ├── scmi_eval.md ├── scmi_iodev.md ├── scmi_iodev_server_file.md ├── scmi_iodev_server_ram.md ├── scmi_iodev_server_std.md ├── scmi_iodev_server_std_test.md ├── scmi_types.md ├── scml.md ├── scml_base_boolean.md ├── scml_base_bytevector.md ├── scml_base_char.md ├── scml_base_control.md ├── scml_base_equality.md ├── scml_base_exception.md ├── scml_base_io.md ├── scml_base_list.md ├── scml_base_number.md ├── scml_base_string.md ├── scml_base_symbol.md ├── scml_base_system.md ├── scml_base_vector.md ├── scml_char.md ├── scml_complex.md ├── scml_context.md ├── scml_cxr.md ├── scml_eval.md ├── scml_file.md ├── scml_inexact.md ├── scml_lambda.md ├── scml_lazy.md ├── scml_load.md ├── scml_r5rs.md ├── scml_read.md ├── scml_repl.md ├── scml_time.md ├── scml_write.md ├── scmtmp.md └── xfm_import_as_export.md ├── rebar ├── rebar.config ├── rebar.config.doc └── src ├── scm.app.src ├── scm.hrl ├── scm_app.erl ├── scm_sup.erl ├── scmd_parse.yrl ├── scmd_parse_numR.hrl ├── scmd_parse_numR.yrl ├── scmd_scan.xrl ├── scmd_scan_num10.xrl ├── scmd_scan_num16.xrl ├── scmd_scan_num2.xrl ├── scmd_scan_num8.xrl ├── scmd_types.erl ├── scmd_types.hrl ├── scmd_types_impl.erl ├── scmd_types_impl.hrl ├── scmi.hrl ├── scmi_analyze.erl ├── scmi_analyze.hrl ├── scmi_analyze_derived.erl ├── scmi_analyze_macro.erl ├── scmi_analyze_primitive.erl ├── scmi_analyze_program.erl ├── scmi_env.erl ├── scmi_eval.erl ├── scmi_iodev.erl ├── scmi_iodev_server_file.erl ├── scmi_iodev_server_ram.erl ├── scmi_iodev_server_std.erl ├── scmi_iodev_server_std_test.erl ├── scmi_types.erl ├── scmi_types.hrl ├── scml.erl ├── scml.hrl ├── scml_base_boolean.erl ├── scml_base_bytevector.erl ├── scml_base_char.erl ├── scml_base_control.erl ├── scml_base_equality.erl ├── scml_base_exception.erl ├── scml_base_io.erl ├── scml_base_list.erl ├── scml_base_number.erl ├── scml_base_string.erl ├── scml_base_symbol.erl ├── scml_base_system.erl ├── scml_base_vector.erl ├── scml_char.erl ├── scml_complex.erl ├── scml_context.erl ├── scml_cxr.erl ├── scml_eval.erl ├── scml_file.erl ├── scml_inexact.erl ├── scml_lambda.erl ├── scml_lazy.erl ├── scml_load.erl ├── scml_r5rs.erl ├── scml_read.erl ├── scml_repl.erl ├── scml_time.erl ├── scml_write.erl ├── scmtmp.erl └── xfm_import_as_export.erl /.gitignore: -------------------------------------------------------------------------------- 1 | .eqc-info 2 | .eunit/ 3 | .qc/ 4 | .rebar/ 5 | c_src/*.o 6 | deps/ 7 | ebin/ 8 | erl_crash.dump 9 | priv/lib/ 10 | src/scmd_parse.erl 11 | src/scmd_parse_numR.erl 12 | src/scmd_scan.erl 13 | src/scmd_scan_num10.erl 14 | src/scmd_scan_num16.erl 15 | src/scmd_scan_num2.erl 16 | src/scmd_scan_num8.erl 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: erlang 2 | script: "make clean compile xref test" 3 | otp_release: 4 | - 17.0 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | REBAR?=./rebar 3 | 4 | ARCHIVETAG?=$(shell git describe --always --long --tags) 5 | ARCHIVE?=$(shell basename $(CURDIR))-$(ARCHIVETAG) 6 | 7 | .PHONY: all archive clean deps compile xref doc test eunit eqc proper \ 8 | compile-for-eunit compile-for-eqc compile-for-proper 9 | 10 | all: compile 11 | 12 | archive: 13 | @rm -f $(ARCHIVE).tar.gz 14 | git archive --format=tar --prefix=$(ARCHIVE)/ $(ARCHIVETAG) | gzip >$(ARCHIVE).tar.gz 15 | 16 | deps: 17 | $(REBAR) get-deps 18 | 19 | clean: 20 | @rm -f $(ARCHIVE).tar.gz 21 | $(REBAR) clean -r 22 | 23 | compile: 24 | $(REBAR) compile 25 | 26 | xref: 27 | $(REBAR) xref skip_deps=true 28 | 29 | doc: 30 | @rm -rf README.md doc/edoc-info doc/*.md 31 | $(REBAR) -C rebar.config.doc get-deps compile 32 | $(REBAR) -C rebar.config.doc doc skip_deps=true 33 | 34 | test: eunit 35 | 36 | eunit: compile-for-eunit 37 | $(REBAR) eunit skip_deps=true 38 | 39 | eqc: compile-for-eqc 40 | $(REBAR) eqc skip_deps=true 41 | 42 | proper: compile-for-proper 43 | @echo "rebar does not implement a 'proper' command" && false 44 | 45 | compile-for-eunit: 46 | $(REBAR) compile eunit compile_only=true 47 | 48 | compile-for-eqc: 49 | $(REBAR) -D QC -D QC_EQC compile eqc compile_only=true 50 | 51 | compile-for-proper: 52 | $(REBAR) -D QC -D QC_PROPER compile eqc compile_only=true 53 | -------------------------------------------------------------------------------- /THANKS.asciidoc: -------------------------------------------------------------------------------- 1 | The following people, in chronological order, have sent patches, pull 2 | requests, and/or bug reports that have been incorporated in CSCM's 3 | code base: 4 | 5 | Joseph Wayne Norton 6 | Sina Samavati 7 | -------------------------------------------------------------------------------- /c_src/scmi_env.h: -------------------------------------------------------------------------------- 1 | // The MIT License 2 | // 3 | // Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #ifndef SCMI_ENV_NIF_H 24 | #define SCMI_ENV_NIF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #include 31 | 32 | // Prototypes 33 | ERL_NIF_TERM 34 | scmi_env_notify_when_destroyed3(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 35 | ERL_NIF_TERM 36 | scmi_env_is_resource1(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 37 | ERL_NIF_TERM 38 | scmi_env_the_empty0(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 39 | ERL_NIF_TERM 40 | scmi_env_extend3(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 41 | ERL_NIF_TERM 42 | scmi_env_make_immutable1(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 43 | ERL_NIF_TERM 44 | scmi_env_is_immutable1(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 45 | ERL_NIF_TERM 46 | scmi_env_safe_lookup_variable2(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 47 | ERL_NIF_TERM 48 | scmi_env_set_variable3(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 49 | ERL_NIF_TERM 50 | scmi_env_define_variable3(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* SCMI_ENV_NIF_H */ 57 | -------------------------------------------------------------------------------- /c_src/scmi_env_lib.cc: -------------------------------------------------------------------------------- 1 | // The MIT License 2 | // 3 | // Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #include "scmi_env_lib.h" 24 | 25 | ERL_NIF_TERM scmi_env_atom_ = 0; 26 | ERL_NIF_TERM scmi_env_atom_true = 0; 27 | ERL_NIF_TERM scmi_env_atom_false = 0; 28 | ERL_NIF_TERM scmi_env_atom_mid = 0; 29 | 30 | bool 31 | scmi_env_lib_init(ErlNifEnv* env) 32 | { 33 | scmi_env_atom_ = enif_make_atom(env, ""); 34 | scmi_env_atom_true = enif_make_atom(env, "true"); 35 | scmi_env_atom_false = enif_make_atom(env, "false"); 36 | scmi_env_atom_mid = enif_make_atom(env, "mid"); 37 | 38 | return true; 39 | } 40 | -------------------------------------------------------------------------------- /c_src/scmi_env_lib.h: -------------------------------------------------------------------------------- 1 | // The MIT License 2 | // 3 | // Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #ifndef SCMI_ENV_NIF_LIB_H 24 | #define SCMI_ENV_NIF_LIB_H 25 | 26 | #include "erl_nif.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | extern ERL_NIF_TERM scmi_env_atom_; 33 | extern ERL_NIF_TERM scmi_env_atom_true; 34 | extern ERL_NIF_TERM scmi_env_atom_false; 35 | extern ERL_NIF_TERM scmi_env_atom_mid; 36 | 37 | // prototypes 38 | extern bool scmi_env_lib_init(ErlNifEnv* env); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* SCMI_ENV_NIF_LIB_H */ 45 | -------------------------------------------------------------------------------- /c_src/scmi_iodev.h: -------------------------------------------------------------------------------- 1 | // The MIT License 2 | // 3 | // Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #ifndef SCMI_IODEV_NIF_H 24 | #define SCMI_IODEV_NIF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #include 31 | 32 | // Prototypes 33 | ERL_NIF_TERM 34 | scmi_iodev_notify_when_destroyed3(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 35 | ERL_NIF_TERM 36 | scmi_iodev_is_resource1(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 37 | ERL_NIF_TERM 38 | scmi_iodev_new0(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* SCMI_IODEV_NIF_H */ 45 | -------------------------------------------------------------------------------- /c_src/scmi_iodev_lib.cc: -------------------------------------------------------------------------------- 1 | // The MIT License 2 | // 3 | // Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #include "scmi_iodev_lib.h" 24 | 25 | ERL_NIF_TERM scmi_iodev_atom_true = 0; 26 | ERL_NIF_TERM scmi_iodev_atom_false = 0; 27 | 28 | bool 29 | scmi_iodev_lib_init(ErlNifEnv* env) 30 | { 31 | scmi_iodev_atom_true = enif_make_atom(env, "true"); 32 | scmi_iodev_atom_false = enif_make_atom(env, "false"); 33 | 34 | return true; 35 | } 36 | -------------------------------------------------------------------------------- /c_src/scmi_iodev_lib.h: -------------------------------------------------------------------------------- 1 | // The MIT License 2 | // 3 | // Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #ifndef SCMI_IODEV_NIF_LIB_H 24 | #define SCMI_IODEV_NIF_LIB_H 25 | 26 | #include "erl_nif.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | extern ERL_NIF_TERM scmi_iodev_atom_true; 33 | extern ERL_NIF_TERM scmi_iodev_atom_false; 34 | 35 | // prototypes 36 | extern bool scmi_iodev_lib_init(ErlNifEnv* env); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* SCMI_IODEV_NIF_LIB_H */ 43 | -------------------------------------------------------------------------------- /doc/edoc-info: -------------------------------------------------------------------------------- 1 | %% encoding: UTF-8 2 | {application,scm}. 3 | {packages,[]}. 4 | {modules,[scm_app,scm_sup,scmd_parse,scmd_parse_numR,scmd_scan, 5 | scmd_scan_num10,scmd_scan_num16,scmd_scan_num2,scmd_scan_num8, 6 | scmd_types,scmd_types_impl,scmi_analyze,scmi_analyze_derived, 7 | scmi_analyze_macro,scmi_analyze_primitive,scmi_analyze_program, 8 | scmi_env,scmi_eval,scmi_iodev,scmi_iodev_server_file, 9 | scmi_iodev_server_ram,scmi_iodev_server_std, 10 | scmi_iodev_server_std_test,scmi_types,scml,scml_base_boolean, 11 | scml_base_bytevector,scml_base_char,scml_base_control, 12 | scml_base_equality,scml_base_exception,scml_base_io,scml_base_list, 13 | scml_base_number,scml_base_string,scml_base_symbol,scml_base_system, 14 | scml_base_vector,scml_char,scml_complex,scml_context,scml_cxr, 15 | scml_eval,scml_file,scml_inexact,scml_lambda,scml_lazy,scml_load, 16 | scml_r5rs,scml_read,scml_repl,scml_time,scml_write,scmtmp, 17 | xfm_import_as_export]}. 18 | -------------------------------------------------------------------------------- /doc/overview.edoc: -------------------------------------------------------------------------------- 1 | %% -*- Doc -*- 2 | %% vim: set syntax=asciidoc: 3 | @author Joseph Wayne Norton 4 | @copyright 2013-2014 by Joseph Wayne Norton 5 | @title The Concurrent Schemer 6 | @doc 7 | 8 | "The Concurrent Schemer" (CSCM) is an implementation of the Scheme 9 | programming language built on top of the Erlang Virtual Machine. CSCM 10 | combines the sequential programming model of Scheme with the 11 | concurrent, distributed, and fault-tolerant programming model of 12 | Erlang. Simply put, the goals of CSCM are concurrent Scheme, 13 | distributed Scheme, and fault-tolerant Scheme. 14 | 15 | Scheme is a statically scoped and properly tail recursive dialect of 16 | the Lisp programming language invented by Guy Lewis Steele Jr. and 17 | Gerald Jay Sussman at MIT. Scheme was designed to have exceptionally 18 | clear and simple semantics and few different ways to form expressions. 19 | A wide variety of programming paradigms, including imperative, 20 | functional, and object-oriented styles, find convenient expression in 21 | Scheme. 22 | 23 | Erlang is a programming language used to build massively scalable, 24 | soft, real-time systems with requirements on high availability. 25 | Erlang\'s run-time system has built-in support for concurrency, 26 | distribution and fault tolerance. Erlang is designed at the Ericsson 27 | Computer Science Laboratory and is maintained as an open-source 28 | project and community. 29 | 30 | The default language is Scheme R7RS. The default virtual machine is 31 | Erlang/OTP 17.0 or higher. 32 | 33 | For further information, see 34 | https://github.com/the-concurrent-schemer. 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /doc/scm_app.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scm_app # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme application

. 10 | __Behaviours:__ [`application`](application.html). 11 | 12 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 13 | 14 | 15 | ## Function Index ## 16 | 17 | 18 |
priv_libdir/0
priv_scmdir/0
start/2
stop/1
19 | 20 | 21 | 22 | 23 | ## Function Details ## 24 | 25 | 26 | 27 | ### priv_libdir/0 ### 28 | 29 | `priv_libdir() -> any()` 30 | 31 | 32 | 33 | 34 | ### priv_scmdir/0 ### 35 | 36 | `priv_scmdir() -> any()` 37 | 38 | 39 | 40 | 41 | ### start/2 ### 42 | 43 | `start(StartType, StartArgs) -> any()` 44 | 45 | 46 | 47 | 48 | ### stop/1 ### 49 | 50 | `stop(State) -> any()` 51 | 52 | 53 | -------------------------------------------------------------------------------- /doc/scm_sup.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scm_sup # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme supervisor

. 10 | __Behaviours:__ [`supervisor`](supervisor.html). 11 | 12 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 13 | 14 | 15 | ## Function Index ## 16 | 17 | 18 |
init/1
start_link/0
19 | 20 | 21 | 22 | 23 | ## Function Details ## 24 | 25 | 26 | 27 | ### init/1 ### 28 | 29 | `init(X1) -> any()` 30 | 31 | 32 | 33 | 34 | ### start_link/0 ### 35 | 36 | `start_link() -> any()` 37 | 38 | 39 | -------------------------------------------------------------------------------- /doc/scmd_parse_numR.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmd_parse_numR # 4 | * [Data Types](#types) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 | 10 | 11 | 12 | ## Data Types ## 13 | 14 | 15 | 16 | 17 | ### yecc_ret() ### 18 | 19 | 20 | 21 |

22 | yecc_ret() = {error, term()} | {ok, term()}
23 | 
24 | 25 | 26 | 27 | 28 | ## Function Index ## 29 | 30 | 31 |
format_error/1
parse/1
parse_and_scan/1
to_number/3
32 | 33 | 34 | 35 | 36 | ## Function Details ## 37 | 38 | 39 | 40 | ### format_error/1 ### 41 | 42 | 43 |

44 | format_error(Message::any()) -> [char() | list()]
45 | 
46 | 47 |

48 | 49 | 50 | 51 | 52 | 53 | ### parse/1 ### 54 | 55 | 56 |

57 | parse(Tokens::list()) -> yecc_ret()
58 | 
59 | 60 |

61 | 62 | 63 | 64 | 65 | 66 | ### parse_and_scan/1 ### 67 | 68 | 69 |

70 | parse_and_scan(X1::{function() | {atom(), atom()}, [term()]} | {atom(), atom(), [term()]}) -> yecc_ret()
71 | 
72 | 73 |

74 | 75 | 76 | 77 | 78 | 79 | ### to_number/3 ### 80 | 81 | 82 |

83 | to_number(N::scmd_types_impl:lineno(), X::string(), Env::scmi_denv()) -> {ok, scmd_types_impl:e_number()} | {error, scmd_types_impl:lineno(), Msg::iolist()}
84 | 
85 | 86 |

87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /doc/scmd_scan.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmd_scan # 4 | * [Function Index](#index) 5 | * [Function Details](#functions) 6 | 7 | 8 | 9 | 10 | ## Function Index ## 11 | 12 | 13 |
format_error/1
string/1
string/2
token/2
token/3
tokens/2
tokens/3
14 | 15 | 16 | 17 | 18 | ## Function Details ## 19 | 20 | 21 | 22 | ### format_error/1 ### 23 | 24 | `format_error(X1) -> any()` 25 | 26 | 27 | 28 | 29 | ### string/1 ### 30 | 31 | `string(String) -> any()` 32 | 33 | 34 | 35 | 36 | ### string/2 ### 37 | 38 | `string(String, Line) -> any()` 39 | 40 | 41 | 42 | 43 | ### token/2 ### 44 | 45 | `token(Cont, Chars) -> any()` 46 | 47 | 48 | 49 | 50 | ### token/3 ### 51 | 52 | `token(X1, Chars, Line) -> any()` 53 | 54 | 55 | 56 | 57 | ### tokens/2 ### 58 | 59 | `tokens(Cont, Chars) -> any()` 60 | 61 | 62 | 63 | 64 | ### tokens/3 ### 65 | 66 | `tokens(X1, Chars, Line) -> any()` 67 | 68 | 69 | -------------------------------------------------------------------------------- /doc/scmd_scan_num10.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmd_scan_num10 # 4 | * [Function Index](#index) 5 | * [Function Details](#functions) 6 | 7 | 8 | 9 | 10 | ## Function Index ## 11 | 12 | 13 |
format_error/1
string/1
string/2
token/2
token/3
tokens/2
tokens/3
14 | 15 | 16 | 17 | 18 | ## Function Details ## 19 | 20 | 21 | 22 | ### format_error/1 ### 23 | 24 | `format_error(X1) -> any()` 25 | 26 | 27 | 28 | 29 | ### string/1 ### 30 | 31 | `string(String) -> any()` 32 | 33 | 34 | 35 | 36 | ### string/2 ### 37 | 38 | `string(String, Line) -> any()` 39 | 40 | 41 | 42 | 43 | ### token/2 ### 44 | 45 | `token(Cont, Chars) -> any()` 46 | 47 | 48 | 49 | 50 | ### token/3 ### 51 | 52 | `token(X1, Chars, Line) -> any()` 53 | 54 | 55 | 56 | 57 | ### tokens/2 ### 58 | 59 | `tokens(Cont, Chars) -> any()` 60 | 61 | 62 | 63 | 64 | ### tokens/3 ### 65 | 66 | `tokens(X1, Chars, Line) -> any()` 67 | 68 | 69 | -------------------------------------------------------------------------------- /doc/scmd_scan_num16.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmd_scan_num16 # 4 | * [Function Index](#index) 5 | * [Function Details](#functions) 6 | 7 | 8 | 9 | 10 | ## Function Index ## 11 | 12 | 13 |
format_error/1
string/1
string/2
token/2
token/3
tokens/2
tokens/3
14 | 15 | 16 | 17 | 18 | ## Function Details ## 19 | 20 | 21 | 22 | ### format_error/1 ### 23 | 24 | `format_error(X1) -> any()` 25 | 26 | 27 | 28 | 29 | ### string/1 ### 30 | 31 | `string(String) -> any()` 32 | 33 | 34 | 35 | 36 | ### string/2 ### 37 | 38 | `string(String, Line) -> any()` 39 | 40 | 41 | 42 | 43 | ### token/2 ### 44 | 45 | `token(Cont, Chars) -> any()` 46 | 47 | 48 | 49 | 50 | ### token/3 ### 51 | 52 | `token(X1, Chars, Line) -> any()` 53 | 54 | 55 | 56 | 57 | ### tokens/2 ### 58 | 59 | `tokens(Cont, Chars) -> any()` 60 | 61 | 62 | 63 | 64 | ### tokens/3 ### 65 | 66 | `tokens(X1, Chars, Line) -> any()` 67 | 68 | 69 | -------------------------------------------------------------------------------- /doc/scmd_scan_num2.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmd_scan_num2 # 4 | * [Function Index](#index) 5 | * [Function Details](#functions) 6 | 7 | 8 | 9 | 10 | ## Function Index ## 11 | 12 | 13 |
format_error/1
string/1
string/2
token/2
token/3
tokens/2
tokens/3
14 | 15 | 16 | 17 | 18 | ## Function Details ## 19 | 20 | 21 | 22 | ### format_error/1 ### 23 | 24 | `format_error(X1) -> any()` 25 | 26 | 27 | 28 | 29 | ### string/1 ### 30 | 31 | `string(String) -> any()` 32 | 33 | 34 | 35 | 36 | ### string/2 ### 37 | 38 | `string(String, Line) -> any()` 39 | 40 | 41 | 42 | 43 | ### token/2 ### 44 | 45 | `token(Cont, Chars) -> any()` 46 | 47 | 48 | 49 | 50 | ### token/3 ### 51 | 52 | `token(X1, Chars, Line) -> any()` 53 | 54 | 55 | 56 | 57 | ### tokens/2 ### 58 | 59 | `tokens(Cont, Chars) -> any()` 60 | 61 | 62 | 63 | 64 | ### tokens/3 ### 65 | 66 | `tokens(X1, Chars, Line) -> any()` 67 | 68 | 69 | -------------------------------------------------------------------------------- /doc/scmd_scan_num8.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmd_scan_num8 # 4 | * [Function Index](#index) 5 | * [Function Details](#functions) 6 | 7 | 8 | 9 | 10 | ## Function Index ## 11 | 12 | 13 |
format_error/1
string/1
string/2
token/2
token/3
tokens/2
tokens/3
14 | 15 | 16 | 17 | 18 | ## Function Details ## 19 | 20 | 21 | 22 | ### format_error/1 ### 23 | 24 | `format_error(X1) -> any()` 25 | 26 | 27 | 28 | 29 | ### string/1 ### 30 | 31 | `string(String) -> any()` 32 | 33 | 34 | 35 | 36 | ### string/2 ### 37 | 38 | `string(String, Line) -> any()` 39 | 40 | 41 | 42 | 43 | ### token/2 ### 44 | 45 | `token(Cont, Chars) -> any()` 46 | 47 | 48 | 49 | 50 | ### token/3 ### 51 | 52 | `token(X1, Chars, Line) -> any()` 53 | 54 | 55 | 56 | 57 | ### tokens/2 ### 58 | 59 | `tokens(Cont, Chars) -> any()` 60 | 61 | 62 | 63 | 64 | ### tokens/3 ### 65 | 66 | `tokens(X1, Chars, Line) -> any()` 67 | 68 | 69 | -------------------------------------------------------------------------------- /doc/scmi_analyze.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmi_analyze # 4 | * [Description](#description) 5 | * [Data Types](#types) 6 | * [Function Index](#index) 7 | * [Function Details](#functions) 8 | 9 | 10 |

Scheme interpreter syntactic analyzer

. 11 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 12 | 13 | 14 | 15 | ## Data Types ## 16 | 17 | 18 | 19 | 20 | ### senv() ### 21 | 22 | 23 | 24 |

 25 | senv() = #senv{}
 26 | 
27 | 28 | 29 | 30 | 31 | ## Function Index ## 32 | 33 | 34 |
analyze/1
analyze/2
are_valid_variables/1
classify/1
flatten_variables/1
is_reserved_symbol/1
is_valid_variable/1
make_tmp_variables/1
splitnv_arguments/2
the_default/0
validate_variable/1
validate_variables/1
35 | 36 | 37 | 38 | 39 | ## Function Details ## 40 | 41 | 42 | 43 | ### analyze/1 ### 44 | 45 | 46 |

 47 | analyze(Exp::scmi_exp()) -> scmi_expander() | scmi_dexec()
 48 | 
49 | 50 |

51 | 52 | 53 | 54 | 55 | 56 | ### analyze/2 ### 57 | 58 | 59 |

 60 | analyze(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_expander() | scmi_dexec()
 61 | 
62 | 63 |

64 | 65 | 66 | 67 | 68 | 69 | ### are_valid_variables/1 ### 70 | 71 | 72 |

 73 | are_valid_variables(Variable::[scmi_var()]) -> boolean()
 74 | 
75 | 76 |

77 | 78 | 79 | 80 | 81 | 82 | ### classify/1 ### 83 | 84 | 85 |

 86 | classify(Exp::scmi_exp()) -> atom() | {rectangular | polar, {atom(), atom()}}
 87 | 
88 | 89 |

90 | 91 | 92 | 93 | 94 | 95 | ### flatten_variables/1 ### 96 | 97 | 98 |

 99 | flatten_variables(L::scmi_var() | [scmi_var()]) -> [scmi_var()]
100 | 
101 | 102 |

103 | 104 | 105 | 106 | 107 | 108 | ### is_reserved_symbol/1 ### 109 | 110 | 111 |

112 | is_reserved_symbol(X1::scmi_var()) -> boolean()
113 | 
114 | 115 |

116 | 117 | 118 | 119 | 120 | 121 | ### is_valid_variable/1 ### 122 | 123 | 124 |

125 | is_valid_variable(Variable::scmi_var()) -> boolean()
126 | 
127 | 128 |

129 | 130 | 131 | 132 | 133 | 134 | ### make_tmp_variables/1 ### 135 | 136 | 137 |

138 | make_tmp_variables(Formal::scmi_var() | [scmi_var()]) -> scmi_var() | [scmi_var()]
139 | 
140 | 141 |

142 | 143 | 144 | 145 | 146 | 147 | ### splitnv_arguments/2 ### 148 | 149 | 150 |

151 | splitnv_arguments(N::pos_integer(), L::[scmi_exp(), ...]) -> [scmi_exp(), ...]
152 | 
153 | 154 |

155 | 156 | 157 | 158 | 159 | 160 | ### the_default/0 ### 161 | 162 | 163 |

164 | the_default() -> scmi_senv()
165 | 
166 | 167 |

168 | 169 | 170 | 171 | 172 | 173 | ### validate_variable/1 ### 174 | 175 | 176 |

177 | validate_variable(Variable::scmi_var()) -> true
178 | 
179 | 180 |

181 | 182 | 183 | 184 | 185 | 186 | ### validate_variables/1 ### 187 | 188 | 189 |

190 | validate_variables(Variables::[scmi_var()]) -> true
191 | 
192 | 193 |

194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /doc/scmi_analyze_macro.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmi_analyze_macro # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme interpreter syntactic analyzer for syntax expressions

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scmi_exports'/0
analyze_assignment_syntax/2
analyze_lambda_syntax/2
analyze_let_syntax/2
analyze_letrec_syntax/2
analyze_letrecs_syntax/2
analyze_lets_syntax/2
analyze_sequence_syntax/2
analyze_syntax_error/2
analyze_syntax_rules/2
scan_out_internal_definitions/2
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scmi_exports'/0 ### 26 | 27 | 28 |

 29 | '$scmi_exports'() -> [{scm_symbol(), scmi_expander()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### analyze_assignment_syntax/2 ### 39 | 40 | 41 |

 42 | analyze_assignment_syntax(Exp0::scmi_exp(), Senv::scmi_senv()) -> scmi_dexec()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### analyze_lambda_syntax/2 ### 52 | 53 | 54 |

 55 | analyze_lambda_syntax(Body::scmi_exp(), Senv::scmi_senv()) -> scmi_expander()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### analyze_let_syntax/2 ### 65 | 66 | 67 |

 68 | analyze_let_syntax(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### analyze_letrec_syntax/2 ### 78 | 79 | 80 |

 81 | analyze_letrec_syntax(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### analyze_letrecs_syntax/2 ### 91 | 92 | 93 |

 94 | analyze_letrecs_syntax(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### analyze_lets_syntax/2 ### 104 | 105 | 106 |

107 | analyze_lets_syntax(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | 115 | 116 | ### analyze_sequence_syntax/2 ### 117 | 118 | 119 |

120 | analyze_sequence_syntax(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
121 | 
122 | 123 |

124 | 125 | 126 | 127 | 128 | 129 | ### analyze_syntax_error/2 ### 130 | 131 | 132 |

133 | analyze_syntax_error(Exp::scmi_exp(), SEnv::scmi_senv()) -> no_return()
134 | 
135 | 136 |

137 | 138 | 139 | 140 | 141 | 142 | ### analyze_syntax_rules/2 ### 143 | 144 | 145 |

146 | analyze_syntax_rules(Rules::scmi_exp(), Senv::scmi_senv()) -> scmi_expander()
147 | 
148 | 149 |

150 | 151 | 152 | 153 | 154 | 155 | ### scan_out_internal_definitions/2 ### 156 | 157 | 158 |

159 | scan_out_internal_definitions(Body::[scmi_exp(), ...], Senv::scmi_senv()) -> [scmi_exp()]
160 | 
161 | 162 |

163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /doc/scmi_analyze_program.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmi_analyze_program # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme interpreter syntactic analyzer for program expressions

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scmi_exports'/0
analyze_define/2
analyze_define_library/2
analyze_define_record_type/2
analyze_define_syntax/2
analyze_define_values/2
analyze_import/2
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scmi_exports'/0 ### 26 | 27 | 28 |

 29 | '$scmi_exports'() -> [{scm_symbol(), scmi_expander()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### analyze_define/2 ### 39 | 40 | 41 |

 42 | analyze_define(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### analyze_define_library/2 ### 52 | 53 | 54 |

 55 | analyze_define_library(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### analyze_define_record_type/2 ### 65 | 66 | 67 |

 68 | analyze_define_record_type(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### analyze_define_syntax/2 ### 78 | 79 | 80 |

 81 | analyze_define_syntax(Exp0::scmi_exp(), Senv::scmi_senv()) -> scmi_dexec()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### analyze_define_values/2 ### 91 | 92 | 93 |

 94 | analyze_define_values(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### analyze_import/2 ### 104 | 105 | 106 |

107 | analyze_import(Exp::scmi_exp(), SEnv::scmi_senv()) -> scmi_dexec()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/scmi_env.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmi_env # 4 | * [Description](#description) 5 | * [Data Types](#types) 6 | * [Function Index](#index) 7 | * [Function Details](#functions) 8 | 9 | 10 |

Scheme interpreter environment resource

. 11 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 12 | 13 | 14 | 15 | ## Data Types ## 16 | 17 | 18 | 19 | 20 | ### env() ### 21 | 22 | 23 | __abstract datatype__: `env()` 24 | 25 | 26 | 27 | 28 | ### val() ### 29 | 30 | 31 | 32 |

 33 | val() = scm_obj()
 34 | 
35 | 36 | 37 | 38 | 39 | 40 | ### var() ### 41 | 42 | 43 | 44 |

 45 | var() = scm_symbol()
 46 | 
47 | 48 | 49 | 50 | 51 | ## Function Index ## 52 | 53 | 54 |
define_variable/3
extend/3
is_immutable/1
is_resource/1
lookup_variable/2
make_immutable/1
notify_when_destroyed/2
notify_when_destroyed/3
safe_lookup_variable/2
set_variable/3
the_empty/0
55 | 56 | 57 | 58 | 59 | ## Function Details ## 60 | 61 | 62 | 63 | ### define_variable/3 ### 64 | 65 | 66 |

 67 | define_variable(Var::var(), Val::val(), X3::env()) -> true
 68 | 
69 | 70 |

71 | 72 | 73 | 74 | 75 | 76 | ### extend/3 ### 77 | 78 | 79 |

 80 | extend(Vars::[var()], Vals::[val()], X3::env()) -> val()
 81 | 
82 | 83 |

84 | 85 | 86 | 87 | 88 | 89 | ### is_immutable/1 ### 90 | 91 | 92 |

 93 | is_immutable(X1::env()) -> boolean()
 94 | 
95 | 96 |

97 | 98 | 99 | 100 | 101 | 102 | ### is_resource/1 ### 103 | 104 | 105 |

106 | is_resource(Term::term()) -> boolean()
107 | 
108 | 109 |

110 | 111 | 112 | 113 | 114 | 115 | ### lookup_variable/2 ### 116 | 117 | 118 |

119 | lookup_variable(Var::var(), Env::env()) -> val()
120 | 
121 | 122 |

123 | 124 | 125 | 126 | 127 | 128 | ### make_immutable/1 ### 129 | 130 | 131 |

132 | make_immutable(X1::env()) -> true
133 | 
134 | 135 |

136 | 137 | 138 | 139 | 140 | 141 | ### notify_when_destroyed/2 ### 142 | 143 | 144 |

145 | notify_when_destroyed(Msg::term(), Env::env()) -> true
146 | 
147 | 148 |

149 | 150 | 151 | 152 | 153 | 154 | ### notify_when_destroyed/3 ### 155 | 156 | 157 |

158 | notify_when_destroyed(Pid::pid(), Msg::term(), X3::env()) -> true
159 | 
160 | 161 |

162 | 163 | 164 | 165 | 166 | 167 | ### safe_lookup_variable/2 ### 168 | 169 | 170 |

171 | safe_lookup_variable(Var::var(), X2::env()) -> val()
172 | 
173 | 174 |

175 | 176 | 177 | 178 | 179 | 180 | ### set_variable/3 ### 181 | 182 | 183 |

184 | set_variable(Var::var(), Val::val(), X3::env()) -> true
185 | 
186 | 187 |

188 | 189 | 190 | 191 | 192 | 193 | ### the_empty/0 ### 194 | 195 | 196 |

197 | the_empty() -> env()
198 | 
199 | 200 |

201 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /doc/scmi_eval.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmi_eval # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme interpreter expression evaluator

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
default_ng/1
default_ok/2
eval/1
eval/2
eval/3
eval/4
exec/1
exec/2
exec/3
exec/4
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### default_ng/1 ### 26 | 27 | 28 |

 29 | default_ng(Error::scmi_exp()) -> no_return()
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### default_ok/2 ### 39 | 40 | 41 |

 42 | default_ok(Value::scmi_exp(), Ng::scmi_dng()) -> scmi_exp()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### eval/1 ### 52 | 53 | 54 |

 55 | eval(Exp::scmi_exp()) -> scmi_exp()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### eval/2 ### 65 | 66 | 67 |

 68 | eval(Exp::scmi_exp(), Env::scmi_denv()) -> scmi_exp()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### eval/3 ### 78 | 79 | 80 |

 81 | eval(Exp::scmi_exp(), Env::scmi_denv(), Ok::scmi_dok()) -> scmi_exp()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### eval/4 ### 91 | 92 | 93 |

 94 | eval(Exp::scmi_exp(), Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scmi_exp()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### exec/1 ### 104 | 105 | 106 |

107 | exec(Exec::scmi_dexec()) -> scmi_exp()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | 115 | 116 | ### exec/2 ### 117 | 118 | 119 |

120 | exec(Exec::scmi_dexec(), Env::scmi_denv()) -> scmi_exp()
121 | 
122 | 123 |

124 | 125 | 126 | 127 | 128 | 129 | ### exec/3 ### 130 | 131 | 132 |

133 | exec(Exec::scmi_dexec(), Env::scmi_denv(), Ok::scmi_dok()) -> scmi_exp()
134 | 
135 | 136 |

137 | 138 | 139 | 140 | 141 | 142 | ### exec/4 ### 143 | 144 | 145 |

146 | exec(Exec::scmi_dexec(), Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scmi_exp()
147 | 
148 | 149 |

150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /doc/scmi_iodev_server_std_test.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmi_iodev_server_std_test # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme interpreter i/o device stdio and stderr test server

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
test_server/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### test_server/1 ### 26 | 27 | `test_server(Parent) -> any()` 28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/scml_base_boolean.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_base_boolean # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme base library for booleans

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'boolean=?'/1

Returns #t if all the arguments are booleans and all are #t or 17 | all are #f.

.
'boolean?'/1

Returns #t if obj is either #t or #f, and returns #f 18 | otherwise.

.
'not'/1

Returns #t if obj is false, and returns #f otherwise.

.
19 | 20 | 21 | 22 | 23 | ## Function Details ## 24 | 25 | 26 | 27 | ### '$scml_exports'/0 ### 28 | 29 | 30 |

31 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
32 | 
33 | 34 |

35 | 36 | 37 | 38 | 39 | 40 | ### 'boolean=?'/1 ### 41 | 42 | 43 |

44 | 'boolean=?'(Bs::[scm_boolean(), ...]) -> scm_boolean()
45 | 
46 | 47 |

48 | 49 | 50 |

Returns #t if all the arguments are booleans and all are #t or 51 | all are #f.

52 | 53 | 54 | 55 | ### 'boolean?'/1 ### 56 | 57 | 58 |

59 | 'boolean?'(X1::scm_obj()) -> scm_boolean()
60 | 
61 | 62 |

63 | 64 | 65 |

Returns #t if obj is either #t or #f, and returns #f 66 | otherwise.

67 | 68 | 69 | 70 | ### 'not'/1 ### 71 | 72 | 73 |

74 | 'not'(X1::scm_obj()) -> scm_boolean()
75 | 
76 | 77 |

78 | 79 | 80 |

Returns #t if obj is false, and returns #f otherwise.

81 | 82 | -------------------------------------------------------------------------------- /doc/scml_base_char.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_base_char # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme base library for characters

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'char->integer'/1

Returns an exact integer equal to the Unicode scalar value of 17 | the given character.

.
'char<=?'/1

Returns #t if all the characters are monotonically 18 | non-decreasing, otherwise returns #f.

.
'char

Returns #t if all the characters are monotonically increasing, 19 | otherwise returns #f.

.
'char=?'/1

Returns #t if all the characters are equal, otherwise returns 20 | #f.

.
'char>=?'/1

Returns #t if all the characters are monotonically 21 | non-increasing, otherwise returns #f.

.
'char>?'/1

Returns #t if all the characters are monotonically decreasing, 22 | otherwise returns #f.

.
'char?'/1

Returns #t if obj is a character, otherwise returns #f.

.
'integer->char'/1

Returns a character equal to the Unicode scalar value of the 23 | given exact integer.

.
24 | 25 | 26 | 27 | 28 | ## Function Details ## 29 | 30 | 31 | 32 | ### '$scml_exports'/0 ### 33 | 34 | 35 |

 36 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 37 | 
38 | 39 |

40 | 41 | 42 | 43 | 44 | 45 | ### 'char->integer'/1 ### 46 | 47 | 48 |

 49 | 'char->integer'(Character::scm_char()) -> scm_n()
 50 | 
51 | 52 |

53 | 54 | 55 |

Returns an exact integer equal to the Unicode scalar value of 56 | the given character.

57 | 58 | 59 | 60 | ### 'char<=?'/1 ### 61 | 62 | 63 |

 64 | 'char<=?'(Cs::[scm_char(), ...]) -> scm_boolean()
 65 | 
66 | 67 |

68 | 69 | 70 |

Returns #t if all the characters are monotonically 71 | non-decreasing, otherwise returns #f.

72 | 73 | 74 | 75 | ### 'char 79 | 'char<?'(Cs::[scm_char(), ...]) -> scm_boolean() 80 | 81 | 82 |

83 | 84 | 85 |

Returns #t if all the characters are monotonically increasing, 86 | otherwise returns #f.

87 | 88 | 89 | 90 | ### 'char=?'/1 ### 91 | 92 | 93 |

 94 | 'char=?'(Cs::[scm_char(), ...]) -> scm_boolean()
 95 | 
96 | 97 |

98 | 99 | 100 |

Returns #t if all the characters are equal, otherwise returns 101 | #f.

102 | 103 | 104 | 105 | ### 'char>=?'/1 ### 106 | 107 | 108 |

109 | 'char>=?'(Cs::[scm_char(), ...]) -> scm_boolean()
110 | 
111 | 112 |

113 | 114 | 115 |

Returns #t if all the characters are monotonically 116 | non-increasing, otherwise returns #f.

117 | 118 | 119 | 120 | ### 'char>?'/1 ### 121 | 122 | 123 |

124 | 'char>?'(Cs::[scm_char(), ...]) -> scm_boolean()
125 | 
126 | 127 |

128 | 129 | 130 |

Returns #t if all the characters are monotonically decreasing, 131 | otherwise returns #f.

132 | 133 | 134 | 135 | ### 'char?'/1 ### 136 | 137 | 138 |

139 | 'char?'(Character::scm_obj()) -> scm_boolean()
140 | 
141 | 142 |

143 | 144 | 145 |

Returns #t if obj is a character, otherwise returns #f.

146 | 147 | 148 | 149 | ### 'integer->char'/1 ### 150 | 151 | 152 |

153 | 'integer->char'(N::scm_n()) -> scm_char()
154 | 
155 | 156 |

157 | 158 | 159 |

Returns a character equal to the Unicode scalar value of the 160 | given exact integer.

161 | 162 | -------------------------------------------------------------------------------- /doc/scml_base_equality.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_base_equality # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme base library for equivalence predicates

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'eq?'/2Equivalent to 'eqv?' / 2.
'equal?'/2

Returns #t if obj1 and obj2 have the same display 17 | representation. Otherwise, #f.

.
'eqv?'/2

Returns #t if obj1 and obj2 are normally regarded as the same 18 | object. Otherwise, #f.

.
19 | 20 | 21 | 22 | 23 | ## Function Details ## 24 | 25 | 26 | 27 | ### '$scml_exports'/0 ### 28 | 29 | 30 |

31 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
32 | 
33 | 34 |

35 | 36 | 37 | 38 | 39 | 40 | ### 'eq?'/2 ### 41 | 42 | 43 |

44 | 'eq?'(O1::scm_obj(), O2::scm_obj()) -> scm_boolean()
45 | 
46 | 47 |

48 | 49 | 50 | Equivalent to `'eqv?' / 2`. 51 | 52 | 53 | ### 'equal?'/2 ### 54 | 55 | 56 |

57 | 'equal?'(Boolean::scm_obj(), O2::scm_obj()) -> scm_boolean()
58 | 
59 | 60 |

61 | 62 | 63 |

Returns #t if obj1 and obj2 have the same display 64 | representation. Otherwise, #f.

65 | 66 | 67 | 68 | ### 'eqv?'/2 ### 69 | 70 | 71 |

72 | 'eqv?'(Boolean::scm_obj(), O2::scm_obj()) -> scm_boolean()
73 | 
74 | 75 |

76 | 77 | 78 |

Returns #t if obj1 and obj2 are normally regarded as the same 79 | object. Otherwise, #f.

80 | 81 | -------------------------------------------------------------------------------- /doc/scml_base_symbol.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_base_symbol # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme base library for symbols

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'string->symbol'/1

Returns the symbol whose name is string. This procedure can 17 | create symbols with names containing special characters that would 18 | require escaping with written, but does not interpret escapes in 19 | its input.

.
'symbol->string'/1

Returns the name of symbol as a string, but without adding 20 | escapes.

.
'symbol=?'/1

Returns #t if all the arguments are symbols and all have the 21 | same names in the sense of string=?.

.
'symbol?'/1

Returns #t if obj is a symbol, otherwise returns #f.

.
symbol_to_unicode/1
unicode_to_symbol/1
22 | 23 | 24 | 25 | 26 | ## Function Details ## 27 | 28 | 29 | 30 | ### '$scml_exports'/0 ### 31 | 32 | 33 |

 34 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 35 | 
36 | 37 |

38 | 39 | 40 | 41 | 42 | 43 | ### 'string->symbol'/1 ### 44 | 45 | 46 |

 47 | 'string->symbol'(String::scm_string()) -> scm_symbol()
 48 | 
49 | 50 |

51 | 52 | 53 |

Returns the symbol whose name is string. This procedure can 54 | create symbols with names containing special characters that would 55 | require escaping with written, but does not interpret escapes in 56 | its input.

57 | 58 | 59 | 60 | ### 'symbol->string'/1 ### 61 | 62 | 63 |

 64 | 'symbol->string'(S::scm_symbol()) -> scm_string()
 65 | 
66 | 67 |

68 | 69 | 70 |

Returns the name of symbol as a string, but without adding 71 | escapes.

72 | 73 | 74 | 75 | ### 'symbol=?'/1 ### 76 | 77 | 78 |

 79 | 'symbol=?'(Ss::[scm_symbol(), ...]) -> scm_boolean()
 80 | 
81 | 82 |

83 | 84 | 85 |

Returns #t if all the arguments are symbols and all have the 86 | same names in the sense of string=?.

87 | 88 | 89 | 90 | ### 'symbol?'/1 ### 91 | 92 | 93 |

 94 | 'symbol?'(Obj::scm_obj()) -> scm_boolean()
 95 | 
96 | 97 |

98 | 99 | 100 |

Returns #t if obj is a symbol, otherwise returns #f.

101 | 102 | 103 | 104 | ### symbol_to_unicode/1 ### 105 | 106 | 107 |

108 | symbol_to_unicode(S::scm_symbol()) -> [scmd_types_impl:unichar()]
109 | 
110 | 111 |

112 | 113 | 114 | 115 | 116 | 117 | ### unicode_to_symbol/1 ### 118 | 119 | 120 |

121 | unicode_to_symbol(L::[scmd_types_impl:unichar()]) -> scm_symbol()
122 | 
123 | 124 |

125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /doc/scml_base_system.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_base_system # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme base library for system interface

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
features/0
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### features/0 ### 39 | 40 | 41 |

42 | features() -> [scm_symbol()]
43 | 
44 | 45 |

46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /doc/scml_complex.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_complex # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme complex library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'imag-part'/1
'make-polar'/2
'make-rectangular'/2
'real-part'/1
angle/1
magnitude/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

 29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'imag-part'/1 ### 39 | 40 | 41 |

 42 | 'imag-part'(Z::scm_z()) -> scm_x()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'make-polar'/2 ### 52 | 53 | 54 |

 55 | 'make-polar'(X1::scm_x(), X2::scm_x()) -> scm_z()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'make-rectangular'/2 ### 65 | 66 | 67 |

 68 | 'make-rectangular'(X1::scm_x(), X2::scm_x()) -> scm_z()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### 'real-part'/1 ### 78 | 79 | 80 |

 81 | 'real-part'(Z::scm_z()) -> scm_x()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### angle/1 ### 91 | 92 | 93 |

 94 | angle(Z::scm_z()) -> scm_x()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### magnitude/1 ### 104 | 105 | 106 |

107 | magnitude(Z::scm_z()) -> scm_x()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/scml_context.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_context # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme process-context library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'command-line'/0
'emergency-exit'/0
'emergency-exit'/1
'get-environment-variable'/1
'get-environment-variables'/0
exit/0
exit/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

 29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'command-line'/0 ### 39 | 40 | 41 |

 42 | 'command-line'() -> [scm_string(), ...]
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'emergency-exit'/0 ### 52 | 53 | 54 |

 55 | 'emergency-exit'() -> no_return()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'emergency-exit'/1 ### 65 | 66 | 67 |

 68 | 'emergency-exit'(Obj::scm_obj()) -> no_return()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### 'get-environment-variable'/1 ### 78 | 79 | 80 |

 81 | 'get-environment-variable'(S::scm_string()) -> scm_string() | scm_false()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### 'get-environment-variables'/0 ### 91 | 92 | 93 |

 94 | 'get-environment-variables'() -> [[scm_string() | scm_string()]]
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### exit/0 ### 104 | 105 | 106 |

107 | exit() -> no_return()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | 115 | 116 | ### exit/1 ### 117 | 118 | 119 |

120 | exit(Obj::scm_obj()) -> no_return()
121 | 
122 | 123 |

124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /doc/scml_eval.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_eval # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme eval library

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
environment/1
eval/2
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### environment/1 ### 39 | 40 | 41 |

42 | environment(L::scmi_vargs()) -> scmi_denv()
43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### eval/2 ### 52 | 53 | 54 |

55 | eval(ExprOrDef::scm_any(), Env::scmi_denv()) -> scm_any()
56 | 
57 | 58 |

59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /doc/scml_file.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_file # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme file library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'call-with-input-file'/2
'call-with-output-file'/2
'delete-file'/1
'file-exists?'/1
'open-binary-input-file'/1
'open-binary-output-file'/1
'open-input-file'/1
'open-output-file'/1
'with-input-from-file'/2
'with-output-to-file'/2
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

 29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'call-with-input-file'/2 ### 39 | 40 | 41 |

 42 | 'call-with-input-file'(S::scm_string(), Proc::scm_proc()) -> scm_obj()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'call-with-output-file'/2 ### 52 | 53 | 54 |

 55 | 'call-with-output-file'(S::scm_string(), Proc::scm_proc()) -> scm_obj()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'delete-file'/1 ### 65 | 66 | 67 |

 68 | 'delete-file'(S::scm_string()) -> scm_false()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### 'file-exists?'/1 ### 78 | 79 | 80 |

 81 | 'file-exists?'(S::scm_string()) -> scm_boolean()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### 'open-binary-input-file'/1 ### 91 | 92 | 93 |

 94 | 'open-binary-input-file'(S::scm_string()) -> scm_port()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### 'open-binary-output-file'/1 ### 104 | 105 | 106 |

107 | 'open-binary-output-file'(S::scm_string()) -> scm_port()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | 115 | 116 | ### 'open-input-file'/1 ### 117 | 118 | 119 |

120 | 'open-input-file'(S::scm_string()) -> scm_port()
121 | 
122 | 123 |

124 | 125 | 126 | 127 | 128 | 129 | ### 'open-output-file'/1 ### 130 | 131 | 132 |

133 | 'open-output-file'(S::scm_string()) -> scm_port()
134 | 
135 | 136 |

137 | 138 | 139 | 140 | 141 | 142 | ### 'with-input-from-file'/2 ### 143 | 144 | 145 |

146 | 'with-input-from-file'(S::scm_string(), Thunk::scm_thunk()) -> scm_obj()
147 | 
148 | 149 |

150 | 151 | 152 | 153 | 154 | 155 | ### 'with-output-to-file'/2 ### 156 | 157 | 158 |

159 | 'with-output-to-file'(S::scm_string(), Thunk::scm_thunk()) -> scm_obj()
160 | 
161 | 162 |

163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /doc/scml_inexact.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_inexact # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme inexact library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'finite?'/1
'infinite?'/1
'nan?'/1
acos/1
asin/1
atan/1
atan/2
cos/1
exp/1
log/1
log/2
sin/1
sqrt/1
tan/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

 29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'finite?'/1 ### 39 | 40 | 41 |

 42 | 'finite?'(Z::scm_z()) -> scm_boolean()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'infinite?'/1 ### 52 | 53 | 54 |

 55 | 'infinite?'(Z::scm_z()) -> scm_boolean()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'nan?'/1 ### 65 | 66 | 67 |

 68 | 'nan?'(Z::scm_z()) -> scm_boolean()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### acos/1 ### 78 | 79 | 80 |

 81 | acos(Z::scm_z()) -> scm_z()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### asin/1 ### 91 | 92 | 93 |

 94 | asin(Z::scm_z()) -> scm_z()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### atan/1 ### 104 | 105 | 106 |

107 | atan(Z::scm_z()) -> scm_z()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | 115 | 116 | ### atan/2 ### 117 | 118 | 119 |

120 | atan(Y::scm_y(), X::scm_x()) -> scm_z()
121 | 
122 | 123 |

124 | 125 | 126 | 127 | 128 | 129 | ### cos/1 ### 130 | 131 | 132 |

133 | cos(Z::scm_z()) -> scm_z()
134 | 
135 | 136 |

137 | 138 | 139 | 140 | 141 | 142 | ### exp/1 ### 143 | 144 | 145 |

146 | exp(Z::scm_z()) -> scm_z()
147 | 
148 | 149 |

150 | 151 | 152 | 153 | 154 | 155 | ### log/1 ### 156 | 157 | 158 |

159 | log(Z::scm_z()) -> scm_z()
160 | 
161 | 162 |

163 | 164 | 165 | 166 | 167 | 168 | ### log/2 ### 169 | 170 | 171 |

172 | log(Z1::scm_z(), Z2::scm_z()) -> scm_z()
173 | 
174 | 175 |

176 | 177 | 178 | 179 | 180 | 181 | ### sin/1 ### 182 | 183 | 184 |

185 | sin(Z::scm_z()) -> scm_z()
186 | 
187 | 188 |

189 | 190 | 191 | 192 | 193 | 194 | ### sqrt/1 ### 195 | 196 | 197 |

198 | sqrt(Z::scm_z()) -> scm_z()
199 | 
200 | 201 |

202 | 203 | 204 | 205 | 206 | 207 | ### tan/1 ### 208 | 209 | 210 |

211 | tan(Z::scm_z()) -> scm_z()
212 | 
213 | 214 |

215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /doc/scml_lambda.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_lambda # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme case-lambda library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'case-lambda'/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'case-lambda'/1 ### 39 | 40 | 41 |

42 | 'case-lambda'(Exps::[scm_obj(), ...]) -> scm_obj()
43 | 
44 | 45 |

46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /doc/scml_lazy.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_lazy # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme lazy library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'delay-force'/1
'make-promise'/1
'promise?'/1
delay/1
force/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

 29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'delay-force'/1 ### 39 | 40 | 41 |

 42 | 'delay-force'(Exp::scm_obj()) -> scm_obj()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'make-promise'/1 ### 52 | 53 | 54 |

 55 | 'make-promise'(Obj::scm_obj()) -> scm_obj()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'promise?'/1 ### 65 | 66 | 67 |

 68 | 'promise?'(Obj::scm_obj()) -> scm_boolean()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### delay/1 ### 78 | 79 | 80 |

 81 | delay(Exp::scm_obj()) -> scm_obj()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### force/1 ### 91 | 92 | 93 |

 94 | force(Promise::scm_obj()) -> scm_obj()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /doc/scml_load.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_load # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme load library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
load/1
load/2
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### load/1 ### 39 | 40 | 41 |

42 | load(S::scm_string()) -> scm_false()
43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### load/2 ### 52 | 53 | 54 |

55 | load(S::scm_string(), Env::scmi_denv()) -> scm_false()
56 | 
57 | 58 |

59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /doc/scml_r5rs.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_r5rs # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme r5rs library

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'call-with-current-continuation'/4
'exact->inexact'/1
'inexact->exact'/1
'null-environment'/1
'scheme-report-environment'/1
'transcript-off'/0
'transcript-on'/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

 29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'call-with-current-continuation'/4 ### 39 | 40 | 41 |

 42 | 'call-with-current-continuation'(Proc::scm_proc(), Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_any()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'exact->inexact'/1 ### 52 | 53 | 54 |

 55 | 'exact->inexact'(Z::scm_z()) -> scm_z()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'inexact->exact'/1 ### 65 | 66 | 67 |

 68 | 'inexact->exact'(Z::scm_z()) -> scm_z()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### 'null-environment'/1 ### 78 | 79 | 80 |

 81 | 'null-environment'(K::scm_k()) -> scmi_denv()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### 'scheme-report-environment'/1 ### 91 | 92 | 93 |

 94 | 'scheme-report-environment'(K::scm_k()) -> scmi_denv()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### 'transcript-off'/0 ### 104 | 105 | 106 |

107 | 'transcript-off'() -> scm_false()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | 115 | 116 | ### 'transcript-on'/1 ### 117 | 118 | 119 |

120 | 'transcript-on'(S::scm_string()) -> scm_false()
121 | 
122 | 123 |

124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /doc/scml_read.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_read # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme read library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
read/0
read/1
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### read/0 ### 39 | 40 | 41 |

42 | read() -> scm_obj() | scm_eof()
43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### read/1 ### 52 | 53 | 54 |

55 | read(Port::scm_port()) -> scm_obj() | scm_eof()
56 | 
57 | 58 |

59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /doc/scml_repl.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_repl # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme repl library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'interaction-environment'/0
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'interaction-environment'/0 ### 39 | 40 | 41 |

42 | 'interaction-environment'() -> scmi_denv()
43 | 
44 | 45 |

46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /doc/scml_time.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_time # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme time library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'current-jiffy'/0
'current-second'/0
'jiffies-per-second'/0
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'current-jiffy'/0 ### 39 | 40 | 41 |

42 | 'current-jiffy'() -> scm_k()
43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'current-second'/0 ### 52 | 53 | 54 |

55 | 'current-second'() -> scm_x()
56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'jiffies-per-second'/0 ### 65 | 66 | 67 |

68 | 'jiffies-per-second'() -> scm_k()
69 | 
70 | 71 |

72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /doc/scml_write.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scml_write # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Scheme write library

. 10 | __Authors:__ CSCM Contributor ([`the-concurrent-schemer@googlegroups.com`](mailto:the-concurrent-schemer@googlegroups.com)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
'$scml_exports'/0
'write-shared'/1
'write-shared'/2
'write-simple'/1
'write-simple'/2
display/1
display/2
write/1
write/2
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### '$scml_exports'/0 ### 26 | 27 | 28 |

 29 | '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
 30 | 
31 | 32 |

33 | 34 | 35 | 36 | 37 | 38 | ### 'write-shared'/1 ### 39 | 40 | 41 |

 42 | 'write-shared'(Obj::scm_obj()) -> scm_false()
 43 | 
44 | 45 |

46 | 47 | 48 | 49 | 50 | 51 | ### 'write-shared'/2 ### 52 | 53 | 54 |

 55 | 'write-shared'(Obj::scm_obj(), Port::scm_port()) -> scm_false()
 56 | 
57 | 58 |

59 | 60 | 61 | 62 | 63 | 64 | ### 'write-simple'/1 ### 65 | 66 | 67 |

 68 | 'write-simple'(Obj::scm_obj()) -> scm_false()
 69 | 
70 | 71 |

72 | 73 | 74 | 75 | 76 | 77 | ### 'write-simple'/2 ### 78 | 79 | 80 |

 81 | 'write-simple'(Obj::scm_obj(), Port::scm_port()) -> scm_false()
 82 | 
83 | 84 |

85 | 86 | 87 | 88 | 89 | 90 | ### display/1 ### 91 | 92 | 93 |

 94 | display(Obj::scm_obj()) -> scm_false()
 95 | 
96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | ### display/2 ### 104 | 105 | 106 |

107 | display(Obj::scm_obj(), Port::scm_port()) -> scm_false()
108 | 
109 | 110 |

111 | 112 | 113 | 114 | 115 | 116 | ### write/1 ### 117 | 118 | 119 |

120 | write(Obj::scm_obj()) -> scm_false()
121 | 
122 | 123 |

124 | 125 | 126 | 127 | 128 | 129 | ### write/2 ### 130 | 131 | 132 |

133 | write(Obj::scm_obj(), Port::scm_port()) -> scm_false()
134 | 
135 | 136 |

137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /doc/scmtmp.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module scmtmp # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

This module contains functions that are not yet implemented 10 | or temporary in nature. These functions will be deprecated or 11 | moved to other modules in a future release.

. 12 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 13 | 14 | 15 | ## Function Index ## 16 | 17 | 18 |
'make-polar'/3

This function is a temporary place holder

.
'make-rational'/2

This function is a temporary place holder

.
'make-rational'/3

This function is a temporary place holder

.
'make-real'/2

This function is a temporary place holder

.
'make-rectangular'/3

This function is a temporary place holder

.
exact/2

This function is a temporary place holder

.
inexact/2

This function is a temporary place holder

.
19 | 20 | 21 | 22 | 23 | ## Function Details ## 24 | 25 | 26 | 27 | ### 'make-polar'/3 ### 28 | 29 | 30 |

 31 | 'make-polar'(X::scm_x(), Y::scm_y(), Env::scmi_denv()) -> scm_z()
 32 | 
33 | 34 |

35 | 36 | 37 |

This function is a temporary place holder

38 | 39 | 40 | 41 | ### 'make-rational'/2 ### 42 | 43 | 44 |

 45 | 'make-rational'(X::scm_x(), Env::scmi_denv()) -> scm_q()
 46 | 
47 | 48 |

49 | 50 | 51 |

This function is a temporary place holder

52 | 53 | 54 | 55 | ### 'make-rational'/3 ### 56 | 57 | 58 |

 59 | 'make-rational'(N::scm_n(), D::scm_k(), Env::scmi_denv()) -> scm_q()
 60 | 
61 | 62 |

63 | 64 | 65 |

This function is a temporary place holder

66 | 67 | 68 | 69 | ### 'make-real'/2 ### 70 | 71 | 72 |

 73 | 'make-real'(X::scm_x() | {scm_n(), scm_n()}, Env::scmi_denv()) -> scm_x()
 74 | 
75 | 76 |

77 | 78 | 79 |

This function is a temporary place holder

80 | 81 | 82 | 83 | ### 'make-rectangular'/3 ### 84 | 85 | 86 |

 87 | 'make-rectangular'(X::scm_x(), Y::scm_y(), Env::scmi_denv()) -> scm_z()
 88 | 
89 | 90 |

91 | 92 | 93 |

This function is a temporary place holder

94 | 95 | 96 | 97 | ### exact/2 ### 98 | 99 | 100 |

101 | exact(X::scm_x(), Env::scmi_denv()) -> scm_x()
102 | 
103 | 104 |

105 | 106 | 107 |

This function is a temporary place holder

108 | 109 | 110 | 111 | ### inexact/2 ### 112 | 113 | 114 |

115 | inexact(X::scm_x(), Env::scmi_denv()) -> scm_x()
116 | 
117 | 118 |

119 | 120 | 121 |

This function is a temporary place holder

122 | 123 | -------------------------------------------------------------------------------- /doc/xfm_import_as_export.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Module xfm_import_as_export # 4 | * [Description](#description) 5 | * [Function Index](#index) 6 | * [Function Details](#functions) 7 | 8 | 9 |

Parse transform to export function imports

. 10 | __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)). 11 | 12 | 13 | ## Function Index ## 14 | 15 | 16 |
parse_transform/2
17 | 18 | 19 | 20 | 21 | ## Function Details ## 22 | 23 | 24 | 25 | ### parse_transform/2 ### 26 | 27 | `parse_transform(Forms, Options) -> any()` 28 | 29 | 30 | -------------------------------------------------------------------------------- /rebar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-concurrent-schemer/scm/1726ec2e94e766893d80c286f816599defb6a524/rebar -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | 3 | {require_min_otp_vsn, "17"}. 4 | 5 | {port_env, [{"DRV_CFLAGS", "$DRV_CFLAGS -fPIC -g -Wall -Wextra -Werror"}, 6 | {"x86_64-apple-darwin*", "DRV_CFLAGS", "$DRV_CFLAGS -Qunused-arguments -Wno-missing-field-initializers"}, 7 | {"DRV_LDFLAGS", "$DRV_LDFLAGS -lstdc++"}]}. 8 | {port_specs, [{"priv/lib/scmi_env.so", ["c_src/scmi_env_lib.cc", "c_src/scmi_env.cc"]}, 9 | {"priv/lib/scmi_iodev.so", ["c_src/scmi_iodev_lib.cc", "c_src/scmi_iodev.cc"]}]}. 10 | 11 | {erl_opts, [warnings_as_errors, warn_shadow_vars, warn_obsolete_guard]}. 12 | {xrl_opts, [warnings_as_errors]}. 13 | {yrl_opts, [warnings_as_errors]}. 14 | 15 | {erl_first_files, ["xfm_import_as_export"]}. 16 | 17 | {xref_checks, [undefined_function_calls, undefined_functions, 18 | deprecated_function_calls, deprecated_functions]}. 19 | 20 | {deps, [{parsetools, "", {git, "git://github.com/the-concurrent-schemer/parsetools.git", {branch, "norton-leex-17.0"}}}]}. 21 | -------------------------------------------------------------------------------- /rebar.config.doc: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | 3 | {edoc_opts, [{doclet, asciiedown_doclet} 4 | , {app_default, "http://www.erlang.org/doc/man"} 5 | , {new, true} 6 | , {packages, false} 7 | , {stylesheet, ""} % don't copy stylesheet.css 8 | , {image, ""} % don't copy erlang.png 9 | , {top_level_readme, {"./README.md", "https://github.com/the-concurrent-schemer/scm", "master"}} 10 | ]}. 11 | 12 | {deps, [{meck, "", {git, "git://github.com/norton/meck.git"}} 13 | , {edown, "", {git, "git://github.com/norton/edown.git"}} 14 | , {asciiedoc, "", {git, "git://github.com/norton/asciiedoc.git"}} 15 | ]}. 16 | -------------------------------------------------------------------------------- /src/scm.app.src: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | 3 | %%% The MIT License 4 | %%% 5 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 6 | %%% 7 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 8 | %%% of this software and associated documentation files (the "Software"), to deal 9 | %%% in the Software without restriction, including without limitation the rights 10 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | %%% copies of the Software, and to permit persons to whom the Software is 12 | %%% furnished to do so, subject to the following conditions: 13 | %%% 14 | %%% The above copyright notice and this permission notice shall be included in 15 | %%% all copies or substantial portions of the Software. 16 | %%% 17 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | %%% THE SOFTWARE. 24 | 25 | {application, scm, 26 | [{description, "The Concurrent Schemer"}, 27 | {id, scm}, 28 | {vsn, git}, 29 | {modules, [scm_app, scm_sup, 30 | scmd, 31 | scmd_parse, scmd_parse_numR, 32 | scmd_scan, scmd_scan_num16, scmd_scan_num10, scmd_scan_num8, scmd_scan_num2, 33 | scmd_types, 34 | scmi_analyze, 35 | scmi_analyze_derived, 36 | scmi_analyze_primitive, 37 | scmi_analyze_program, 38 | scmi_analyze_macro, 39 | scmi_env, 40 | scmi_eval, 41 | scmi_iodev, 42 | scmi_iodev_server_file, 43 | scmi_iodev_server_ram, 44 | scmi_iodev_server_std, 45 | scmi_iodev_server_std_test, 46 | scmi_types, 47 | scml, 48 | scml_base_boolean, 49 | scml_base_bytevector, 50 | scml_base_char, 51 | scml_base_control, 52 | scml_base_equality, 53 | scml_base_exception, 54 | scml_base_io, 55 | scml_base_list, 56 | scml_base_number, 57 | scml_base_string, 58 | scml_base_symbol, 59 | scml_base_system, 60 | scml_base_vector, 61 | scml_char, 62 | scml_complex, 63 | scml_context, 64 | scml_cxr, 65 | scml_eval, 66 | scml_file, 67 | scml_inexact, 68 | scml_lambda, 69 | scml_lazy, 70 | scml_load, 71 | scml_r5rs, 72 | scml_read, 73 | scml_repl, 74 | scml_time, 75 | scml_write, 76 | scmtmp]}, 77 | {included_applications, [parsetools]}, 78 | {applications, [kernel, stdlib, sasl]}, 79 | {env, []}, 80 | {mod, {scm_app, []}} 81 | ]}. 82 | -------------------------------------------------------------------------------- /src/scm.hrl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | -ifndef(scm). 24 | -define(scm, true). 25 | 26 | -define(SCM, 'scm'). 27 | -define(SCMVSN, 'scm-0.5.2'). % @TODO make this depend on git describe 28 | 29 | -define(SCMIEXPORTS, '$scmi_exports'). 30 | -define(SCMIPARAMSET, 1). 31 | -define(SCMIPARAMCVT, 2). 32 | 33 | -define(SCMLEXPORTS, '$scml_exports'). 34 | -define(SCMLDYNWINDERS, '$scml_dynamic_winders'). 35 | -define(SCMLCURINPORT, '$scml_current_input_port'). 36 | -define(SCMLCUROUTPORT, '$scml_current_output_port'). 37 | -define(SCMLCURERRPORT, '$scml_current_error_port'). 38 | 39 | -endif. % -ifndef(scm). 40 | -------------------------------------------------------------------------------- /src/scm_app.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme application 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(scm_app). 27 | 28 | -behaviour(application). 29 | 30 | %% External exports 31 | -export([start/2, stop/1, priv_libdir/0, priv_scmdir/0]). 32 | 33 | %%%---------------------------------------------------------------------- 34 | %%% API 35 | %%%---------------------------------------------------------------------- 36 | 37 | start(_StartType, _StartArgs) -> 38 | case scm_sup:start_link() of 39 | {ok, Pid} -> 40 | {ok, Pid}; 41 | Error -> 42 | Error 43 | end. 44 | 45 | stop(_State) -> 46 | ok. 47 | 48 | priv_libdir() -> 49 | case code:priv_dir(scm) of 50 | {error, bad_name} -> 51 | Fun = fun (Dir, Acc) -> 52 | case filelib:wildcard(filename:join([Dir, "priv/lib/scmi_env.*"])) of 53 | [] -> 54 | Acc; 55 | [H] -> 56 | filename:dirname(H) 57 | end 58 | end, 59 | lists:foldl(Fun, "priv/lib", ["../../scm", "../scm", "../", "./"]); 60 | Dir -> 61 | filename:join([Dir, "lib"]) 62 | end. 63 | 64 | priv_scmdir() -> 65 | case code:priv_dir(scm) of 66 | {error, bad_name} -> 67 | Fun = fun (Dir, Acc) -> 68 | case filelib:wildcard(filename:join([Dir, "priv/scm/*.scm"])) of 69 | [] -> 70 | Acc; 71 | [H|_] -> 72 | filename:dirname(H) 73 | end 74 | end, 75 | lists:foldl(Fun, "priv/scm", ["../../scm", "../scm", "../", "./"]); 76 | Dir -> 77 | filename:join([Dir, "scm"]) 78 | end. 79 | 80 | %%%---------------------------------------------------------------------- 81 | %%% Internal functions 82 | %%%---------------------------------------------------------------------- 83 | -------------------------------------------------------------------------------- /src/scm_sup.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme supervisor 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(scm_sup). 27 | 28 | -behaviour(supervisor). 29 | 30 | %% External exports 31 | -export([start_link/0, init/1]). 32 | 33 | -define(SERVER, ?MODULE). 34 | 35 | %%%---------------------------------------------------------------------- 36 | %%% API 37 | %%%---------------------------------------------------------------------- 38 | 39 | start_link() -> 40 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 41 | 42 | init([]) -> 43 | {ok, {{one_for_one, 2, 60}, []}}. 44 | 45 | %%%---------------------------------------------------------------------- 46 | %%% Internal functions 47 | %%%---------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /src/scmd_parse_numR.hrl: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | %%% 3 | %%% The MIT License 4 | %%% 5 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 6 | %%% 7 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 8 | %%% of this software and associated documentation files (the "Software"), to deal 9 | %%% in the Software without restriction, including without limitation the rights 10 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | %%% copies of the Software, and to permit persons to whom the Software is 12 | %%% furnished to do so, subject to the following conditions: 13 | %%% 14 | %%% The above copyright notice and this permission notice shall be included in 15 | %%% all copies or substantial portions of the Software. 16 | %%% 17 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | %%% THE SOFTWARE. 24 | %%% 25 | 26 | -ifndef(scmd_parse_numR). 27 | -define(scmd_parse_numR, true). 28 | 29 | -record(n, {sign :: sign(), val :: token()}). % real integer 30 | -record(q, {sign :: sign(), num :: token(), den :: token()}). % real rational 31 | -record(x, {sign :: sign(), val :: token() | int(), exp :: token()}). % real float 32 | -record(in, {sign :: sign(), val :: token()}). % infnan 33 | -record(zp, {mag :: real(), ang :: real()}). % complex polar 34 | -record(zr, {real :: real(), imag :: real()}). % complex rectangular 35 | -record(numR, { % number 36 | lineno :: pos_integer(), 37 | exactness :: exactness(), 38 | radix :: radix(), 39 | val :: complex() 40 | }). 41 | 42 | -type exactness() :: e | i. 43 | -type radix() :: 2 | 8 | 10 | 16. 44 | -type sign() :: string(). % "+" | "-" 45 | -type token() :: string(). 46 | -type int() :: #n{} | #q{}. 47 | -type real() :: int() | #x{} | #in{}. 48 | -type complex() :: real() | #zp{} | #zr{}. 49 | 50 | -endif. % -ifndef(scmd_parse_numR). 51 | -------------------------------------------------------------------------------- /src/scmd_scan_num10.xrl: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | %%% 3 | %%% The MIT License 4 | %%% 5 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 6 | %%% 7 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 8 | %%% of this software and associated documentation files (the "Software"), to deal 9 | %%% in the Software without restriction, including without limitation the rights 10 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | %%% copies of the Software, and to permit persons to whom the Software is 12 | %%% furnished to do so, subject to the following conditions: 13 | %%% 14 | %%% The above copyright notice and this permission notice shall be included in 15 | %%% all copies or substantial portions of the Software. 16 | %%% 17 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | %%% THE SOFTWARE. 24 | %%% 25 | 26 | %%% @doc Scheme number tokenizer (base 10) 27 | %%% @author Joseph Wayne Norton 28 | 29 | Definitions. 30 | 31 | %% token - see LALR-1 parser generator 32 | 33 | A = [aA] 34 | %%B = [bB] 35 | %%C = [cC] 36 | D = [dD] 37 | E = [eE] 38 | F = [fF] 39 | %%G = [gG] 40 | %%H = [hH] 41 | I = [iI] 42 | %%J = [jJ] 43 | %%K = [kK] 44 | L = [lL] 45 | %%M = [mM] 46 | N = [nN] 47 | %%O = [oO] 48 | %%P = [pP] 49 | %%Q = [qQ] 50 | %%R = [rR] 51 | S = [sS] 52 | %%T = [tT] 53 | %%U = [uU] 54 | %%V = [vV] 55 | %%W = [wW] 56 | %%X = [xX] 57 | %%Y = [yY] 58 | %%Z = [zZ] 59 | 60 | %% number - see LALR-1 parser generator 61 | 62 | radixR = #{D} 63 | 64 | digitR = [0-9] 65 | 66 | suffix = ({exponent_marker}{sign}?{digitR}+) 67 | 68 | exponent_marker = ({E}|{S}|{F}|{D}|{L}) 69 | 70 | uinfnan = ({I}{N}{F}\.0|{N}{A}{N}\.0) 71 | 72 | sign = [+-] 73 | 74 | exactness = (#{I}|#{E}) 75 | 76 | floatdigitsR = ({digitR}+\.{digitR}*|\.{digitR}+) 77 | 78 | rationaldigitsR = {digitR}+/{digitR}+ 79 | 80 | digitsR = {digitR}+ 81 | 82 | Rules. 83 | 84 | %% number 85 | {uinfnan} : {token, {uinfnan, TokenLine, to_lower(TokenChars)}}. 86 | 87 | {suffix} : {token, {suffix, TokenLine, to_lower(TokenChars)}}. 88 | 89 | {exactness} : {token, {exactness, TokenLine, to_lower_atom(substr(TokenChars, 2))}}. 90 | 91 | {radixR} : {token, {radixR, TokenLine, 10}}. 92 | 93 | {floatdigitsR} : {token, {floatdigitsR, TokenLine, TokenChars}}. 94 | 95 | {rationaldigitsR} : {token, {rationaldigitsR, TokenLine, TokenChars}}. 96 | 97 | {digitsR} : {token, {digitsR, TokenLine, TokenChars}}. 98 | 99 | @ : {token, {'@', TokenLine}}. 100 | 101 | {I} : {token, {'i', TokenLine}}. 102 | 103 | {sign} : {token, {sign, TokenLine, TokenChars}}. 104 | 105 | Erlang code. 106 | 107 | %%%---------------------------------------------------------------------- 108 | %%% Leex functions 109 | %%%---------------------------------------------------------------------- 110 | 111 | substr(X, Start) -> 112 | string:substr(X, Start). 113 | 114 | to_atom(X) -> 115 | list_to_atom(X). 116 | 117 | to_lower(X) -> 118 | string:to_lower(X). 119 | 120 | to_lower_atom(X) -> 121 | to_atom(to_lower(X)). 122 | -------------------------------------------------------------------------------- /src/scmd_scan_num16.xrl: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | %%% 3 | %%% The MIT License 4 | %%% 5 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 6 | %%% 7 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 8 | %%% of this software and associated documentation files (the "Software"), to deal 9 | %%% in the Software without restriction, including without limitation the rights 10 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | %%% copies of the Software, and to permit persons to whom the Software is 12 | %%% furnished to do so, subject to the following conditions: 13 | %%% 14 | %%% The above copyright notice and this permission notice shall be included in 15 | %%% all copies or substantial portions of the Software. 16 | %%% 17 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | %%% THE SOFTWARE. 24 | %%% 25 | 26 | %%% @doc Scheme number tokenizer (base 16) 27 | %%% @author Joseph Wayne Norton 28 | 29 | Definitions. 30 | 31 | %% token - see LALR-1 parser generator 32 | 33 | A = [aA] 34 | %%B = [bB] 35 | %%C = [cC] 36 | %%D = [dD] 37 | E = [eE] 38 | F = [fF] 39 | %%G = [gG] 40 | %%H = [hH] 41 | I = [iI] 42 | %%J = [jJ] 43 | %%K = [kK] 44 | %%L = [lL] 45 | %%M = [mM] 46 | N = [nN] 47 | %%O = [oO] 48 | %%P = [pP] 49 | %%Q = [qQ] 50 | %%R = [rR] 51 | %%S = [sS] 52 | %%T = [tT] 53 | %%U = [uU] 54 | %%V = [vV] 55 | %%W = [wW] 56 | X = [xX] 57 | %%Y = [yY] 58 | %%Z = [zZ] 59 | 60 | %% number - see LALR-1 parser generator 61 | 62 | radixR = #{X} 63 | 64 | digitR = [0-9a-fA-F] 65 | 66 | uinfnan = ({I}{N}{F}\.0|{N}{A}{N}\.0) 67 | 68 | sign = [+-] 69 | 70 | exactness = (#{I}|#{E}) 71 | 72 | rationaldigitsR = {digitR}+/{digitR}+ 73 | 74 | digitsR = {digitR}+ 75 | 76 | Rules. 77 | 78 | %% number 79 | {uinfnan} : {token, {uinfnan, TokenLine, to_lower(TokenChars)}}. 80 | 81 | {exactness} : {token, {exactness, TokenLine, to_lower_atom(substr(TokenChars, 2))}}. 82 | 83 | {radixR} : {token, {radixR, TokenLine, 16}}. 84 | 85 | {floatdigitsR} : {token, {floatdigitsR, TokenLine, TokenChars}}. 86 | 87 | {rationaldigitsR} : {token, {rationaldigitsR, TokenLine, TokenChars}}. 88 | 89 | {digitsR} : {token, {digitsR, TokenLine, TokenChars}}. 90 | 91 | @ : {token, {'@', TokenLine}}. 92 | 93 | {I} : {token, {'i', TokenLine}}. 94 | 95 | {sign} : {token, {sign, TokenLine, TokenChars}}. 96 | 97 | Erlang code. 98 | 99 | %%%---------------------------------------------------------------------- 100 | %%% Leex functions 101 | %%%---------------------------------------------------------------------- 102 | 103 | substr(X, Start) -> 104 | string:substr(X, Start). 105 | 106 | to_atom(X) -> 107 | list_to_atom(X). 108 | 109 | to_lower(X) -> 110 | string:to_lower(X). 111 | 112 | to_lower_atom(X) -> 113 | to_atom(to_lower(X)). 114 | -------------------------------------------------------------------------------- /src/scmd_scan_num2.xrl: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | %%% 3 | %%% The MIT License 4 | %%% 5 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 6 | %%% 7 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 8 | %%% of this software and associated documentation files (the "Software"), to deal 9 | %%% in the Software without restriction, including without limitation the rights 10 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | %%% copies of the Software, and to permit persons to whom the Software is 12 | %%% furnished to do so, subject to the following conditions: 13 | %%% 14 | %%% The above copyright notice and this permission notice shall be included in 15 | %%% all copies or substantial portions of the Software. 16 | %%% 17 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | %%% THE SOFTWARE. 24 | %%% 25 | 26 | %%% @doc Scheme number tokenizer (base 2) 27 | %%% @author Joseph Wayne Norton 28 | 29 | Definitions. 30 | 31 | %% token - see LALR-1 parser generator 32 | 33 | A = [aA] 34 | B = [bB] 35 | %%C = [cC] 36 | %%D = [dD] 37 | E = [eE] 38 | F = [fF] 39 | %%G = [gG] 40 | %%H = [hH] 41 | I = [iI] 42 | %%J = [jJ] 43 | %%K = [kK] 44 | %%L = [lL] 45 | %%M = [mM] 46 | N = [nN] 47 | %%O = [oO] 48 | %%P = [pP] 49 | %%Q = [qQ] 50 | %%R = [rR] 51 | %%S = [sS] 52 | %%T = [tT] 53 | %%U = [uU] 54 | %%V = [vV] 55 | %%W = [wW] 56 | %%X = [xX] 57 | %%Y = [yY] 58 | %%Z = [zZ] 59 | 60 | %% number - see LALR-1 parser generator 61 | 62 | radixR = #{B} 63 | 64 | digitR = [0-1] 65 | 66 | uinfnan = ({I}{N}{F}\.0|{N}{A}{N}\.0) 67 | 68 | sign = [+-] 69 | 70 | exactness = (#{I}|#{E}) 71 | 72 | rationaldigitsR = {digitR}+/{digitR}+ 73 | 74 | digitsR = {digitR}+ 75 | 76 | Rules. 77 | 78 | %% number 79 | {uinfnan} : {token, {uinfnan, TokenLine, to_lower(TokenChars)}}. 80 | 81 | {exactness} : {token, {exactness, TokenLine, to_lower_atom(substr(TokenChars, 2))}}. 82 | 83 | {radixR} : {token, {radixR, TokenLine, 2}}. 84 | 85 | {floatdigitsR} : {token, {floatdigitsR, TokenLine, TokenChars}}. 86 | 87 | {rationaldigitsR} : {token, {rationaldigitsR, TokenLine, TokenChars}}. 88 | 89 | {digitsR} : {token, {digitsR, TokenLine, TokenChars}}. 90 | 91 | @ : {token, {'@', TokenLine}}. 92 | 93 | {I} : {token, {'i', TokenLine}}. 94 | 95 | {sign} : {token, {sign, TokenLine, TokenChars}}. 96 | 97 | Erlang code. 98 | 99 | %%%---------------------------------------------------------------------- 100 | %%% Leex functions 101 | %%%---------------------------------------------------------------------- 102 | 103 | substr(X, Start) -> 104 | string:substr(X, Start). 105 | 106 | to_atom(X) -> 107 | list_to_atom(X). 108 | 109 | to_lower(X) -> 110 | string:to_lower(X). 111 | 112 | to_lower_atom(X) -> 113 | to_atom(to_lower(X)). 114 | -------------------------------------------------------------------------------- /src/scmd_scan_num8.xrl: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | %%% 3 | %%% The MIT License 4 | %%% 5 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 6 | %%% 7 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 8 | %%% of this software and associated documentation files (the "Software"), to deal 9 | %%% in the Software without restriction, including without limitation the rights 10 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | %%% copies of the Software, and to permit persons to whom the Software is 12 | %%% furnished to do so, subject to the following conditions: 13 | %%% 14 | %%% The above copyright notice and this permission notice shall be included in 15 | %%% all copies or substantial portions of the Software. 16 | %%% 17 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | %%% THE SOFTWARE. 24 | %%% 25 | 26 | %%% @doc Scheme number tokenizer (base 8) 27 | %%% @author Joseph Wayne Norton 28 | 29 | Definitions. 30 | 31 | %% token - see LALR-1 parser generator 32 | 33 | A = [aA] 34 | %%B = [bB] 35 | %%C = [cC] 36 | %%D = [dD] 37 | E = [eE] 38 | F = [fF] 39 | %%G = [gG] 40 | %%H = [hH] 41 | I = [iI] 42 | %%J = [jJ] 43 | %%K = [kK] 44 | %%L = [lL] 45 | %%M = [mM] 46 | N = [nN] 47 | O = [oO] 48 | %%P = [pP] 49 | %%Q = [qQ] 50 | %%R = [rR] 51 | %%S = [sS] 52 | %%T = [tT] 53 | %%U = [uU] 54 | %%V = [vV] 55 | %%W = [wW] 56 | %%X = [xX] 57 | %%Y = [yY] 58 | %%Z = [zZ] 59 | 60 | %% number - see LALR-1 parser generator 61 | 62 | radixR = #{O} 63 | 64 | digitR = [0-7] 65 | 66 | uinfnan = ({I}{N}{F}\.0|{N}{A}{N}\.0) 67 | 68 | sign = [+-] 69 | 70 | exactness = (#{I}|#{E}) 71 | 72 | rationaldigitsR = {digitR}+/{digitR}+ 73 | 74 | digitsR = {digitR}+ 75 | 76 | Rules. 77 | 78 | %% number 79 | {uinfnan} : {token, {uinfnan, TokenLine, to_lower(TokenChars)}}. 80 | 81 | {exactness} : {token, {exactness, TokenLine, to_lower_atom(substr(TokenChars, 2))}}. 82 | 83 | {radixR} : {token, {radixR, TokenLine, 8}}. 84 | 85 | {floatdigitsR} : {token, {floatdigitsR, TokenLine, TokenChars}}. 86 | 87 | {rationaldigitsR} : {token, {rationaldigitsR, TokenLine, TokenChars}}. 88 | 89 | {digitsR} : {token, {digitsR, TokenLine, TokenChars}}. 90 | 91 | @ : {token, {'@', TokenLine}}. 92 | 93 | {I} : {token, {'i', TokenLine}}. 94 | 95 | {sign} : {token, {sign, TokenLine, TokenChars}}. 96 | 97 | Erlang code. 98 | 99 | %%%---------------------------------------------------------------------- 100 | %%% Leex functions 101 | %%%---------------------------------------------------------------------- 102 | 103 | substr(X, Start) -> 104 | string:substr(X, Start). 105 | 106 | to_atom(X) -> 107 | list_to_atom(X). 108 | 109 | to_lower(X) -> 110 | string:to_lower(X). 111 | 112 | to_lower_atom(X) -> 113 | to_atom(to_lower(X)). 114 | -------------------------------------------------------------------------------- /src/scmd_types.hrl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | -ifndef(scmd_types). 24 | -define(scmd_types, true). 25 | 26 | -include("scmd_types_impl.hrl"). 27 | 28 | -type scm_alist() :: scmd_types:scm_alist(). 29 | -type scm_boolean() :: scmd_types:scm_boolean(). 30 | -type scm_true() :: scmd_types:scm_true(). 31 | -type scm_false() :: scmd_types:scm_false(). 32 | -type scm_byte() :: scmd_types:scm_byte(). 33 | -type scm_bytevector() :: scmd_types:scm_bytevector(). 34 | -type scm_char() :: scmd_types:scm_char(). 35 | -type scm_end() :: scmd_types:scm_end(). 36 | -type scm_k() :: scmd_types:scm_k(). 37 | -type scm_k_pos() :: scmd_types:scm_k_pos(). 38 | -type scm_letter() :: scmd_types:scm_letter(). 39 | -type scm_list() :: scmd_types:scm_list(). 40 | -type scm_list_nonempty() :: scmd_types:scm_list_nonempty(). 41 | -type scm_n() :: scmd_types:scm_n(). 42 | -type scm_n_nonzero() :: scmd_types:scm_n_nonzero(). 43 | -type scm_n_pos() :: scmd_types:scm_n_pos(). 44 | -type scm_obj() :: scmd_types:scm_obj(). 45 | -type scm_pair() :: scmd_types:scm_pair(). 46 | -type scm_port() :: scmd_types:scm_port(). 47 | -type scm_eof() :: scmd_types:scm_eof(). 48 | -type scm_proc() :: scmd_types:scm_proc(). 49 | -type scm_q() :: scmd_types:scm_q(). 50 | -type scm_start() :: scmd_types:scm_start(). 51 | -type scm_string() :: scmd_types:scm_string(). 52 | -type scm_symbol() :: scmd_types:scm_symbol(). 53 | -type scm_thunk() :: scmd_types:scm_thunk(). 54 | -type scm_vector() :: scmd_types:scm_vector(). 55 | -type scm_x() :: scmd_types:scm_x(). 56 | -type scm_y() :: scmd_types:scm_y(). 57 | -type scm_z() :: scmd_types:scm_z(). 58 | 59 | -type scm_exception() :: scmd_types:scm_exception(). 60 | -type scm_error() :: scmd_types:scm_error(). 61 | 62 | -type scm_any() :: smc_type:scm_any(). 63 | 64 | -endif. % -ifndef(scmd_types). 65 | -------------------------------------------------------------------------------- /src/scmd_types_impl.hrl: -------------------------------------------------------------------------------- 1 | %%% -*- mode: erlang -*- 2 | %%% 3 | %%% The MIT License 4 | %%% 5 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 6 | %%% 7 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 8 | %%% of this software and associated documentation files (the "Software"), to deal 9 | %%% in the Software without restriction, including without limitation the rights 10 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | %%% copies of the Software, and to permit persons to whom the Software is 12 | %%% furnished to do so, subject to the following conditions: 13 | %%% 14 | %%% The above copyright notice and this permission notice shall be included in 15 | %%% all copies or substantial portions of the Software. 16 | %%% 17 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | %%% THE SOFTWARE. 24 | %%% 25 | 26 | -ifndef(scmd). 27 | -define(scmd, true). 28 | 29 | -define(UNASSIGNED, ''). 30 | -define(EOF, ''). 31 | 32 | -define(PINF, {+1, 'inf.0'}). 33 | -define(NINF, {-1, 'inf.0'}). 34 | -define(PNAN, {+1, 'nan.0'}). 35 | -define(NNAN, {-1, 'nan.0'}). 36 | -define(NZER, {-1, '0.0'}). 37 | 38 | -define(FALSE, #boolean{val=false}). 39 | -define(TRUE, #boolean{val=true}). 40 | 41 | -define(UNICHAR_LOW_MIN, 16#00). 42 | -define(NULL, 16#00). 43 | -define(ALARM, 16#07). 44 | -define(BACKSPACE, 16#08). 45 | -define(TAB, 16#09). 46 | -define(NEWLINE, 16#0A). 47 | -define(RETURN, 16#0D). 48 | -define(ESCAPE, 16#1B). 49 | -define(SPACE, 16#20). 50 | -define(DQUOTE, 16#22). 51 | -define(BACKSLASH, 16#5C). 52 | -define(VLINE, 16#7C). 53 | -define(DELETE, 16#7F). 54 | -define(UNICHAR_LOW_MAX, 16#D7FF). 55 | -define(UNICHAR_HIGH_MIN, 16#E000). 56 | -define(UNICHAR_HIGH_MAX, 16#10FFFF). 57 | 58 | -record(boolean, {lineno :: scmd_types_impl:lineno(), val}). 59 | -record(bytevector, {lineno :: scmd_types_impl:lineno(), val}). 60 | -record(character, {lineno :: scmd_types_impl:lineno(), val}). 61 | -record(label, {lineno :: scmd_types_impl:lineno(), val}). 62 | -record(labelref, {lineno :: scmd_types_impl:lineno(), val}). 63 | -record(string, {lineno :: scmd_types_impl:lineno(), val}). 64 | -record(vector, {lineno :: scmd_types_impl:lineno(), val}). 65 | 66 | -record(expander, {defref :: reference(), val}). 67 | -record(mid, {defref :: reference(), val}). % macro identifier 68 | 69 | -record(nip0, {lineno :: scmd_types_impl:lineno(), val}). 70 | -record(nipn, {lineno :: scmd_types_impl:lineno(), val}). 71 | -record(nipv, {lineno :: scmd_types_impl:lineno(), val}). 72 | -record(nipnv, {lineno :: scmd_types_impl:lineno(), val}). 73 | 74 | -record(xnip0, {lineno :: scmd_types_impl:lineno(), val}). 75 | -record(xnipn, {lineno :: scmd_types_impl:lineno(), val}). 76 | -record(xnipv, {lineno :: scmd_types_impl:lineno(), val}). 77 | -record(xnipnv, {lineno :: scmd_types_impl:lineno(), val}). 78 | 79 | -record(lip0, {lineno :: scmd_types_impl:lineno(), val}). 80 | -record(lipn, {lineno :: scmd_types_impl:lineno(), val}). 81 | -record(lipv, {lineno :: scmd_types_impl:lineno(), val}). 82 | -record(lipnv, {lineno :: scmd_types_impl:lineno(), val}). 83 | 84 | -record(error_file, {lineno :: scmd_types_impl:lineno(), val}). 85 | -record(error_read, {lineno :: scmd_types_impl:lineno(), val}). 86 | -record(error_user, {lineno :: scmd_types_impl:lineno(), val}). 87 | 88 | -record(exception, {lineno :: scmd_types_impl:lineno(), val}). 89 | -record(cexception, {lineno :: scmd_types_impl:lineno(), val}). 90 | 91 | -endif. % -ifndef(scmd). 92 | -------------------------------------------------------------------------------- /src/scmi.hrl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | -ifndef(scmi). 24 | -define(scmi, true). 25 | 26 | -include("scm.hrl"). 27 | -include("scmi_types.hrl"). 28 | 29 | -endif. % -ifndef(scmi). 30 | -------------------------------------------------------------------------------- /src/scmi_eval.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme interpreter expression evaluator 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(scmi_eval). 27 | 28 | %% External exports 29 | -export([eval/1 30 | , eval/2 31 | , eval/3 32 | , eval/4 33 | , exec/1 34 | , exec/2 35 | , exec/3 36 | , exec/4 37 | , default_ok/2 38 | , default_ng/1 39 | ]). 40 | 41 | -include("scmi.hrl"). 42 | 43 | %%%---------------------------------------------------------------------- 44 | %%% Types/Specs/Records 45 | %%%---------------------------------------------------------------------- 46 | 47 | %%%---------------------------------------------------------------------- 48 | %%% API 49 | %%%---------------------------------------------------------------------- 50 | 51 | -spec eval(scmi_exp()) -> scmi_exp(). 52 | eval(Exp) -> 53 | exec(scmi_analyze:analyze(Exp)). 54 | 55 | -spec eval(scmi_exp(), scmi_denv()) -> scmi_exp(). 56 | eval(Exp, Env) -> 57 | exec(scmi_analyze:analyze(Exp), Env). 58 | 59 | -spec eval(scmi_exp(), scmi_denv(), scmi_dok()) -> scmi_exp(). 60 | eval(Exp, Env, Ok) -> 61 | exec(scmi_analyze:analyze(Exp), Env, Ok). 62 | 63 | -spec eval(scmi_exp(), scmi_denv(), scmi_dok(), scmi_dng()) -> scmi_exp(). 64 | eval(Exp, Env, Ok, Ng) -> 65 | exec(scmi_analyze:analyze(Exp), Env, Ok, Ng). 66 | 67 | -spec exec(scmi_dexec()) -> scmi_exp(). 68 | exec(Exec) -> 69 | exec(Exec, scmi_env:the_empty()). 70 | 71 | -spec exec(scmi_dexec(), scmi_denv()) -> scmi_exp(). 72 | exec(Exec, Env) -> 73 | exec(Exec, Env, fun default_ok/2). 74 | 75 | -spec exec(scmi_dexec(), scmi_denv(), scmi_dok()) -> scmi_exp(). 76 | exec(Exec, Env, Ok) -> 77 | exec(Exec, Env, Ok, fun default_ng/1). 78 | 79 | -spec exec(scmi_dexec(), scmi_denv(), scmi_dok(), scmi_dng()) -> scmi_exp(). 80 | exec(Exec, Env, Ok, Ng) -> 81 | Exec(Env, Ok, Ng). 82 | 83 | -spec default_ok(scmi_exp(), scmi_dng()) -> scmi_exp(). 84 | default_ok(Value, _Ng) -> 85 | Value. 86 | 87 | -spec default_ng(scmi_exp()) -> no_return(). 88 | default_ng(Error) -> 89 | erlang:error(scm_exception, [Error]). 90 | 91 | %%%---------------------------------------------------------------------- 92 | %%% Internal functions 93 | %%%---------------------------------------------------------------------- 94 | -------------------------------------------------------------------------------- /src/scmi_iodev_server_std_test.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme interpreter i/o device stdio and stderr test server 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(scmi_iodev_server_std_test). 27 | 28 | %% External exports 29 | -export[test_server/1]. 30 | 31 | %%%---------------------------------------------------------------------- 32 | %%% Types/Specs/Records 33 | %%%---------------------------------------------------------------------- 34 | 35 | %%%---------------------------------------------------------------------- 36 | %%% API 37 | %%%---------------------------------------------------------------------- 38 | 39 | test_server(Parent) -> 40 | test_server(Parent, []). 41 | 42 | %%%---------------------------------------------------------------------- 43 | %%% Internal functions 44 | %%%---------------------------------------------------------------------- 45 | 46 | test_server(Parent, L) -> 47 | receive 48 | die -> 49 | ok; 50 | {io_request,From,To,{put_chars,_Encoding,Data}}=Msg -> 51 | Reply = {io_reply, To, ok}, 52 | txn(Parent, L, Msg, Reply, From), 53 | test_server(Parent, L ++ to_list(Data)); 54 | {io_request,From,To,{get_chars,_Encoding,'',_N}}=Msg when L==[] -> 55 | Reply = {io_reply, To, eof}, 56 | txn(Parent, L, Msg, Reply, From), 57 | test_server(Parent, L); 58 | {io_request,From,To,{get_chars,_Encoding,'',N}}=Msg -> 59 | Data = lists:sublist(L, 1, N), 60 | Reply = {io_reply, To, Data}, 61 | txn(Parent, L, Msg, Reply, From), 62 | test_server(Parent, lists:nthtail(erlang:min(N,length(L)), L)); 63 | {io_request,From,To,{get_line,_Encoding,''}}=Msg when L==[] -> 64 | Reply = {io_reply, To, eof}, 65 | txn(Parent, L, Msg, Reply, From), 66 | test_server(Parent, L); 67 | {io_request,From,To,{get_line,_Encoding,''}}=Msg -> 68 | {N, Data} = test_read_line(L), 69 | Reply = {io_reply, To, Data}, 70 | txn(Parent, L, Msg, Reply, From), 71 | test_server(Parent, lists:nthtail(erlang:min(N,length(L)), L)); 72 | Msg -> 73 | io:format("Unhandled ~p~n", [Msg]), 74 | erlang:error(unhandled, [Msg]) 75 | end. 76 | 77 | txn(_Parent, _L, _Msg, Reply, From) -> 78 | From ! Reply, 79 | ok. 80 | 81 | to_list(L) when is_list(L) -> 82 | L; 83 | to_list(B) -> 84 | unicode:characters_to_list(B, unicode). 85 | 86 | test_read_line(L) -> 87 | test_read_line(L, 0, []). 88 | 89 | test_read_line([], N, Acc) -> 90 | {N, lists:reverse(Acc)}; 91 | test_read_line([$\r|[$\r|_]=T], N, Acc) -> 92 | test_read_line(T, N+1, Acc); 93 | test_read_line([$\r,$\n|_], N, Acc) -> 94 | {N+2, lists:reverse(Acc)++ "\n"}; 95 | test_read_line([$\r|_], N, Acc) -> 96 | {N+1, lists:reverse(Acc) ++ "\n"}; 97 | test_read_line([$\n|_], N, Acc) -> 98 | {N+1, lists:reverse(Acc) ++ "\n"}; 99 | test_read_line([H|T], N, Acc) -> 100 | test_read_line(T, N+1, [H|Acc]). 101 | -------------------------------------------------------------------------------- /src/scmi_types.hrl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | -ifndef(scmi_types). 24 | -define(scmi_types, true). 25 | 26 | -include("scmd_types.hrl"). 27 | 28 | %% expression 29 | -type scmi_exp() :: scmi_types:exp(). 30 | 31 | %% analyze 32 | -type scmi_sexec() :: scmi_types:sexec(). 33 | -type scmi_senv() :: scmi_types:senv(). 34 | 35 | %% expander 36 | -type scmi_expander() :: scmi_types:expander(). 37 | 38 | %% evaluate 39 | -type scmi_dexec() :: scmi_types:dexec(). 40 | -type scmi_denv() :: scmi_types:denv(). 41 | -type scmi_dok() :: scmi_types:dok(). 42 | -type scmi_dng() :: scmi_types:dng(). 43 | 44 | %% vargs 45 | -type scmi_vargs() :: scmi_types:vargs(). 46 | 47 | %% var 48 | -type scmi_var() :: scmi_types:var(). 49 | 50 | %% thunk and proc 51 | -type scmi_thunk() :: scmi_types:thunk(). 52 | -type scmi_proc() :: scmi_types:proc(). 53 | 54 | %% native implemented procedures 55 | -type scmi_f0() :: scmi_types:f0(). 56 | -type scmi_f() :: scmi_types:f(). 57 | 58 | -type scmi_nip0() :: scmi_types:nip0(). 59 | -type scmi_nipn() :: scmi_types:nipn(). 60 | -type scmi_nipv() :: scmi_types:nipv(). 61 | -type scmi_nipnv() :: scmi_types:nipnv(). 62 | -type scmi_nip() :: scmi_types:nip(). 63 | 64 | %% extended-API native implemented procedures 65 | -type scmi_xf0() :: scmi_types:xf0(). 66 | -type scmi_xf() :: scmi_types:xf(). 67 | 68 | -type scmi_xnip0() :: scmi_types:xnip0(). 69 | -type scmi_xnipn() :: scmi_types:xnipn(). 70 | -type scmi_xnipv() :: scmi_types:xnipv(). 71 | -type scmi_xnipnv() :: scmi_types:xnipnv(). 72 | -type scmi_xnip() :: scmi_types:xnip(). 73 | 74 | %% lambda implemented procedures 75 | -type scmi_l0() :: scmi_types:l0(). 76 | -type scmi_l() :: scmi_types:l(). 77 | 78 | -type scmi_lip0() :: scmi_types:lip0(). 79 | -type scmi_lipn() :: scmi_types:lipn(). 80 | -type scmi_lipv() :: scmi_types:lipv(). 81 | -type scmi_lipnv() :: scmi_types:lipnv(). 82 | -type scmi_lip() :: scmi_types:lip(). 83 | 84 | -record(l0, {body, env, src}). 85 | -record(ln, {params, body, env, src}). 86 | -record(lv, {param, body, env, src}). 87 | -record(lnv, {n, params, body, env, src}). 88 | 89 | %% exception and error 90 | -type scmi_exception() :: scmi_types:exception(). 91 | -type scmi_error() :: scmi_types:error(). 92 | 93 | -record(signal, {obj, env, ok, ng}). 94 | 95 | %% io devices 96 | -type scmi_iodev() :: scmi_types:iodev(). 97 | -type scmi_eof() :: scmi_types:eof(). 98 | 99 | -endif. % -ifndef(scmi_types). 100 | -------------------------------------------------------------------------------- /src/scml.hrl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | -ifndef(scml). 24 | -define(scml, true). 25 | 26 | -include("scm.hrl"). 27 | -include("scmi.hrl"). 28 | 29 | -endif. % -ifndef(scml). 30 | -------------------------------------------------------------------------------- /src/scml_base_boolean.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme base library for booleans 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(scml_base_boolean). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['not'/1 33 | , 'boolean?'/1 34 | , 'boolean=?'/1 35 | ]). 36 | 37 | -include("scml.hrl"). 38 | 39 | %%%=================================================================== 40 | %%% Types/Specs/Records 41 | %%%=================================================================== 42 | 43 | %%%=================================================================== 44 | %%% SCML Exports 45 | %%%=================================================================== 46 | 47 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 48 | '$scml_exports'() -> 49 | [{'not', #nipn{val=fun ?MODULE:'not'/1}} 50 | , {'boolean?', #nipn{val=fun ?MODULE:'boolean?'/1}} 51 | , {'boolean=?', #nipv{val=fun ?MODULE:'boolean=?'/1}} 52 | ]. 53 | 54 | %%%=================================================================== 55 | %%% API 56 | %%%=================================================================== 57 | 58 | %% @doc Returns #t if obj is false, and returns #f otherwise. 59 | -spec 'not'(scm_obj()) -> scm_boolean(). 60 | 'not'(?FALSE) -> 61 | ?TRUE; 62 | 'not'(_) -> 63 | ?FALSE. 64 | 65 | %% @doc Returns #t if obj is either #t or #f, and returns #f 66 | %% otherwise. 67 | -spec 'boolean?'(scm_obj()) -> scm_boolean(). 68 | 'boolean?'(?FALSE) -> 69 | ?TRUE; 70 | 'boolean?'(?TRUE) -> 71 | ?TRUE; 72 | 'boolean?'(_) -> 73 | ?FALSE. 74 | 75 | %% @doc Returns #t if all the arguments are booleans and all are #t or 76 | %% all are #f. 77 | -spec 'boolean=?'([scm_boolean(),...]) -> scm_boolean(). 78 | 'boolean=?'([]) -> 79 | ?TRUE; 80 | 'boolean=?'([?FALSE|Bs]) -> 81 | case lists:all(fun(?FALSE) -> true; (_) -> false end, Bs) of 82 | true -> 83 | ?TRUE; 84 | _ -> 85 | ?FALSE 86 | end; 87 | 'boolean=?'([?TRUE|Bs]) -> 88 | case lists:all(fun(?TRUE) -> true; (_) -> false end, Bs) of 89 | true -> 90 | ?TRUE; 91 | _ -> 92 | ?FALSE 93 | end; 94 | 'boolean=?'(_) -> 95 | ?FALSE. 96 | 97 | %%%=================================================================== 98 | %%% internal helpers 99 | %%%=================================================================== 100 | -------------------------------------------------------------------------------- /src/scml_base_char.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme base library for characters 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_base_char). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['char?'/1 33 | , 'char=?'/1 34 | , 'char?'/1 36 | , 'char<=?'/1 37 | , 'char>=?'/1 38 | , 'char->integer'/1 39 | , 'integer->char'/1 40 | ]). 41 | 42 | -include("scml.hrl"). 43 | 44 | %%%=================================================================== 45 | %%% Types/Specs/Records 46 | %%%=================================================================== 47 | 48 | %%%=================================================================== 49 | %%% SCML Exports 50 | %%%=================================================================== 51 | 52 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 53 | '$scml_exports'() -> 54 | [{'char?', #nipn{val=fun ?MODULE:'char?'/1}} 55 | , {'char=?', #nipv{val=fun ?MODULE:'char=?'/1}} 56 | , {'char?', #nipv{val=fun ?MODULE:'char>?'/1}} 58 | , {'char<=?', #nipv{val=fun ?MODULE:'char<=?'/1}} 59 | , {'char>=?', #nipv{val=fun ?MODULE:'char>=?'/1}} 60 | , {'char->integer', #nipn{val=fun ?MODULE:'char->integer'/1}} 61 | , {'integer->char', #nipn{val=fun ?MODULE:'integer->char'/1}} 62 | ]. 63 | 64 | %%%=================================================================== 65 | %%% API 66 | %%%=================================================================== 67 | 68 | %% @doc Returns #t if obj is a character, otherwise returns #f. 69 | -spec 'char?'(scm_obj()) -> scm_boolean(). 70 | 'char?'(#character{}) -> 71 | ?TRUE; 72 | 'char?'(_) -> 73 | ?FALSE. 74 | 75 | %% @doc Returns #t if all the characters are equal, otherwise returns 76 | %% #f. 77 | -spec 'char=?'([scm_char(),...]) -> scm_boolean(). 78 | 'char=?'(Cs) -> 79 | cmp(Cs, fun(A, B) -> A =:= B end). 80 | 81 | %% @doc Returns #t if all the characters are monotonically increasing, 82 | %% otherwise returns #f. 83 | -spec 'char scm_boolean(). 84 | 'char 85 | cmp(Cs, fun(A, B) -> A < B end). 86 | 87 | %% @doc Returns #t if all the characters are monotonically decreasing, 88 | %% otherwise returns #f. 89 | -spec 'char>?'([scm_char(),...]) -> scm_boolean(). 90 | 'char>?'(Cs) -> 91 | cmp(Cs, fun(A, B) -> A > B end). 92 | 93 | %% @doc Returns #t if all the characters are monotonically 94 | %% non-decreasing, otherwise returns #f. 95 | -spec 'char<=?'([scm_char(),...]) -> scm_boolean(). 96 | 'char<=?'(Cs) -> 97 | cmp(Cs, fun(A, B) -> A =< B end). 98 | 99 | %% @doc Returns #t if all the characters are monotonically 100 | %% non-increasing, otherwise returns #f. 101 | -spec 'char>=?'([scm_char(),...]) -> scm_boolean(). 102 | 'char>=?'(Cs) -> 103 | cmp(Cs, fun(A, B) -> A >= B end). 104 | 105 | %% @doc Returns an exact integer equal to the Unicode scalar value of 106 | %% the given character. 107 | -spec 'char->integer'(scm_char()) -> scm_n(). 108 | 'char->integer'(#character{val=C}) -> 109 | C. 110 | 111 | %% @doc Returns a character equal to the Unicode scalar value of the 112 | %% given exact integer. 113 | -spec 'integer->char'(scm_n()) -> scm_char(). 114 | 'integer->char'(N) -> 115 | [C] = scml:to_unicode([N]), 116 | #character{val=C}. 117 | 118 | %%%=================================================================== 119 | %%% internal helpers 120 | %%%=================================================================== 121 | 122 | cmp([], _Fun) -> 123 | ?TRUE; 124 | cmp([#character{}], _Fun) -> 125 | ?TRUE; 126 | cmp([#character{val=A}, #character{val=B}=S|Ss], Fun) -> 127 | case Fun(A, B) of 128 | true -> 129 | cmp([S|Ss], Fun); 130 | false -> 131 | ?FALSE 132 | end; 133 | cmp(_, _Fun) -> 134 | ?FALSE. 135 | -------------------------------------------------------------------------------- /src/scml_base_system.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme base library for system interface 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(scml_base_system). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export([features/0 33 | ]). 34 | 35 | -include("scml.hrl"). 36 | 37 | %%%=================================================================== 38 | %%% Types/Specs/Records 39 | %%%=================================================================== 40 | 41 | %%%=================================================================== 42 | %%% SCML Exports 43 | %%%=================================================================== 44 | 45 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 46 | '$scml_exports'() -> 47 | [{features, #nip0{val=fun features/0}} 48 | ]. 49 | 50 | %%%=================================================================== 51 | %%% API 52 | %%%=================================================================== 53 | 54 | -spec features() -> [scm_symbol()]. 55 | features() -> 56 | ['r7rs' 57 | %% , 'exact-closed' @TODO v0.7.0 58 | %% , 'exact-complex' @TODO v0.7.0 59 | %% , 'ieee-float' @TODO v0.7.0 60 | , 'full-unicode' 61 | %% , 'ratios' @TODO v0.7.0 62 | ] 63 | ++ [ 'posix' || has_posix() ] 64 | ++ [ 'windows' || has_windows() ] 65 | ++ system_info() 66 | ++ [ 'big-endian' ] 67 | ++ [ ?SCM, ?SCMVSN ]. 68 | 69 | %%%=================================================================== 70 | %%% Internal functions 71 | %%%=================================================================== 72 | 73 | has_posix() -> 74 | case os:type() of 75 | {unix, _} -> 76 | true; 77 | _ -> 78 | false 79 | end. 80 | 81 | has_windows() -> 82 | case os:type() of 83 | {win32, _} -> 84 | true; 85 | _ -> 86 | false 87 | end. 88 | 89 | system_info() -> 90 | {OSFamily, OSName} = os:type(), 91 | OTPRel = erlang:system_info(otp_release), 92 | SysArch = erlang:system_info(system_architecture), 93 | WordSize = integer_to_list(erlang:system_info({wordsize, external}) * 8), 94 | Strs = [OTPRel, SysArch, WordSize] ++ string:tokens(SysArch, "-"), 95 | lists:sort([OSFamily, OSName] ++ [ list_to_atom(Str) || Str <- Strs ]). 96 | -------------------------------------------------------------------------------- /src/scml_complex.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme complex library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_complex). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['make-rectangular'/2 33 | , 'make-polar'/2 34 | , 'real-part'/1 35 | , 'imag-part'/1 36 | , 'magnitude'/1 37 | , 'angle'/1 38 | ]). 39 | 40 | -include("scml.hrl"). 41 | 42 | %%%=================================================================== 43 | %%% Types/Specs/Records 44 | %%%=================================================================== 45 | 46 | %%%=================================================================== 47 | %%% SCML Exports 48 | %%%=================================================================== 49 | 50 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 51 | '$scml_exports'() -> 52 | [{'make-rectangular', #nipn{val=fun ?MODULE:'make-rectangular'/2}} 53 | , {'make-polar', #nipn{val=fun ?MODULE:'make-polar'/2}} 54 | , {'real-part', #nipn{val=fun ?MODULE:'real-part'/1}} 55 | , {'imag-part', #nipn{val=fun ?MODULE:'imag-part'/1}} 56 | , {'magnitude', #nipn{val=fun ?MODULE:'magnitude'/1}} 57 | , {'angle', #nipn{val=fun ?MODULE:'angle'/1}} 58 | ]. 59 | 60 | %%%=================================================================== 61 | %%% API 62 | %%%=================================================================== 63 | 64 | -spec 'make-rectangular'(scm_x(), scm_x()) -> scm_z(). 65 | 'make-rectangular'(X1, X2) -> 66 | %% @TODO 67 | erlang:error({roadmap,'v0.7.0'}, [X1, X2]). 68 | 69 | -spec 'make-polar'(scm_x(), scm_x()) -> scm_z(). 70 | 'make-polar'(X1, X2) -> 71 | %% @TODO 72 | erlang:error({roadmap,'v0.7.0'}, [X1, X2]). 73 | 74 | -spec 'real-part'(scm_z()) -> scm_x(). 75 | 'real-part'(Z) -> 76 | %% @TODO 77 | erlang:error({roadmap,'v0.7.0'}, [Z]). 78 | 79 | -spec 'imag-part'(scm_z()) -> scm_x(). 80 | 'imag-part'(Z) -> 81 | %% @TODO 82 | erlang:error({roadmap,'v0.7.0'}, [Z]). 83 | 84 | -spec 'magnitude'(scm_z()) -> scm_x(). 85 | 'magnitude'(Z) -> 86 | %% @TODO 87 | erlang:error({roadmap,'v0.7.0'}, [Z]). 88 | 89 | -spec 'angle'(scm_z()) -> scm_x(). 90 | 'angle'(Z) -> 91 | %% @TODO 92 | erlang:error({roadmap,'v0.7.0'}, [Z]). 93 | 94 | %%%=================================================================== 95 | %%% internal helpers 96 | %%%=================================================================== 97 | -------------------------------------------------------------------------------- /src/scml_context.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme process-context library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_context). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['command-line'/0 33 | , 'exit'/0 34 | , 'exit'/1 35 | , 'emergency-exit'/0 36 | , 'emergency-exit'/1 37 | , 'get-environment-variable'/1 38 | , 'get-environment-variables'/0 39 | ]). 40 | 41 | -include("scml.hrl"). 42 | 43 | %%%=================================================================== 44 | %%% Types/Specs/Records 45 | %%%=================================================================== 46 | 47 | %%%=================================================================== 48 | %%% SCML Exports 49 | %%%=================================================================== 50 | 51 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 52 | '$scml_exports'() -> 53 | [{'command-line', #nip0{val=fun ?MODULE:'command-line'/0}} 54 | , {'exit', #nipn{val=[fun ?MODULE:'exit'/0, fun ?MODULE:'exit'/1]}} 55 | , {'emergency-exit', #nipn{val=[fun ?MODULE:'emergency-exit'/0, fun ?MODULE:'emergency-exit'/1]}} 56 | , {'get-environment-variable', #nipn{val=fun ?MODULE:'get-environment-variable'/1}} 57 | , {'get-environment-variables', #nip0{val=fun ?MODULE:'get-environment-variables'/0}} 58 | ]. 59 | 60 | %%%=================================================================== 61 | %%% API 62 | %%%=================================================================== 63 | 64 | -spec 'command-line'() -> [scm_string(),...]. 65 | 'command-line'() -> 66 | %% @TODO 67 | erlang:error({roadmap,'v0.6.0'}, []). 68 | 69 | -spec 'exit'() -> no_return(). 70 | 'exit'() -> 71 | %% @TODO 72 | erlang:error({roadmap,'v0.6.0'}, []). 73 | 74 | -spec 'exit'(scm_obj()) -> no_return(). 75 | 'exit'(Obj) -> 76 | %% @TODO 77 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 78 | 79 | -spec 'emergency-exit'() -> no_return(). 80 | 'emergency-exit'() -> 81 | %% @TODO 82 | erlang:error({roadmap,'v0.6.0'}, []). 83 | 84 | -spec 'emergency-exit'(scm_obj()) -> no_return(). 85 | 'emergency-exit'(Obj) -> 86 | %% @TODO 87 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 88 | 89 | -spec 'get-environment-variable'(scm_string()) -> scm_string() | scm_false(). 90 | 'get-environment-variable'(S) -> 91 | %% @TODO 92 | erlang:error({roadmap,'v0.6.0'}, [S]). 93 | 94 | -spec 'get-environment-variables'() -> [[scm_string()|scm_string()]]. 95 | 'get-environment-variables'() -> 96 | %% @TODO 97 | erlang:error({roadmap,'v0.6.0'}, []). 98 | 99 | %%%=================================================================== 100 | %%% internal helpers 101 | %%%=================================================================== 102 | -------------------------------------------------------------------------------- /src/scml_eval.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme eval library 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(scml_eval). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['environment'/1 33 | , 'eval'/2 34 | ]). 35 | 36 | -include("scml.hrl"). 37 | 38 | %%%=================================================================== 39 | %%% Types/Specs/Records 40 | %%%=================================================================== 41 | 42 | %%%=================================================================== 43 | %%% SCML Exports 44 | %%%=================================================================== 45 | 46 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 47 | '$scml_exports'() -> 48 | [{'environment', #nipv{val=fun ?MODULE:'environment'/1}} 49 | , {'eval', #nipn{val=fun ?MODULE:'eval'/2}} 50 | ]. 51 | 52 | %%%=================================================================== 53 | %%% API 54 | %%%=================================================================== 55 | 56 | -spec 'environment'(scmi_vargs()) -> scmi_denv(). 57 | 'environment'([]) -> 58 | scmi_env:the_empty(); 59 | 'environment'(L) -> 60 | %% @TODO 61 | erlang:error({roadmap,'v0.6.0'}, [L]). 62 | 63 | -spec 'eval'(scm_any(), scmi_denv()) -> scm_any(). 64 | 'eval'(ExprOrDef, Env) -> 65 | scmi_eval:'eval'(ExprOrDef, Env). 66 | 67 | %%%=================================================================== 68 | %%% internal helpers 69 | %%%=================================================================== 70 | -------------------------------------------------------------------------------- /src/scml_file.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme file library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_file). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['call-with-input-file'/2 33 | , 'call-with-output-file'/2 34 | , 'with-input-from-file'/2 35 | , 'with-output-to-file'/2 36 | , 'open-input-file'/1 37 | , 'open-binary-input-file'/1 38 | , 'open-output-file'/1 39 | , 'open-binary-output-file'/1 40 | 41 | , 'file-exists?'/1 42 | , 'delete-file'/1 43 | ]). 44 | 45 | -include("scml.hrl"). 46 | 47 | %%%=================================================================== 48 | %%% Types/Specs/Records 49 | %%%=================================================================== 50 | 51 | %%%=================================================================== 52 | %%% SCML Exports 53 | %%%=================================================================== 54 | 55 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 56 | '$scml_exports'() -> 57 | [{'call-with-input-file', #nipn{val=fun ?MODULE:'call-with-input-file'/2}} 58 | , {'call-with-output-file', #nipn{val=fun ?MODULE:'call-with-output-file'/2}} 59 | , {'with-input-from-file', #nipn{val=fun ?MODULE:'with-input-from-file'/2}} 60 | , {'with-output-to-file', #nipn{val=fun ?MODULE:'with-output-to-file'/2}} 61 | , {'open-input-file', #nipn{val=fun ?MODULE:'open-input-file'/1}} 62 | , {'open-binary-input-file', #nipn{val=fun ?MODULE:'open-binary-input-file'/1}} 63 | , {'open-output-file', #nipn{val=fun ?MODULE:'open-output-file'/1}} 64 | , {'open-binary-output-file', #nipn{val=fun ?MODULE:'open-binary-output-file'/1}} 65 | , {'file-exists?', #nipn{val=fun ?MODULE:'file-exists?'/1}} 66 | , {'delete-file', #nipn{val=fun ?MODULE:'delete-file'/1}} 67 | ]. 68 | 69 | %%%=================================================================== 70 | %%% API 71 | %%%=================================================================== 72 | 73 | -spec 'call-with-input-file'(scm_string(), scm_proc()) -> scm_obj(). 74 | 'call-with-input-file'(S, Proc) -> 75 | %% @TODO 76 | erlang:error({roadmap,'v0.4.0'}, [S, Proc]). 77 | 78 | -spec 'call-with-output-file'(scm_string(), scm_proc()) -> scm_obj(). 79 | 'call-with-output-file'(S, Proc) -> 80 | %% @TODO 81 | erlang:error({roadmap,'v0.4.0'}, [S, Proc]). 82 | 83 | -spec 'with-input-from-file'(scm_string(), scm_thunk()) -> scm_obj(). 84 | 'with-input-from-file'(S, Thunk) -> 85 | %% @TODO 86 | erlang:error({roadmap,'v0.4.0'}, [S, Thunk]). 87 | 88 | -spec 'with-output-to-file'(scm_string(), scm_thunk()) -> scm_obj(). 89 | 'with-output-to-file'(S, Thunk) -> 90 | %% @TODO 91 | erlang:error({roadmap,'v0.4.0'}, [S, Thunk]). 92 | 93 | -spec 'open-input-file'(scm_string()) -> scm_port(). 94 | 'open-input-file'(S) -> 95 | %% @TODO 96 | erlang:error({roadmap,'v0.4.0'}, [S]). 97 | 98 | -spec 'open-binary-input-file'(scm_string()) -> scm_port(). 99 | 'open-binary-input-file'(S) -> 100 | %% @TODO 101 | erlang:error({roadmap,'v0.4.0'}, [S]). 102 | 103 | -spec 'open-output-file'(scm_string()) -> scm_port(). 104 | 'open-output-file'(S) -> 105 | %% @TODO 106 | erlang:error({roadmap,'v0.4.0'}, [S]). 107 | 108 | -spec 'open-binary-output-file'(scm_string()) -> scm_port(). 109 | 'open-binary-output-file'(S) -> 110 | %% @TODO 111 | erlang:error({roadmap,'v0.4.0'}, [S]). 112 | 113 | -spec 'file-exists?'(scm_string()) -> scm_boolean(). 114 | 'file-exists?'(S) -> 115 | %% @TODO 116 | erlang:error({roadmap,'v0.6.0'}, [S]). 117 | 118 | -spec 'delete-file'(scm_string()) -> scm_false(). 119 | 'delete-file'(S) -> 120 | %% @TODO 121 | erlang:error({roadmap,'v0.6.0'}, [S]). 122 | 123 | %%%=================================================================== 124 | %%% internal helpers 125 | %%%=================================================================== 126 | -------------------------------------------------------------------------------- /src/scml_inexact.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme inexact library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_inexact). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['finite?'/1 33 | , 'infinite?'/1 34 | , 'nan?'/1 35 | , 'exp'/1 36 | , 'log'/1, 'log'/2 37 | , 'sin'/1 38 | , 'cos'/1 39 | , 'tan'/1 40 | , 'asin'/1 41 | , 'acos'/1 42 | , 'atan'/1, 'atan'/2 43 | , 'sqrt'/1 44 | ]). 45 | 46 | -include("scml.hrl"). 47 | 48 | %%%=================================================================== 49 | %%% Types/Specs/Records 50 | %%%=================================================================== 51 | 52 | %%%=================================================================== 53 | %%% SCML Exports 54 | %%%=================================================================== 55 | 56 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 57 | '$scml_exports'() -> 58 | [{'finite?', #nipn{val=fun ?MODULE:'finite?'/1}} 59 | , {'infinite?', #nipn{val=fun ?MODULE:'infinite?'/1}} 60 | , {'nan?', #nipn{val=fun ?MODULE:'nan?'/1}} 61 | , {'exp', #nipn{val=fun ?MODULE:'exp'/1}} 62 | , {'log', #nipn{val=[fun ?MODULE:'log'/1, fun ?MODULE:'log'/2]}} 63 | , {'sin', #nipn{val=fun ?MODULE:'sin'/1}} 64 | , {'cos', #nipn{val=fun ?MODULE:'cos'/1}} 65 | , {'tan', #nipn{val=fun ?MODULE:'tan'/1}} 66 | , {'asin', #nipn{val=fun ?MODULE:'asin'/1}} 67 | , {'acos', #nipn{val=fun ?MODULE:'acos'/1}} 68 | , {'atan', #nipn{val=[fun ?MODULE:'atan'/1, fun ?MODULE:'atan'/2]}} 69 | , {'sqrt', #nipn{val=fun ?MODULE:'sqrt'/1}} 70 | ]. 71 | 72 | %%%=================================================================== 73 | %%% API 74 | %%%=================================================================== 75 | 76 | -spec 'finite?'(scm_z()) -> scm_boolean(). 77 | 'finite?'(Z) -> 78 | %% @TODO 79 | erlang:error({roadmap,'v0.7.0'}, [Z]). 80 | 81 | -spec 'infinite?'(scm_z()) -> scm_boolean(). 82 | 'infinite?'(Z) -> 83 | %% @TODO 84 | erlang:error({roadmap,'v0.7.0'}, [Z]). 85 | 86 | -spec 'nan?'(scm_z()) -> scm_boolean(). 87 | 'nan?'(Z) -> 88 | %% @TODO 89 | erlang:error({roadmap,'v0.7.0'}, [Z]). 90 | 91 | -spec 'exp'(scm_z()) -> scm_z(). 92 | 'exp'(Z) -> 93 | %% @TODO 94 | erlang:error({roadmap,'v0.7.0'}, [Z]). 95 | 96 | -spec 'log'(scm_z()) -> scm_z(). 97 | 'log'(Z) -> 98 | %% @TODO 99 | erlang:error({roadmap,'v0.7.0'}, [Z]). 100 | 101 | -spec 'log'(scm_z(), scm_z()) -> scm_z(). 102 | 'log'(Z1, Z2) -> 103 | %% @TODO 104 | erlang:error({roadmap,'v0.7.0'}, [Z1, Z2]). 105 | 106 | -spec 'sin'(scm_z()) -> scm_z(). 107 | 'sin'(Z) -> 108 | %% @TODO 109 | erlang:error({roadmap,'v0.7.0'}, [Z]). 110 | 111 | -spec 'cos'(scm_z()) -> scm_z(). 112 | 'cos'(Z) -> 113 | %% @TODO 114 | erlang:error({roadmap,'v0.7.0'}, [Z]). 115 | 116 | -spec 'tan'(scm_z()) -> scm_z(). 117 | 'tan'(Z) -> 118 | %% @TODO 119 | erlang:error({roadmap,'v0.7.0'}, [Z]). 120 | 121 | -spec 'asin'(scm_z()) -> scm_z(). 122 | 'asin'(Z) -> 123 | %% @TODO 124 | erlang:error({roadmap,'v0.7.0'}, [Z]). 125 | 126 | -spec 'acos'(scm_z()) -> scm_z(). 127 | 'acos'(Z) -> 128 | %% @TODO 129 | erlang:error({roadmap,'v0.7.0'}, [Z]). 130 | 131 | -spec 'atan'(scm_z()) -> scm_z(). 132 | 'atan'(Z) -> 133 | %% @TODO 134 | erlang:error({roadmap,'v0.7.0'}, [Z]). 135 | 136 | -spec 'atan'(scm_y(), scm_x()) -> scm_z(). 137 | 'atan'(Y, X) -> 138 | %% @TODO 139 | erlang:error({roadmap,'v0.7.0'}, [Y, X]). 140 | 141 | -spec 'sqrt'(scm_z()) -> scm_z(). 142 | 'sqrt'(Z) -> 143 | %% @TODO 144 | erlang:error({roadmap,'v0.7.0'}, [Z]). 145 | 146 | %%%=================================================================== 147 | %%% internal helpers 148 | %%%=================================================================== 149 | -------------------------------------------------------------------------------- /src/scml_lambda.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme case-lambda library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_lambda). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['case-lambda'/1 33 | ]). 34 | 35 | -include("scml.hrl"). 36 | 37 | %%%=================================================================== 38 | %%% Types/Specs/Records 39 | %%%=================================================================== 40 | 41 | %%%=================================================================== 42 | %%% SCML Exports 43 | %%%=================================================================== 44 | 45 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 46 | '$scml_exports'() -> 47 | [{'case-lambda', #nipv{val=fun ?MODULE:'case-lambda'/1}} 48 | ]. 49 | 50 | %%%=================================================================== 51 | %%% API 52 | %%%=================================================================== 53 | 54 | -spec 'case-lambda'([scm_obj(),...]) -> scm_obj(). 55 | 'case-lambda'(Exps) -> 56 | %% @TODO 57 | erlang:error({roadmap,'v0.6.0'}, [Exps]). 58 | 59 | %%%=================================================================== 60 | %%% internal helpers 61 | %%%=================================================================== 62 | -------------------------------------------------------------------------------- /src/scml_lazy.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme lazy library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_lazy). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['delay'/1 33 | , 'delay-force'/1 34 | , 'force'/1 35 | , 'promise?'/1 36 | , 'make-promise'/1 37 | ]). 38 | 39 | -include("scml.hrl"). 40 | 41 | %%%=================================================================== 42 | %%% Types/Specs/Records 43 | %%%=================================================================== 44 | 45 | %%%=================================================================== 46 | %%% SCML Exports 47 | %%%=================================================================== 48 | 49 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 50 | '$scml_exports'() -> 51 | [{'delay', #nipv{val=fun ?MODULE:'delay'/1}} 52 | , {'delay-force', #nipv{val=fun ?MODULE:'delay-force'/1}} 53 | , {'force', #nipv{val=fun ?MODULE:'force'/1}} 54 | , {'promise?', #nipv{val=fun ?MODULE:'promise?'/1}} 55 | , {'make-promise', #nipv{val=fun ?MODULE:'make-promise'/1}} 56 | ]. 57 | 58 | %%%=================================================================== 59 | %%% API 60 | %%%=================================================================== 61 | 62 | -spec 'delay'(scm_obj()) -> scm_obj(). 63 | 'delay'(Exp) -> 64 | %% @TODO 65 | erlang:error({roadmap,'v0.6.0'}, [Exp]). 66 | 67 | -spec 'delay-force'(scm_obj()) -> scm_obj(). 68 | 'delay-force'(Exp) -> 69 | %% @TODO 70 | erlang:error({roadmap,'v0.6.0'}, [Exp]). 71 | 72 | -spec 'force'(scm_obj()) -> scm_obj(). 73 | 'force'(Promise) -> 74 | %% @TODO 75 | erlang:error({roadmap,'v0.6.0'}, [Promise]). 76 | 77 | -spec 'promise?'(scm_obj()) -> scm_boolean(). 78 | 'promise?'(Obj) -> 79 | %% @TODO 80 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 81 | 82 | -spec 'make-promise'(scm_obj()) -> scm_obj(). 83 | 'make-promise'(Obj) -> 84 | %% @TODO 85 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 86 | 87 | %%%=================================================================== 88 | %%% internal helpers 89 | %%%=================================================================== 90 | -------------------------------------------------------------------------------- /src/scml_load.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme load library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_load). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['load'/1 33 | , 'load'/2 34 | ]). 35 | 36 | -include("scml.hrl"). 37 | 38 | %%%=================================================================== 39 | %%% Types/Specs/Records 40 | %%%=================================================================== 41 | 42 | %%%=================================================================== 43 | %%% SCML Exports 44 | %%%=================================================================== 45 | 46 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 47 | '$scml_exports'() -> 48 | [{'load', #nipn{val=[fun ?MODULE:'load'/1, fun ?MODULE:'load'/2]}} 49 | ]. 50 | 51 | %%%=================================================================== 52 | %%% API 53 | %%%=================================================================== 54 | 55 | -spec 'load'(scm_string()) -> scm_false(). 56 | 'load'(S) -> 57 | %% @TODO 58 | erlang:error({roadmap,'v0.6.0'}, [S]). 59 | 60 | -spec 'load'(scm_string(), scmi_denv()) -> scm_false(). 61 | 'load'(S, Env) -> 62 | %% @TODO 63 | erlang:error({roadmap,'v0.6.0'}, [S, Env]). 64 | 65 | %%%=================================================================== 66 | %%% internal helpers 67 | %%%=================================================================== 68 | -------------------------------------------------------------------------------- /src/scml_read.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme read library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_read). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['read'/0 33 | , 'read'/1 34 | ]). 35 | 36 | -include("scml.hrl"). 37 | 38 | %%%=================================================================== 39 | %%% Types/Specs/Records 40 | %%%=================================================================== 41 | 42 | %%%=================================================================== 43 | %%% SCML Exports 44 | %%%=================================================================== 45 | 46 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 47 | '$scml_exports'() -> 48 | [{'read', #nipn{val=[fun ?MODULE:'read'/0, fun ?MODULE:'read'/1]}} 49 | ]. 50 | 51 | %%%=================================================================== 52 | %%% API 53 | %%%=================================================================== 54 | 55 | -spec 'read'() -> scm_obj() | scm_eof(). 56 | 'read'() -> 57 | %% @TODO 58 | erlang:error({roadmap,'v0.6.0'}, []). 59 | 60 | -spec 'read'(scm_port()) -> scm_obj() | scm_eof(). 61 | 'read'(Port) -> 62 | %% @TODO 63 | erlang:error({roadmap,'v0.6.0'}, [Port]). 64 | 65 | %%%=================================================================== 66 | %%% internal helpers 67 | %%%=================================================================== 68 | -------------------------------------------------------------------------------- /src/scml_repl.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme repl library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_repl). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['interaction-environment'/0 33 | ]). 34 | 35 | -include("scml.hrl"). 36 | 37 | %%%=================================================================== 38 | %%% Types/Specs/Records 39 | %%%=================================================================== 40 | 41 | %%%=================================================================== 42 | %%% SCML Exports 43 | %%%=================================================================== 44 | 45 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 46 | '$scml_exports'() -> 47 | [{'interaction-environment', #nip0{val=fun ?MODULE:'interaction-environment'/0}} 48 | ]. 49 | 50 | %%%=================================================================== 51 | %%% API 52 | %%%=================================================================== 53 | 54 | -spec 'interaction-environment'() -> scmi_denv(). 55 | 'interaction-environment'() -> 56 | erlang:error({roadmap,'v0.6.0'}, []). 57 | 58 | %%%=================================================================== 59 | %%% internal helpers 60 | %%%=================================================================== 61 | -------------------------------------------------------------------------------- /src/scml_time.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme time library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_time). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['current-second'/0 33 | , 'current-jiffy'/0 34 | , 'jiffies-per-second'/0 35 | ]). 36 | 37 | -include("scml.hrl"). 38 | 39 | %%%=================================================================== 40 | %%% Types/Specs/Records 41 | %%%=================================================================== 42 | 43 | %%%=================================================================== 44 | %%% SCML Exports 45 | %%%=================================================================== 46 | 47 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 48 | '$scml_exports'() -> 49 | [{'current-second', #nip0{val=fun ?MODULE:'current-second'/0}} 50 | , {'current-jiffy', #nip0{val=fun ?MODULE:'current-jiffy'/0}} 51 | , {'jiffies-per-second', #nip0{val=fun ?MODULE:'jiffies-per-second'/0}} 52 | ]. 53 | 54 | %%%=================================================================== 55 | %%% API 56 | %%%=================================================================== 57 | 58 | -spec 'current-second'() -> scm_x(). 59 | 'current-second'() -> 60 | %% @TODO 61 | erlang:error({roadmap,'v0.6.0'}, []). 62 | 63 | -spec 'current-jiffy'() -> scm_k(). 64 | 'current-jiffy'() -> 65 | %% @TODO 66 | erlang:error({roadmap,'v0.6.0'}, []). 67 | 68 | -spec 'jiffies-per-second'() -> scm_k(). 69 | 'jiffies-per-second'() -> 70 | %% @TODO 71 | erlang:error({roadmap,'v0.6.0'}, []). 72 | 73 | %%%=================================================================== 74 | %%% internal helpers 75 | %%%=================================================================== 76 | -------------------------------------------------------------------------------- /src/scml_write.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Scheme write library 24 | %%% @author CSCM Contributor 25 | 26 | -module(scml_write). 27 | 28 | %% SCML Exports 29 | -export(['$scml_exports'/0]). 30 | 31 | %% API 32 | -export(['write'/1 33 | , 'write'/2 34 | , 'write-shared'/1 35 | , 'write-shared'/2 36 | , 'write-simple'/1 37 | , 'write-simple'/2 38 | , 'display'/1 39 | , 'display'/2 40 | ]). 41 | 42 | -include("scml.hrl"). 43 | 44 | %%%=================================================================== 45 | %%% Types/Specs/Records 46 | %%%=================================================================== 47 | 48 | %%%=================================================================== 49 | %%% SCML Exports 50 | %%%=================================================================== 51 | 52 | -spec '$scml_exports'() -> [{scm_symbol(), scmi_nip()}]. 53 | '$scml_exports'() -> 54 | [{'write', #nipn{val=[fun ?MODULE:'write'/1, fun ?MODULE:'write'/2]}} 55 | , {'write-shared', #nipn{val=[fun ?MODULE:'write-shared'/1, fun ?MODULE:'write-shared'/2]}} 56 | , {'write-simple', #nipn{val=[fun ?MODULE:'write-simple'/1, fun ?MODULE:'write-simple'/2]}} 57 | , {'display', #nipn{val=[fun ?MODULE:'display'/1, fun ?MODULE:'display'/2]}} 58 | ]. 59 | 60 | %%%=================================================================== 61 | %%% API 62 | %%%=================================================================== 63 | 64 | -spec 'write'(scm_obj()) -> scm_false(). 65 | 'write'(Obj) -> 66 | %% @TODO 67 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 68 | 69 | -spec 'write'(scm_obj(), scm_port()) -> scm_false(). 70 | 'write'(Obj, Port) -> 71 | %% @TODO 72 | erlang:error({roadmap,'v0.6.0'}, [Obj, Port]). 73 | 74 | -spec 'write-shared'(scm_obj()) -> scm_false(). 75 | 'write-shared'(Obj) -> 76 | %% @TODO 77 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 78 | 79 | -spec 'write-shared'(scm_obj(), scm_port()) -> scm_false(). 80 | 'write-shared'(Obj, Port) -> 81 | %% @TODO 82 | erlang:error({roadmap,'v0.6.0'}, [Obj, Port]). 83 | 84 | -spec 'write-simple'(scm_obj()) -> scm_false(). 85 | 'write-simple'(Obj) -> 86 | %% @TODO 87 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 88 | 89 | -spec 'write-simple'(scm_obj(), scm_port()) -> scm_false(). 90 | 'write-simple'(Obj, Port) -> 91 | %% @TODO 92 | erlang:error({roadmap,'v0.6.0'}, [Obj, Port]). 93 | 94 | -spec 'display'(scm_obj()) -> scm_false(). 95 | 'display'(Obj) -> 96 | %% @TODO 97 | erlang:error({roadmap,'v0.6.0'}, [Obj]). 98 | 99 | -spec 'display'(scm_obj(), scm_port()) -> scm_false(). 100 | 'display'(Obj, Port) -> 101 | %% @TODO 102 | erlang:error({roadmap,'v0.6.0'}, [Obj, Port]). 103 | 104 | %%%=================================================================== 105 | %%% internal helpers 106 | %%%=================================================================== 107 | -------------------------------------------------------------------------------- /src/scmtmp.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc This module contains functions that are not yet implemented 24 | %%% or temporary in nature. These functions will be deprecated or 25 | %%% moved to other modules in a future release. 26 | %%% @author Joseph Wayne Norton 27 | 28 | -module(scmtmp). 29 | 30 | %% External exports 31 | -export(['exact'/2 32 | , 'inexact'/2 33 | , 'make-rational'/2 34 | , 'make-rational'/3 35 | , 'make-real'/2 36 | , 'make-polar'/3 37 | , 'make-rectangular'/3 38 | ]). 39 | 40 | -include("scml.hrl"). 41 | 42 | %%%---------------------------------------------------------------------- 43 | %%% Types/Specs/Records 44 | %%%---------------------------------------------------------------------- 45 | 46 | %%%---------------------------------------------------------------------- 47 | %%% API 48 | %%%---------------------------------------------------------------------- 49 | 50 | %% @doc This function is a temporary place holder 51 | -spec exact(scm_x(), scmi_denv()) -> scm_x(). 52 | exact(X, _Env) -> 53 | X. 54 | 55 | %% @doc This function is a temporary place holder 56 | -spec inexact(scm_x(), scmi_denv()) -> scm_x(). 57 | inexact(X, _Env) -> 58 | X. 59 | 60 | %% @doc This function is a temporary place holder 61 | -spec 'make-rational'(scm_x(), scmi_denv()) -> scm_q(). 62 | 'make-rational'({N, D}, Env) when erlang:is_number(N), erlang:is_number(D) -> 63 | 'make-rational'(N, D, Env); 64 | 'make-rational'(X, _Env) -> 65 | {X, 1}. 66 | 67 | %% @doc This function is a temporary place holder 68 | -spec 'make-rational'(scm_n(), scm_k(), scmi_denv()) -> scm_q(). 69 | 'make-rational'(0, 0, Env) -> 70 | 'make-rational'(0, Env); 71 | 'make-rational'(N, D, _Env) -> 72 | {N, D}. 73 | 74 | %% @doc This function is a temporary place holder 75 | -spec 'make-real'(scm_x() | {scm_n(), scm_n()}, scmi_denv()) -> scm_x(). 76 | 'make-real'(?PINF, _Env) -> 77 | ?PINF; 78 | 'make-real'(?NINF, _Env) -> 79 | ?NINF; 80 | 'make-real'(?PNAN, _Env) -> 81 | ?PNAN; 82 | 'make-real'(?NNAN, _Env) -> 83 | ?NNAN; 84 | 'make-real'(?NZER, _Env) -> 85 | ?NZER; 86 | 'make-real'({0, 0}, _Env) -> 87 | 0; 88 | 'make-real'({N, D}, _Env) when N==0, D==0 -> 89 | ?PNAN; 90 | 'make-real'({N, D}, _Env) when N < 0, D==0 -> 91 | ?NINF; 92 | 'make-real'({N, D}, _Env) when N > 0, D==0 -> 93 | ?PINF; 94 | 'make-real'({N, _D}, _Env) when N==0 -> 95 | N; 96 | 'make-real'({N, 1}, _Env) when erlang:is_integer(N) -> 97 | N; 98 | 'make-real'({N, D}, _Env) -> 99 | N / D; 100 | 'make-real'(X, _Env) when erlang:is_number(X) -> 101 | X. 102 | 103 | %% @doc This function is a temporary place holder 104 | -spec 'make-polar'(scm_x(), scm_y(), scmi_denv()) -> scm_z(). 105 | 'make-polar'(X, Y, _Env) -> 106 | {polar, {X, Y}}. 107 | 108 | %% @doc This function is a temporary place holder 109 | -spec 'make-rectangular'(scm_x(), scm_y(), scmi_denv()) -> scm_z(). 110 | 'make-rectangular'(X, Y, _Env) -> 111 | {rectangular, {X, Y}}. 112 | 113 | %%%---------------------------------------------------------------------- 114 | %%% Internal functions 115 | %%%---------------------------------------------------------------------- 116 | -------------------------------------------------------------------------------- /src/xfm_import_as_export.erl: -------------------------------------------------------------------------------- 1 | %%% The MIT License 2 | %%% 3 | %%% Copyright (C) 2013-2014 by Joseph Wayne Norton 4 | %%% 5 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 6 | %%% of this software and associated documentation files (the "Software"), to deal 7 | %%% in the Software without restriction, including without limitation the rights 8 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | %%% copies of the Software, and to permit persons to whom the Software is 10 | %%% furnished to do so, subject to the following conditions: 11 | %%% 12 | %%% The above copyright notice and this permission notice shall be included in 13 | %%% all copies or substantial portions of the Software. 14 | %%% 15 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | %%% THE SOFTWARE. 22 | 23 | %%% @doc Parse transform to export function imports 24 | %%% @author Joseph Wayne Norton 25 | 26 | -module(xfm_import_as_export). 27 | 28 | %% API 29 | -export([parse_transform/2]). 30 | 31 | %%%=================================================================== 32 | %%% Types 33 | %%%=================================================================== 34 | 35 | %%%=================================================================== 36 | %%% API 37 | %%%=================================================================== 38 | 39 | parse_transform(Forms, _Options) -> 40 | forms(Forms). 41 | 42 | %%%=================================================================== 43 | %%% Internal functions 44 | %%%=================================================================== 45 | 46 | forms(L) -> 47 | forms(L, []). 48 | 49 | forms([{attribute,Ln,import_as_export,{Module,Imports}=H}|T], Acc) when is_atom(Module), is_list(Imports) -> 50 | %% replace import_as_export with export 51 | Attr = {attribute,Ln,export,Imports}, 52 | [Attr|forms(T, [H|Acc])]; 53 | forms([{eof,Ln}|_], Acc) -> 54 | forms(Ln, Acc, [{eof,Ln}]); 55 | forms([H|T], Acc) -> 56 | [H|forms(T, Acc)]. 57 | 58 | forms(Ln, [{Module,Imports}|T], Acc) -> 59 | forms(Ln, T, [import_as_export(Ln, Module, Imports)|Acc]); 60 | forms(_Ln, [], Acc) -> 61 | lists:flatten(Acc). 62 | 63 | import_as_export(Ln, Module, Imports) -> 64 | [ import_as_export(Ln, Module, Name, Arity) || {Name,Arity} <- Imports ]. 65 | 66 | import_as_export(Ln, Module, Name, Arity) when is_atom(Module), is_atom(Name), is_integer(Arity) -> 67 | Vars = [{var,Ln,integer_to_var(V)} || V <- lists:seq(1,Arity)], 68 | Body = {call,Ln,{remote,Ln,{atom,Ln,Module},{atom,Ln,Name}},Vars}, 69 | {function,Ln,Name,Arity,[{clause,Ln,Vars,[],[Body]}]}. 70 | 71 | integer_to_var(X) -> 72 | list_to_atom([$V|integer_to_list(X)]). 73 | --------------------------------------------------------------------------------