diff --git a/LICENSE b/LICENSE index 825749bf..5a0535c0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018 Calvin Rose +Copyright (c) 2019 Calvin Rose Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 906a45b2..ac81592b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The language also bridging bridging to native code written in C, meta-programmin There is a repl for trying out the language, as well as the ability to run script files. This client program is separate from the core runtime, so -janet could be embedded into other programs. Try janet in your browser at +janet could be embedded into other programs. Try janet in your browser at [https://janet-lang.org](https://janet-lang.org). # @@ -51,7 +51,7 @@ Janet makes a good system scripting language, or a language to embed in other pr ## Documentation -Documentation can be found in the doc directory of +Documentation can be found in the doc directory of the repository. There is an introduction section contains a good overview of the language. @@ -66,7 +66,7 @@ documentation for the core library. For example, (doc doc) ``` Shows documentation for the doc macro. - + To get a list of all bindings in the default environment, use the `(all-symbols)` function. diff --git a/ctest/array_test.c b/ctest/array_test.c index f42d591a..656e51ad 100644 --- a/ctest/array_test.c +++ b/ctest/array_test.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -24,7 +24,7 @@ #include int main() { - + int i; JanetArray *array1, *array2; diff --git a/ctest/buffer_test.c b/ctest/buffer_test.c index 76514da5..2275a0aa 100644 --- a/ctest/buffer_test.c +++ b/ctest/buffer_test.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -24,7 +24,7 @@ #include int main() { - + int i; JanetBuffer *buffer1, *buffer2; diff --git a/ctest/number_test.c b/ctest/number_test.c index 018fab92..5a682274 100644 --- a/ctest/number_test.c +++ b/ctest/number_test.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -27,7 +27,7 @@ /* Check a subset of numbers against system implementation. * Note that this depends on the system implementation being correct, - * which may not be the case for old or non complient systems. Also, + * which may not be the case for old or non compliant systems. Also, * we cannot check against bases other 10. */ /* Compare valid c numbers to system implementation. */ @@ -42,7 +42,7 @@ static void test_valid_str(const char *str) { } int main() { - + janet_init(); test_valid_str("1.0"); diff --git a/ctest/system_test.c b/ctest/system_test.c index 591574b8..337cc1e2 100644 --- a/ctest/system_test.c +++ b/ctest/system_test.c @@ -1,4 +1,3 @@ - /* * Copyright (c) 2018 Calvin Rose * diff --git a/ctest/table_test.c b/ctest/table_test.c index fe636e85..fad51830 100644 --- a/ctest/table_test.c +++ b/ctest/table_test.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -24,7 +24,7 @@ #include int main() { - + JanetTable *t1, *t2; janet_init(); @@ -39,7 +39,7 @@ int main() { assert(t1->count == 4); assert(t1->capacity >= t1->count); - + assert(janet_equals(janet_table_get(t1, janet_cstringv("hello")), janet_wrap_integer(2))); assert(janet_equals(janet_table_get(t1, janet_cstringv("akey")), janet_wrap_integer(5))); assert(janet_equals(janet_table_get(t1, janet_cstringv("box")), janet_wrap_boolean(0))); diff --git a/doc/Home.md b/doc/Home.md index 73d44a68..34c486e8 100644 --- a/doc/Home.md +++ b/doc/Home.md @@ -2,5 +2,5 @@ Janet is a dynamic, lightweight programming language with strong functional capabilities as well as support for imperative programming. It to be used for short lived scripts as well as for building real programs. It can also be extended with native code (C modules) for better performance and interfacing with -existing software. Janet takes ideas from Lua, Scheme, Racket, Clojure, Smalltalk, Erlang, Arc, and +existing software. Janet takes ideas from Lua, Scheme, Racket, Clojure, Smalltalk, Erlang, Arc, and a whole bunch of other dynamic languages. diff --git a/doc/Introduction.md b/doc/Introduction.md index 1b85e4c7..5944665c 100644 --- a/doc/Introduction.md +++ b/doc/Introduction.md @@ -63,11 +63,11 @@ notation with a radix besides 10, use the `&` symbol to indicate the exponent ra ## Arithmetic Functions Besides the 5 main arithmetic functions, janet also supports a number of math functions -taken from the C library ``, as well as bitwise operators that behave like they +taken from the C library ``, as well as bit-wise operators that behave like they do in C or Java. Functions like `math/sin`, `math/cos`, `math/log`, and `math/exp` will behave as expected to a C programmer. They all take either 1 or 2 numeric arguments and -return a real number (never an integer!) Bitwise functions are all prefixed with b. -Thet are `bnot`, `bor`, `bxor`, `band`, `blshift`, `brshift`, and `brushift`. Bitwise +return a real number (never an integer!) Bit-wise functions are all prefixed with b. +They are `bnot`, `bor`, `bxor`, `band`, `blshift`, `brshift`, and `brushift`. Bit-wise functions only work on integers. # Strings, Keywords and Symbols @@ -321,16 +321,16 @@ there relationship to each other. | ---------- | ------- | --------------- | | Indexed | Array | Tuple | | Dictionary | Table | Struct | -| Byteseq | Buffer | String (Symbol) | +| Bytes | Buffer | String | Indexed types are linear lists of elements than can be accessed in constant time with an integer index. Indexed types are backed by a single chunk of memory for fast access, and are indexed from 0 as in C. Dictionary types associate keys with values. The difference between dictionaries and indexed types is that dictionaries are not limited to integer keys. They are backed by a hashtable and also offer constant time lookup (and insertion for the mutable case). -Finally, the 'byteseq' abstraction is any type that contains a sequence of bytes. A byteseq associates +Finally, the 'bytes' abstraction is any type that contains a sequence of bytes. A 'bytes' value or byteseq associates integer keys (the indices) with integer values between 0 and 255 (the byte values). In this way, -they behave much like Arrays and Tuples. However, one cannot put non integer values into a byteseq. +they behave much like Arrays and Tuples. However, one cannot put non integer values into a byteseq ```lisp (def mytuple (tuple 1 2 3)) @@ -544,7 +544,7 @@ control is returned to the calling fiber. The parent fiber must then check what fiber is in to differentiate errors from return values from user defined signals. To create a fiber, user the `fiber/new` function. The fiber constructor take one or two arguments. -the first, necessary argument is the function that the fiber will execute. This function must accept +The first, necessary argument is the function that the fiber will execute. This function must accept an arity of zero. The next optional argument is a collection of flags checking what kinds of signals to trap and return via `resume`. This is useful so the programmer does not need to handle all different kinds of signals from a fiber. Any un-trapped signals @@ -639,7 +639,7 @@ using janet's builtin quasiquoting facilities. ``` This is functionally identical to our previous version `defn2`, but written in such -a way that the macro output is more clear. The leading backtick is shorthand for the +a way that the macro output is more clear. The leading tilde `~` is shorthand for the `(quasiquote x)` special form, which is like `(quote x)` except we can unquote expressions inside it. The comma in front of `name` and `args` is an unquote, which allows us to put a value in the quasiquote. Without the unquote, the symbol \'name\' @@ -720,7 +720,7 @@ to be 10. The problem is the reuse of the symbol x inside the macro, which overs binding. Janet provides a general solution to this problem in terms of the `(gensym)` function, which returns -a symbol which is guarenteed to be unique and not collide with any symbols defined previously. We can define +a symbol which is guaranteed to be unique and not collide with any symbols defined previously. We can define our macro once more for a fully correct macro. ```lisp diff --git a/doc/Parser.md b/doc/Parser.md index d55eeb12..edd09c44 100644 --- a/doc/Parser.md +++ b/doc/Parser.md @@ -33,7 +33,7 @@ false Janet symbols are represented a sequence of alphanumeric characters not starting with a digit or a colon. They can also contain the characters \!, @, $, \%, \^, \&, \*, -, \_, +, =, \|, \~, :, \<, \>, ., \?, \\, /, as -well as any Unicode codepoint not in the ascii range. +well as any Unicode codepoint not in the ASCII range. By convention, most symbols should be all lower case and use dashes to connect words (sometimes called kebab case). @@ -120,7 +120,7 @@ delimited string. A string can also be define to start with a certain number of backquotes, and will end the same number of backquotes. Long strings do not contain escape sequences; all bytes will be parsed literally until ending delimiter is found. This is useful -for definining multiline strings with literal newline characters, unprintable +for defining multi-line strings with literal newline characters, unprintable characters, or strings that would otherwise require many escape sequences. ``` @@ -155,7 +155,7 @@ the buffer must be prefixed with the '@' character. Tuples are a sequence of white space separated values surrounded by either parentheses or brackets. The parser considers any of the characters ASCII 32, \\0, \\f, \\n, \\r or \\t -to be whitespace. +to be white-space. ``` (do 1 2 3) @@ -173,7 +173,7 @@ Arrays are the same as tuples, but have a leading @ to indicate mutability. ## Structs -Structs are represented by a sequence of whitespace delimited key value pairs +Structs are represented by a sequence of white-space delimited key value pairs surrounded by curly braces. The sequence is defined as key1, value1, key2, value2, etc. There must be an even number of items between curly braces or the parser will signal a parse error. Any value can be a key or value. Using nil as a key or @@ -202,10 +202,9 @@ that they are mutable. ## Comments Comments begin with a \# character and continue until the end of the line. -There are no multiline comments. For ricm multiline comments, use a -string literal. +There are no multi-line comments. -## Shorthands +## Shorthand Often called reader macros in other lisps, Janet provides several shorthand notations for some forms. diff --git a/doc/Specials.md b/doc/Specials.md index fcfd1766..37858037 100644 --- a/doc/Specials.md +++ b/doc/Specials.md @@ -197,7 +197,7 @@ The r-value can be any expression, and the l-value should be a bound var. Similar to `(quote x)`, but allows for unquoting within x. This makes quasiquote useful for writing macros, as a macro definition often generates a lot of templated code with a -few custom values. The shorthand for quasiquote is a leading tilda `~` before a form. With +few custom values. The shorthand for quasiquote is a leading tilde `~` before a form. With that form, `(unquote x)` will evaluate and insert x into the unquote form. The shorthand for `(unquote x)` is `,x`. diff --git a/doc/The-Janet-Abstract-Machine-Bytecode.md b/doc/The-Janet-Abstract-Machine-Bytecode.md index 98451b67..63f7cff5 100644 --- a/doc/The-Janet-Abstract-Machine-Bytecode.md +++ b/doc/The-Janet-Abstract-Machine-Bytecode.md @@ -9,7 +9,7 @@ features. A Janet Fiber is the type used to represent multiple concurrent processes in janet. It is basically a wrapper around the idea of a stack. The stack is divided into a number of stack frames (`JanetStackFrame *` in C), each of which -contains information such as the function that created the stack frame, +contains information such as the function that created the stack frame, the program counter for the stack frame, a pointer to the previous frame, and the size of the frame. Each stack frame also is paired with a number registers. @@ -49,7 +49,7 @@ Frame -2 ... ... ... ------ +----- Bottom of stack ``` @@ -137,7 +137,7 @@ by their short names as presented to the assembler rather than their numerical v Each instruction is also listed with a signature, which are the arguments the instruction expects. There are a handful of instruction signatures, which combine the arity and type of the instruction. The assembler does not -do any typechecking per closure, but does prevent jumping to invalid instructions and +do any type-checking per closure, but does prevent jumping to invalid instructions and failure to return or error. ### Notation @@ -148,7 +148,7 @@ failure to return or error. * Some operators in the description have the suffix 'i' or 'r'. These indicate that these operators correspond to integers or real numbers only, respectively. All - bitwise operators and bit shifts only work with integers. + bit-wise operators and bit shifts only work with integers. * The `>>>` indicates unsigned right shift, as in Java. Because all integers in janet are signed, we differentiate the two kinds of right bit shift. @@ -159,7 +159,7 @@ failure to return or error. | Instruction | Signature | Description | | ----------- | --------------------------- | --------------------------------- | -| `add` | `(add dest lhs rhs)` | $dest = $lhs + $rhs | +| `add` | `(add dest lhs rhs)` | $dest = $lhs + $rhs | | `addim` | `(addim dest lhs im)` | $dest = $lhs + im | | `band` | `(band dest lhs rhs)` | $dest = $lhs & $rhs | | `bnot` | `(bnot dest operand)` | $dest = ~$operand | diff --git a/janet.1 b/janet.1 index 19768fb1..0f994439 100644 --- a/janet.1 +++ b/janet.1 @@ -8,7 +8,7 @@ janet \- run the janet language abstract machine [\fB\-\-\fR] .IR files ... .SH DESCRIPTION -Janet is a functional and imperative programming language and bytecode interpreter. +Janet is a functional and imperative programming language and bytecode interpreter. It is a modern lisp, but lists are replaced by other data structures with better utility and performance (arrays, tables, structs, tuples). The language also bridging bridging to native code written in C, meta-programming with macros, and bytecode assembly. @@ -19,7 +19,7 @@ into other programs. Try janet in your browser at https://janet-lang.org. Implemented in mostly standard C99, janet runs on Windows, Linux and macOS. The few features that are not standard C99 (dynamic library loading, compiler -specific optimizations), are fairly straight forward. Janet can be easily ported to +specific optimizations), are fairly straight forward. Janet can be easily ported to most new platforms. .SH DOCUMENTATION diff --git a/src/core/abstract.c b/src/core/abstract.c index 3118de8d..e4827b07 100644 --- a/src/core/abstract.c +++ b/src/core/abstract.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/array.c b/src/core/array.c index 1cb9e7be..aef24a93 100644 --- a/src/core/array.c +++ b/src/core/array.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -197,7 +197,7 @@ static Janet cfun_insert(int32_t argc, Janet *argv) { JanetArray *array = janet_getarray(argv, 0); int32_t at = janet_getinteger(argv, 1); if (at < 0) { - at = array->count + at + 1; + at = array->count + at + 1; } if (at < 0 || at > array->count) janet_panicf("insertion index %d out of range [0,%d]", at, array->count); @@ -215,7 +215,7 @@ static Janet cfun_insert(int32_t argc, Janet *argv) { static const JanetReg cfuns[] = { {"array/new", cfun_new, JDOC("(array/new capacity)\n\n" - "Creates a new empty array with a preallocated capacity. The same as " + "Creates a new empty array with a pre-allocated capacity. The same as " "(array) but can be more efficient if the maximum size of an array is known.") }, {"array/pop", cfun_pop, diff --git a/src/core/asm.c b/src/core/asm.c index 10b032d1..95a492b4 100644 --- a/src/core/asm.c +++ b/src/core/asm.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -55,7 +55,7 @@ struct JanetAssembler { JanetTable defs; /* symbol -> funcdefs index */ }; -/* Janet opcode descriptions in lexographic order. This +/* Janet opcode descriptions in lexicographic order. This * allows a binary search over the elements to find the * correct opcode given a name. This works in reasonable * time and is easier to setup statically than a hash table or @@ -742,7 +742,7 @@ JanetAssembleResult janet_asm(Janet source, int flags) { /* Disassembly */ -/* Find the deinfintion of an instruction given the instruction word. Return +/* Find the definition of an instruction given the instruction word. Return * NULL if not found. */ static const JanetInstructionDef *janet_asm_reverse_lookup(uint32_t instr) { size_t i; @@ -783,7 +783,7 @@ static Janet tup4(Janet w, Janet x, Janet y, Janet z) { return janet_wrap_tuple(janet_tuple_end(tup)); } -/* Given an argument, convert it to the appriate integer or symbol */ +/* Given an argument, convert it to the appropriate integer or symbol */ Janet janet_asm_decode_instruction(uint32_t instr) { const JanetInstructionDef *def = janet_asm_reverse_lookup(instr); Janet name; diff --git a/src/core/buffer.c b/src/core/buffer.c index a54aec18..004b9074 100644 --- a/src/core/buffer.c +++ b/src/core/buffer.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/bytecode.c b/src/core/bytecode.c index 5bdb226e..9de94445 100644 --- a/src/core/bytecode.c +++ b/src/core/bytecode.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/capi.c b/src/core/capi.c index 15b2b274..4858d12b 100644 --- a/src/core/capi.c +++ b/src/core/capi.c @@ -79,10 +79,10 @@ DEFINE_GETTER(struct, STRUCT, const JanetKV *) DEFINE_GETTER(string, STRING, const uint8_t *) DEFINE_GETTER(keyword, KEYWORD, const uint8_t *) DEFINE_GETTER(symbol, SYMBOL, const uint8_t *) -DEFINE_GETTER(buffer, BUFFER, JanetBuffer *) -DEFINE_GETTER(fiber, FIBER, JanetFiber *) -DEFINE_GETTER(function, FUNCTION, JanetFunction *) -DEFINE_GETTER(cfunction, CFUNCTION, JanetCFunction) +DEFINE_GETTER(buffer, BUFFER, JanetBuffer *) +DEFINE_GETTER(fiber, FIBER, JanetFiber *) +DEFINE_GETTER(function, FUNCTION, JanetFunction *) +DEFINE_GETTER(cfunction, CFUNCTION, JanetCFunction) int janet_getboolean(const Janet *argv, int32_t n) { Janet x = argv[n]; diff --git a/src/core/cfuns.c b/src/core/cfuns.c index e5cc4535..5dfc4532 100644 --- a/src/core/cfuns.c +++ b/src/core/cfuns.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2017 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -46,14 +46,14 @@ static int fixarity3(JanetFopts opts, JanetSlot *args) { return janet_v_count(args) == 3; } -/* Generic hanldling for $A = op $B */ +/* Generic handling for $A = op $B */ static JanetSlot genericSS(JanetFopts opts, int op, JanetSlot s) { JanetSlot target = janetc_gettarget(opts); janetc_emit_ss(opts.compiler, op, target, s, 1); return target; } -/* Generic hanldling for $A = $B op I */ +/* Generic handling for $A = $B op I */ static JanetSlot genericSSI(JanetFopts opts, int op, JanetSlot s, int32_t imm) { JanetSlot target = janetc_gettarget(opts); janetc_emit_ssi(opts.compiler, op, target, s, imm, 1); @@ -136,7 +136,7 @@ static JanetSlot do_apply(JanetFopts opts, JanetSlot *args) { return target; } -/* Varidadic operators specialization */ +/* Variadic operators specialization */ static JanetSlot do_add(JanetFopts opts, JanetSlot *args) { return opreduce(opts, args, JOP_ADD, janet_wrap_integer(0)); diff --git a/src/core/compile.c b/src/core/compile.c index 81eb4cc6..386ffe34 100644 --- a/src/core/compile.c +++ b/src/core/compile.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -236,7 +236,7 @@ JanetSlot janetc_resolve( scope->flags |= JANET_SCOPE_ENV; scope = scope->child; - /* Propogate env up to current scope */ + /* Propagate env up to current scope */ int32_t envindex = -1; while (scope) { if (scope->flags & JANET_SCOPE_FUNCTION) { @@ -725,7 +725,7 @@ static Janet cfun(int32_t argc, Janet *argv) { static const JanetReg cfuns[] = { {"compile", cfun, JDOC("(compile ast env [, source])\n\n" - "Compiles an Abstract Sytnax Tree (ast) into a janet function. " + "Compiles an Abstract Syntax Tree (ast) into a janet function. " "Pair the compile function with parsing functionality to implement " "eval. Returns a janet function and does not modify ast. Throws an " "error if the ast cannot be compiled.") diff --git a/src/core/compile.h b/src/core/compile.h index 4c7431be..8e69bbe4 100644 --- a/src/core/compile.h +++ b/src/core/compile.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2017 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/core.janet b/src/core/core.janet index ec84efc9..22a94f9a 100644 --- a/src/core/core.janet +++ b/src/core/core.janet @@ -1,5 +1,5 @@ # The core janet library -# Copyright 2018 (C) Calvin Rose +# Copyright 2019 (C) Calvin Rose ### ### @@ -469,7 +469,7 @@ accum) (defmacro if-let - "Make mutliple bindings, anf if all are truthy, + "Make multiple bindings, and if all are truthy, evaluate the tru form. If any are false or nil, evaluate the fal form. Bindings have the same syntax as the let macro." [bindings tru fal &] @@ -576,7 +576,7 @@ ### (def sort - "(sort xs [, by])\n\nSort an array in-place. Uses quicksort and is not a stable sort." + "(sort xs [, by])\n\nSort an array in-place. Uses quick-sort and is not a stable sort." (do (defn partition @@ -859,13 +859,13 @@ (put _env 'walk-dict nil) (defn postwalk - "Do a postorder traversal of a data sructure and call (f x) + "Do a post-order traversal of a data structure and call (f x) on every visitation." [f form] (f (walk (fn [x] (postwalk f x)) form))) (defn prewalk - "Similar to postwalk, but do preorder traversal." + "Similar to postwalk, but do pre-order traversal." [f form] (walk (fn [x] (prewalk f x)) (f form))) @@ -1024,7 +1024,7 @@ value, one key will be ignored." res) (defn distinct - "Returns an array of the the deduplicated values in xs." + "Returns an array of the deduplicated values in xs." [xs] (def ret @[]) (def seen @{}) diff --git a/src/core/corelib.c b/src/core/corelib.c index bd3a58e7..ff7b917d 100644 --- a/src/core/corelib.c +++ b/src/core/corelib.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -381,6 +381,8 @@ static const JanetReg cfuns[] = { {NULL, NULL, NULL} }; +#ifndef JANET_NO_BOOTSTRAP + /* Utility for inline assembly */ static void janet_quick_asm( JanetTable *env, @@ -599,6 +601,7 @@ static const uint32_t bnot_asm[] = { JOP_BNOT, JOP_RETURN }; +#endif /* ifndef JANET_NO_BOOTSTRAP */ JanetTable *janet_core_env(void) { JanetTable *env = janet_table(0); @@ -607,6 +610,7 @@ JanetTable *janet_core_env(void) { /* Load main functions */ janet_cfuns(env, NULL, cfuns); +#ifndef JANET_NO_BOOTSTRAP janet_quick_asm(env, JANET_FUN_YIELD, "debug", 0, 1, debug_asm, sizeof(debug_asm), JDOC("(debug)\n\n" "Throws a debug signal that can be caught by a parent fiber and used to inspect " @@ -645,7 +649,7 @@ JanetTable *janet_core_env(void) { "Returns the length or count of a data structure in constant time as an integer. For " "structs and tables, returns the number of key-value pairs in the data structure.")); janet_quick_asm(env, JANET_FUN_BNOT, "bnot", 1, 1, bnot_asm, sizeof(bnot_asm), - JDOC("(bnot x)\n\nReturns the bitwise inverse of integer x.")); + JDOC("(bnot x)\n\nReturns the bit-wise inverse of integer x.")); make_apply(env); /* Variadic ops */ @@ -667,13 +671,13 @@ JanetTable *janet_core_env(void) { "values. Division by two integers uses truncating division.")); templatize_varop(env, JANET_FUN_BAND, "band", -1, -1, JOP_BAND, JDOC("(band & xs)\n\n" - "Returns the bitwise and of all values in xs. Each x in xs must be an integer.")); + "Returns the bit-wise and of all values in xs. Each x in xs must be an integer.")); templatize_varop(env, JANET_FUN_BOR, "bor", 0, 0, JOP_BOR, JDOC("(bor & xs)\n\n" - "Returns the bitwise or of all values in xs. Each x in xs must be an integer.")); + "Returns the bit-wise or of all values in xs. Each x in xs must be an integer.")); templatize_varop(env, JANET_FUN_BXOR, "bxor", 0, 0, JOP_BXOR, JDOC("(bxor & xs)\n\n" - "Returns the bitwise xor of all values in xs. Each in xs must be an integer.")); + "Returns the bit-wise xor of all values in xs. Each in xs must be an integer.")); templatize_varop(env, JANET_FUN_LSHIFT, "blshift", 1, 1, JOP_SHIFT_LEFT, JDOC("(blshift x & shifts)\n\n" "Returns the value of x bit shifted left by the sum of all values in shifts. x " @@ -732,12 +736,13 @@ JanetTable *janet_core_env(void) { /* Platform detection */ janet_def(env, "janet/version", janet_cstringv(JANET_VERSION), - "The version number of the running janet program."); + JDOC("The version number of the running janet program.")); janet_def(env, "janet/build", janet_cstringv(JANET_BUILD), - "The build identifier of the running janet program."); + JDOC("The build identifier of the running janet program.")); /* Allow references to the environment */ - janet_def(env, "_env", ret, "The environment table for the current scope."); + janet_def(env, "_env", ret, JDOC("The environment table for the current scope.")); +#endif /* Set as gc root */ janet_gcroot(janet_wrap_table(env)); @@ -760,8 +765,10 @@ JanetTable *janet_core_env(void) { janet_lib_asm(env); #endif +#ifndef JANET_NO_BOOTSTRAP /* Run bootstrap source */ janet_dobytes(env, janet_gen_core, janet_gen_core_size, "core.janet", NULL); +#endif return env; } diff --git a/src/core/debug.c b/src/core/debug.c index 01df5e4a..57c26b0a 100644 --- a/src/core/debug.c +++ b/src/core/debug.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -274,7 +274,7 @@ static const JanetReg cfuns[] = { "\t:line - the current source line of the stack frame\n" "\t:name - the human friendly name of the function\n" "\t:pc - integer indicating the location of the program counter\n" - "\t:source - string with filename or other identifier for the source code\n" + "\t:source - string with the file path or other identifier for the source code\n" "\t:slots - array of all values in each slot\n" "\t:tail - boolean indicating a tail call") }, diff --git a/src/core/emit.c b/src/core/emit.c index 4d68abdb..a570380e 100644 --- a/src/core/emit.c +++ b/src/core/emit.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -61,7 +61,7 @@ static int32_t janetc_const(JanetCompiler *c, Janet x) { if (janet_equals(x, scope->consts[i])) return i; } - /* Ensure not too many constsants. */ + /* Ensure not too many constants. */ if (len >= 0xFFFF) { janetc_cerror(c, "too many constants"); return 0; diff --git a/src/core/emit.h b/src/core/emit.h index 527bbdaf..94cc830d 100644 --- a/src/core/emit.h +++ b/src/core/emit.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/fiber.c b/src/core/fiber.c index d702a21b..a9ff710b 100644 --- a/src/core/fiber.c +++ b/src/core/fiber.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -211,7 +211,7 @@ int janet_fiber_funcframe_tail(JanetFiber *fiber, JanetFunction *func) { Janet *stack = fiber->data + fiber->frame; Janet *args = fiber->data + fiber->stackstart; - /* Detatch old function */ + /* Detach old function */ if (NULL != janet_fiber_frame(fiber)->func) janet_env_detach(janet_fiber_frame(fiber)->env); janet_fiber_frame(fiber)->env = NULL; @@ -414,13 +414,13 @@ static const JanetReg cfuns[] = { JDOC("(fiber/maxstack fib)\n\n" "Gets the maximum stack size in janet values allowed for a fiber. While memory for " "the fiber's stack is not allocated up front, the fiber will not allocated more " - "than this amount and will throw a stackoverflow error if more memory is needed. ") + "than this amount and will throw a stack-overflow error if more memory is needed. ") }, { "fiber/setmaxstack", cfun_setmaxstack, JDOC("(fiber/setmaxstack fib maxstack)\n\n" "Sets the maximum stack size in janet values for a fiber. By default, the " - "maximum stacksize is usually 8192.") + "maximum stack size is usually 8192.") }, {NULL, NULL, NULL} }; diff --git a/src/core/fiber.h b/src/core/fiber.h index 954b3ea7..7b4daa8c 100644 --- a/src/core/fiber.h +++ b/src/core/fiber.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/gc.c b/src/core/gc.c index 694008e9..49c2592a 100644 --- a/src/core/gc.c +++ b/src/core/gc.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/gc.h b/src/core/gc.h index 22acd6ae..501e64f3 100644 --- a/src/core/gc.h +++ b/src/core/gc.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/io.c b/src/core/io.c index b7844769..7baa39ce 100644 --- a/src/core/io.c +++ b/src/core/io.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -53,7 +53,7 @@ JanetAbstractType janet_io_filetype = { NULL }; -/* Check argupments to fopen */ +/* Check arguments to fopen */ static int checkflags(const uint8_t *str) { int flags = 0; int32_t i; @@ -133,7 +133,6 @@ static Janet janet_io_popen(int32_t argc, Janet *argv) { } #endif -/* Open a a file and return a userdata wrapper around the C file API. */ static Janet janet_io_fopen(int32_t argc, Janet *argv) { janet_arity(argc, 1, 2); const uint8_t *fname = janet_getstring(argv, 0); @@ -305,13 +304,13 @@ static const JanetReg cfuns[] = { { "file/open", janet_io_fopen, JDOC("(file/open path [,mode])\n\n" - "Open a file. path is files absolute or relative path, and " + "Open a file. path is an absolute or relative path, and " "mode is a set of flags indicating the mode to open the file in. " "mode is a keyword where each character represents a flag. If the file " "cannot be opened, returns nil, otherwise returns the new file handle. " "Mode flags:\n\n" "\tr - allow reading from the file\n" - "\tw - allow witing to the file\n" + "\tw - allow writing to the file\n" "\ta - append to the file\n" "\tb - open the file in binary mode (rather than text mode)\n" "\t+ - append to the file instead of overwriting it") @@ -327,7 +326,7 @@ static const JanetReg cfuns[] = { "file/read", janet_io_fread, JDOC("(file/read f what [,buf])\n\n" "Read a number of bytes from a file into a buffer. A buffer can " - "be provided as an optional fourth argument. otherwise a new buffer " + "be provided as an optional fourth argument, otherwise a new buffer " "is created. 'what' can either be an integer or a keyword. Returns the " "buffer with file contents. " "Values for 'what':\n\n" @@ -344,7 +343,7 @@ static const JanetReg cfuns[] = { { "file/flush", janet_io_fflush, JDOC("(file/flush f)\n\n" - "Flush any buffered bytes to the filesystem. In most files, writes are " + "Flush any buffered bytes to the file system. In most files, writes are " "buffered for efficiency reasons. Returns the file handle.") }, { diff --git a/src/core/marsh.c b/src/core/marsh.c index 6200e77c..92a0f9cd 100644 --- a/src/core/marsh.c +++ b/src/core/marsh.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -610,7 +610,7 @@ static const uint8_t *unmarshal_one_env( data = unmarshal_one(st, data, &fiberv, flags); if (!janet_checktype(fiberv, JANET_FIBER)) longjmp(st->err, UMR_EXPECTED_FIBER); env->as.fiber = janet_unwrap_fiber(fiberv); - /* Unmarshaling fiber may set values */ + /* Unmarshalling fiber may set values */ if (env->offset != 0 && env->offset != offset) longjmp(st->err, UMR_UNKNOWN); if (env->length != 0 && env->length != length) longjmp(st->err, UMR_UNKNOWN); } else { @@ -645,7 +645,7 @@ static const uint8_t *unmarshal_one_def( *out = st->lookup_defs[index]; } else { /* Initialize with values that will not break garbage collection - * if unmarshaling fails. */ + * if unmarshalling fails. */ JanetFuncDef *def = janet_gcalloc(JANET_MEMORY_FUNCDEF, sizeof(JanetFuncDef)); def->environments_length = 0; def->defs_length = 0; @@ -786,7 +786,7 @@ static const uint8_t *unmarshal_one_fiber( fiber->data = NULL; fiber->child = NULL; - /* Set frame later so fiber can be GCed at anytime if unmarshaling fails */ + /* Set frame later so fiber can be GCed at anytime if unmarshalling fails */ int32_t frame = 0; int32_t stack = 0; int32_t stacktop = 0; @@ -802,7 +802,6 @@ static const uint8_t *unmarshal_one_fiber( if ((int32_t)(frame + JANET_FRAME_SIZE) > fiber->stackstart || fiber->stackstart > fiber->stacktop || fiber->stacktop > fiber->maxstack) { - /* printf("bad flags and ints.\n"); */ goto error; } @@ -832,7 +831,6 @@ static const uint8_t *unmarshal_one_fiber( Janet funcv; data = unmarshal_one(st, data, &funcv, flags + 1); if (!janet_checktype(funcv, JANET_FUNCTION)) { - /* printf("bad root func.\n"); */ goto error; } func = janet_unwrap_function(funcv); @@ -1154,20 +1152,20 @@ static const JanetReg cfuns[] = { "can the later be unmarshalled to reconstruct the initial value. " "Optionally, one can pass in a reverse lookup table to not marshal " "aliased values that are found in the table. Then a forward" - "lookup table can be used to recover the origrinal janet value when " - "unmarshaling.") + "lookup table can be used to recover the original janet value when " + "unmarshalling.") }, { "unmarshal", cfun_unmarshal, JDOC("(unmarshal buffer [,lookup])\n\n" "Unmarshal a janet value from a buffer. An optional lookup table " "can be provided to allow for aliases to be resolved. Returns the value " - "unmarshaled from the buffer.") + "unmarshalled from the buffer.") }, { "env-lookup", cfun_env_lookup, JDOC("(env-lookup env)\n\n" - "Creates a forward lookup table for unmarshaling from an environment. " + "Creates a forward lookup table for unmarshalling from an environment. " "To create a reverse lookup table, use the invert function to swap keys " "and values in the returned table.") }, diff --git a/src/core/math.c b/src/core/math.c index dce38407..d9ce0dd2 100644 --- a/src/core/math.c +++ b/src/core/math.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -95,12 +95,12 @@ static const JanetReg cfuns[] = { }, { "not", janet_not, - JDOC("(not x)\n\nReturns the boolen inverse of x.") + JDOC("(not x)\n\nReturns the boolean inverse of x.") }, { "math/random", janet_rand, JDOC("(math/random)\n\n" - "Returns a uniformly distrbuted random number between 0 and 1.") + "Returns a uniformly distributed random number between 0 and 1.") }, { "math/seedrandom", janet_srand, @@ -179,10 +179,12 @@ static const JanetReg cfuns[] = { /* Module entry point */ void janet_lib_math(JanetTable *env) { janet_cfuns(env, NULL, cfuns); +#ifndef JANET_NO_BOOTSTRAP janet_def(env, "math/pi", janet_wrap_number(3.1415926535897931), JDOC("The value pi.")); janet_def(env, "math/e", janet_wrap_number(2.7182818284590451), JDOC("The base of the natural log.")); janet_def(env, "math/inf", janet_wrap_number(INFINITY), JDOC("The number representing positive infinity")); +#endif } diff --git a/src/core/multisym.c b/src/core/multisym.c index b6cc77f3..761e5b48 100644 --- a/src/core/multisym.c +++ b/src/core/multisym.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -100,7 +100,7 @@ JanetSlot janetc_sym_rvalue(JanetFopts opts, const uint8_t *sym) { return multisym_do_parts(opts, 0, sym, janet_wrap_nil()); } -/* Check if a symbol is a multisym, and if so, transform +/* Check if a symbol is a multisym, and if so, transform * it into the correct 'put' expression. */ JanetSlot janetc_sym_lvalue(JanetFopts opts, const uint8_t *sym, Janet value) { return multisym_do_parts(opts, 1, sym, value); diff --git a/src/core/os.c b/src/core/os.c index bd723324..3ac2ebc4 100644 --- a/src/core/os.c +++ b/src/core/os.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/parse.c b/src/core/parse.c index de4c1971..771a8788 100644 --- a/src/core/parse.c +++ b/src/core/parse.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -50,7 +50,7 @@ static int is_symbol_char(uint8_t c) { } /* Validate some utf8. Useful for identifiers. Only validates - * the encoding, does not check for valid codepoints (they + * the encoding, does not check for valid code points (they * are less well defined than the encoding). */ static int valid_utf8(const uint8_t *str, int32_t len) { int32_t i = 0; @@ -75,7 +75,7 @@ static int valid_utf8(const uint8_t *str, int32_t len) { if ((str[j] >> 6) != 2) return 0; } - /* Check for overlong encodings */ + /* Check for overlong encoding */ if ((nexti == i + 2) && str[i] < 0xC2) return 0; if ((str[i] == 0xE0) && str[i + 1] < 0xA0) return 0; if ((str[i] == 0xF0) && str[i + 1] < 0x90) return 0; @@ -170,7 +170,7 @@ static void popstate(JanetParser *p, Janet val) { } else if (newtop->flags & PFLAG_READERMAC) { Janet *t = janet_tuple_begin(2); int c = newtop->flags & 0xFF; - const char *which = + const char *which = (c == '\'') ? "quote" : (c == ',') ? "unquote" : (c == ';') ? "splice" : @@ -308,7 +308,7 @@ static int tokenchar(JanetParser *p, JanetParseState *state, uint8_t c) { p->error = "symbol literal cannot start with a digit"; return 0; } else { - /* Don't do full utf8 check unless we have seen non ascii characters. */ + /* Don't do full utf-8 check unless we have seen non ascii characters. */ int valid = (!state->argn) || valid_utf8(p->buf, blen); if (!valid) { p->error = "invalid utf-8 in symbol"; @@ -777,7 +777,7 @@ static const JanetReg cfuns[] = { { "parser/error", cfun_error, JDOC("(parser/error parser)\n\n" - "If the parser is in the error state, returns the message asscoiated with " + "If the parser is in the error state, returns the message associated with " "that error. Otherwise, returns nil. Also flushes the parser state and parser " "queue, so be sure to handle everything in the queue before calling " "parser/error.") @@ -804,14 +804,14 @@ static const JanetReg cfuns[] = { "Returns a string representation of the internal state of the parser. " "Each byte in the string represents a nested data structure. For example, " "if the parser state is '([\"', then the parser is in the middle of parsing a " - "string inside of square brackets inside parens. Can be used to augment a repl prompt.") + "string inside of square brackets inside parentheses. Can be used to augment a REPL prompt.") }, { "parser/where", cfun_where, JDOC("(parser/where parser)\n\n" "Returns the current line number and column number of the parser's location " "in the byte stream as a tuple (line, column). Lines and columns are counted from " - "1, (the first byte is line1, column 1) and a newline is considered ascii 0x0A.") + "1, (the first byte is line 1, column 1) and a newline is considered ASCII 0x0A.") }, {NULL, NULL, NULL} }; diff --git a/src/core/regalloc.c b/src/core/regalloc.c index bdc98859..648e0e10 100644 --- a/src/core/regalloc.c +++ b/src/core/regalloc.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -57,7 +57,7 @@ static int32_t count_trailing_ones(uint32_t x) { /* Get N bits */ #define nbits(N) (ithbit(N) - 1) -/* Copy a regsiter allocator */ +/* Copy a register allocator */ void janetc_regalloc_clone(JanetcRegisterAllocator *dest, JanetcRegisterAllocator *src) { size_t size; dest->count = src->count; @@ -153,78 +153,3 @@ void janetc_regalloc_freetemp(JanetcRegisterAllocator *ra, int32_t reg, JanetcRe if (reg < 0xF0) janetc_regalloc_free(ra, reg); } - -/* Disable multi-slot allocation for now. */ - -/* -static int32_t checkrange(JanetcRegisterAllocator *ra, int32_t start, int32_t end) { - int32_t startchunk = start / 32; - int32_t endchunk = end / 32; - for (int32_t chunk = startchunk; chunk <= endchunk; chunk++) { - while (ra->count <= chunk) pushchunk(ra); - uint32_t mask = 0xFFFFFFFF; - if (chunk == startchunk) - mask &= ~nbits(start & 0x1F); - if (chunk == endchunk) - mask &= nbits(end & 0x1F); - uint32_t block = ra->chunks[chunk]; - uint32_t masking = mask & block; - if (masking) { - int32_t nextbit = (block == 0xFFFFFFFF) - ? 32 - : count_trailing_zeros(masking) + 1; - return chunk * 32 + nextbit; - } - } - return -1; -} - -static void markrange(JanetcRegisterAllocator *ra, int32_t start, int32_t end) { - int32_t startchunk = start / 32; - int32_t endchunk = end / 32; - for (int32_t chunk = startchunk; chunk <= endchunk; chunk++) { - uint32_t mask = 0xFFFFFFFF; - if (chunk == startchunk) - mask &= ~nbits(start & 0x1F); - if (chunk == endchunk) - mask &= nbits(end & 0x1F); - ra->chunks[chunk] |= mask; - } -} - -void janetc_regalloc_freerange(JanetcRegisterAllocator *ra, int32_t start, int32_t n) { - int32_t end = start + n - 1; - int32_t startchunk = start / 32; - int32_t endchunk = end / 32; - for (int32_t chunk = startchunk; chunk <= endchunk; chunk++) { - uint32_t mask = 0; - if (chunk == startchunk) - mask |= nbits(start & 0x1F); - if (chunk == endchunk) - mask |= ~nbits(end & 0x1F); - ra->chunks[chunk] &= mask; - } -} - -int32_t janetc_regalloc_n(JanetcRegisterAllocator *ra, int32_t n) { - int32_t start = 0, end = 0, next = 0; - while (next >= 0) { - start = next; - end = start + n - 1; - next = checkrange(ra, start, end); - } - markrange(ra, start, end); - if (end > ra->max) - ra->max = end; - return start; -} - -int32_t janetc_regalloc_call(JanetcRegisterAllocator *ra, int32_t callee, int32_t nargs) { - if (checkrange(ra, callee, callee + nargs) < 0) { - markrange(ra, callee + 1, callee + nargs); - return callee; - } - return janetc_regalloc_n(ra, nargs + 1); -} - -*/ diff --git a/src/core/regalloc.h b/src/core/regalloc.h index 95dac20e..46110636 100644 --- a/src/core/regalloc.h +++ b/src/core/regalloc.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -44,7 +44,7 @@ typedef struct { int32_t count; /* number of chunks in chunks */ int32_t capacity; /* amount allocated for chunks */ int32_t max; /* The maximum allocated register so far */ - int32_t regtemps; /* Hold which tempregistered are alloced. */ + int32_t regtemps; /* Hold which temp. registers are allocated. */ } JanetcRegisterAllocator; void janetc_regalloc_init(JanetcRegisterAllocator *ra); @@ -57,11 +57,4 @@ void janetc_regalloc_freetemp(JanetcRegisterAllocator *ra, int32_t reg, JanetcRe void janetc_regalloc_clone(JanetcRegisterAllocator *dest, JanetcRegisterAllocator *src); void janetc_regalloc_touch(JanetcRegisterAllocator *ra, int32_t reg); -/* Mutli-slot allocation disabled */ -/* -int32_t janetc_regalloc_n(JanetcRegisterAllocator *ra, int32_t n); -int32_t janetc_regalloc_call(JanetcRegisterAllocator *ra, int32_t callee, int32_t nargs); -void janetc_regalloc_freerange(JanetcRegisterAllocator *ra, int32_t regstart, int32_t n); -*/ - #endif diff --git a/src/core/run.c b/src/core/run.c index 554099af..fbc271bc 100644 --- a/src/core/run.c +++ b/src/core/run.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/specials.c b/src/core/specials.c index 97997abc..182e069b 100644 --- a/src/core/specials.c +++ b/src/core/specials.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -94,7 +94,7 @@ static JanetSlot quasiquote(JanetFopts opts, Janet x) { janet_v_push(slots, key); janet_v_push(slots, value); } - return qq_slots(opts, slots, + return qq_slots(opts, slots, janet_checktype(x, JANET_TABLE) ? JOP_MAKE_TABLE : JOP_MAKE_STRUCT); } } @@ -116,7 +116,7 @@ static JanetSlot janetc_unquote(JanetFopts opts, int32_t argn, const Janet *argv } /* Preform destructuring. Be careful to - * keep the order registers are freed. + * keep the order registers are freed. * Returns if the slot 'right' can be freed. */ static int destructure(JanetCompiler *c, Janet left, @@ -511,7 +511,7 @@ static JanetSlot janetc_while(JanetFopts opts, int32_t argn, const Janet *argv) /* Recompile in the function scope */ cond = janetc_value(subopts, argv[0]); if (!(cond.flags & JANET_SLOT_CONSTANT)) { - /* If not an infinte loop, return nil when condition false */ + /* If not an infinite loop, return nil when condition false */ janetc_emit_si(c, JOP_JUMP_IF, cond, 2, 0); janetc_emit(c, JOP_RETURN_NIL); } @@ -536,7 +536,7 @@ static JanetSlot janetc_while(JanetFopts opts, int32_t argn, const Janet *argv) return janetc_cslot(janet_wrap_nil()); } - /* Compile jump to whiletop */ + /* Compile jump to :whiletop */ labeljt = janet_v_count(c->buffer); janetc_emit(c, JOP_JUMP); @@ -597,7 +597,7 @@ static JanetSlot janetc_fn(JanetFopts opts, int32_t argn, const Janet *argv) { Janet param = params[i]; if (janet_checktype(param, JANET_SYMBOL)) { /* Check for varargs and unfixed arity */ - if ((!seenamp) && + if ((!seenamp) && (0 == janet_cstrcmp(janet_unwrap_symbol(param), "&"))) { seenamp = 1; fixarity = 0; diff --git a/src/core/state.h b/src/core/state.h index 32f2c738..73086308 100644 --- a/src/core/state.h +++ b/src/core/state.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -27,10 +27,10 @@ /* The VM state. Rather than a struct that is passed * around, the vm state is global for simplicity. If - * at some point a a global state object, or context, - * is required to be passed around, this is waht would - * be in it. However, thread local globals for interpreter - * state should allow easy multithreading. */ + * at some point a global state object, or context, + * is required to be passed around, this is what would + * be in it. However, thread local global variables for interpreter + * state should allow easy multi-threading. */ /* How many VM stacks have been entered */ extern JANET_THREAD_LOCAL int janet_vm_stackn; @@ -39,7 +39,7 @@ extern JANET_THREAD_LOCAL int janet_vm_stackn; * Set and unset by janet_run. */ extern JANET_THREAD_LOCAL JanetFiber *janet_vm_fiber; -/* The global registry for c functions. Used to store metadata +/* The global registry for c functions. Used to store meta-data * along with otherwise bare c function pointers. */ extern JANET_THREAD_LOCAL JanetTable *janet_vm_registry; diff --git a/src/core/string.c b/src/core/string.c index c203bad8..6284b5ff 100644 --- a/src/core/string.c +++ b/src/core/string.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -1070,14 +1070,14 @@ static const JanetReg cfuns[] = { "string/ascii-lower", cfun_asciilower, JDOC("(string/ascii-lower str)\n\n" "Returns a new string where all bytes are replaced with the " - "lowercase version of themselves in ascii. Does only a very simple " + "lowercase version of themselves in ASCII. Does only a very simple " "case check, meaning no unicode support.") }, { "string/ascii-upper", cfun_asciiupper, JDOC("(string/ascii-upper str)\n\n" "Returns a new string where all bytes are replaced with the " - "uppercase version of themselves in ascii. Does only a very simple " + "uppercase version of themselves in ASCII. Does only a very simple " "case check, meaning no unicode support.") }, { diff --git a/src/core/strtod.c b/src/core/strtod.c index 3e8e87bf..15b2a292 100644 --- a/src/core/strtod.c +++ b/src/core/strtod.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -21,23 +21,21 @@ */ /* Use a custom double parser instead of libc's strtod for better portability - * and control. Also, uses a less strict rounding method than ieee to not incur - * the cost of 4000 loc and dependence on arbitary precision arithmetic. Includes - * subset of multiple precision functionality needed for correct rounding. + * and control. * * This version has been modified for much greater flexibility in parsing, such * as choosing the radix and supporting scientific notation with any radix. * * Numbers are of the form [-+]R[rR]I.F[eE&][-+]X where R is the radix, I is * the integer part, F is the fractional part, and X is the exponent. All - * signs, radix, decimal point, fractional part, and exponent can be ommited. + * signs, radix, decimal point, fractional part, and exponent can be omitted. * The number will be considered and integer if the there is no decimal point * and no exponent. Any number greater the 2^32-1 or less than -(2^32) will be * coerced to a double. If there is an error, the function janet_scan_number will * return a janet nil. The radix is assumed to be 10 if omitted, and the E * separator for the exponent can only be used when the radix is 10. This is - * because E is a vaid digit in bases 15 or greater. For bases greater than 10, - * the letters are used as digitis. A through Z correspond to the digits 10 + * because E is a valid digit in bases 15 or greater. For bases greater than 10, + * the letters are used as digits. A through Z correspond to the digits 10 * through 35, and the lowercase letters have the same values. The radix number * is always in base 10. For example, a hexidecimal number could be written * '16rdeadbeef'. janet_scan_number also supports some c style syntax for @@ -104,7 +102,7 @@ static void bignat_append(struct BigNat *mant, uint32_t dig) { } /* Multiply the mantissa mant by a factor and the add a term - * in one operation. factor will be between 2 and 36^4, + * in one operation. factor will be between 2 and 36^4, * term will be between 0 and 36. */ static void bignat_muladd(struct BigNat *mant, uint32_t factor, uint32_t term) { int32_t i; @@ -166,7 +164,7 @@ static int clz(uint32_t x) { static double bignat_extract(struct BigNat *mant, int32_t exponent2) { uint64_t top53; int32_t n = mant->n; - /* Get most significant 53 bits from mant. Bit52 (0 indexed) should + /* Get most significant 53 bits from mant. Bit 52 (0 indexed) should * always be 1. This is essentially a large right shift on mant.*/ if (n) { /* Two or more digits */ diff --git a/src/core/struct.c b/src/core/struct.c index 6fe96c4f..6e6802d8 100644 --- a/src/core/struct.c +++ b/src/core/struct.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -62,7 +62,7 @@ const JanetKV *janet_struct_find(const JanetKV *st, Janet key) { * * Runs will be in sorted order, as the collisions resolver essentially * preforms an in-place insertion sort. This ensures the internal structure of the - * hash map is independant of insertion order. + * hash map is independent of insertion order. */ void janet_struct_put(JanetKV *st, Janet key, Janet value) { int32_t cap = janet_struct_capacity(st); @@ -89,9 +89,9 @@ void janet_struct_put(JanetKV *st, Janet key, Janet value) { } /* Robinhood hashing - check if colliding kv pair * is closer to their source than current. We use robinhood - * hashing to ensure that equivalent structs that are contsructed + * hashing to ensure that equivalent structs that are constructed * with different order have the same internal layout, and therefor - * will compare properly - i.e., {1 2 3 4} should equal {3 4 1 2}. + * will compare properly - i.e., {1 2 3 4} should equal {3 4 1 2}. * Collisions are resolved via an insertion sort insertion. */ otherhash = janet_hash(kv->key); otherindex = janet_maphash(cap, otherhash); diff --git a/src/core/symcache.h b/src/core/symcache.h index 24cfe0c2..cf8faee8 100644 --- a/src/core/symcache.h +++ b/src/core/symcache.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/table.c b/src/core/table.c index ea80f77f..171c8456 100644 --- a/src/core/table.c +++ b/src/core/table.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/tuple.c b/src/core/tuple.c index 58542777..13c8bb14 100644 --- a/src/core/tuple.c +++ b/src/core/tuple.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/util.c b/src/core/util.c index d6ecb7b8..18372e0e 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -133,7 +133,7 @@ int32_t janet_tablen(int32_t n) { } /* Helper to find a value in a Janet struct or table. Returns the bucket - * containg the key, or the first empty bucket if there is no such key. */ + * containing the key, or the first empty bucket if there is no such key. */ const JanetKV *janet_dict_find(const JanetKV *buckets, int32_t cap, Janet key) { int32_t index = janet_maphash(cap, janet_hash(key)); int32_t i; @@ -188,7 +188,7 @@ const JanetKV *janet_dictionary_next(const JanetKV *kvs, int32_t cap, const Jane return NULL; } -/* Compare a janet string with a cstring. more efficient than loading +/* Compare a janet string with a cstring. More efficient than loading * c string as a janet string. */ int janet_cstrcmp(const uint8_t *str, const char *other) { int32_t len = janet_string_length(str); @@ -205,7 +205,7 @@ int janet_cstrcmp(const uint8_t *str, const char *other) { /* Do a binary search on a static array of structs. Each struct must * have a string as its first element, and the struct must be sorted - * lexogrpahically by that element. */ + * lexicographically by that element. */ const void *janet_strbinsearch( const void *tab, size_t tabcount, diff --git a/src/core/util.h b/src/core/util.h index 18bfb6b3..ce120e5c 100644 --- a/src/core/util.h +++ b/src/core/util.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/value.c b/src/core/value.c index 739dc806..c780a36b 100644 --- a/src/core/value.c +++ b/src/core/value.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -102,7 +102,7 @@ int32_t janet_hash(Janet x) { return hash; } -/* Compares x to y. If they are equal retuns 0. If x is less, returns -1. +/* Compares x to y. If they are equal returns 0. If x is less, returns -1. * If y is less, returns 1. All types are comparable * and should have strict ordering. */ int janet_compare(Janet x, Janet y) { @@ -113,7 +113,7 @@ int janet_compare(Janet x, Janet y) { case JANET_TRUE: return 0; case JANET_NUMBER: - /* Check for nans to ensure total order */ + /* Check for NaNs to ensure total order */ if (janet_unwrap_number(x) != janet_unwrap_number(x)) return janet_unwrap_number(y) != janet_unwrap_number(y) ? 0 diff --git a/src/core/vector.c b/src/core/vector.c index 4a3904df..6cead975 100644 --- a/src/core/vector.c +++ b/src/core/vector.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/vector.h b/src/core/vector.h index 78fb9720..dd2db3a7 100644 --- a/src/core/vector.h +++ b/src/core/vector.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/core/vm.c b/src/core/vm.c index ee358291..6d5d5a0c 100644 --- a/src/core/vm.c +++ b/src/core/vm.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -32,8 +32,8 @@ JANET_THREAD_LOCAL JanetTable *janet_vm_registry; JANET_THREAD_LOCAL int janet_vm_stackn = 0; JANET_THREAD_LOCAL JanetFiber *janet_vm_fiber = NULL; -/* Virtual regsiters - * +/* Virtual registers + * * One instruction word * CC | BB | AA | OP * DD | DD | DD | OP @@ -220,7 +220,7 @@ static void *op_lookup[255] = { #define vm_bitopu(op) _vm_bitop(op, uint32_t) /* Call a non function type */ -static Janet call_nonfn(JanetFiber *fiber, Janet callee) { +static Janet call_nonfn(JanetFiber *fiber, Janet callee) { int32_t argn = fiber->stacktop - fiber->stackstart; Janet ds, key; if (!janet_checktypes(callee, JANET_TFLAG_FUNCLIKE)) { @@ -247,12 +247,12 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) { register uint32_t *pc; register JanetFunction *func; vm_restore(); - + /* Only should be hit if the fiber is either waiting for a child, or * waiting to be resumed. In those cases, use input and increment pc. We - * DO NOT use input when resuming a fiber that has been interrupted at a + * DO NOT use input when resuming a fiber that has been interrupted at a * breakpoint. */ - if (janet_fiber_status(fiber) != JANET_STATUS_NEW && + if (janet_fiber_status(fiber) != JANET_STATUS_NEW && ((*pc & 0xFF) == JOP_SIGNAL || (*pc & 0xFF) == JOP_RESUME)) { stack[A] = in; pc++; @@ -266,7 +266,7 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) { : (*pc & 0xFF); /* Main interpreter loop. Semantically is a switch on - * (*pc & 0xFF) inside of an infinte loop. */ + * (*pc & 0xFF) inside of an infinite loop. */ VM_START(); VM_DEFAULT(); diff --git a/src/core/wrap.c b/src/core/wrap.c index 659e90b8..705879c1 100644 --- a/src/core/wrap.c +++ b/src/core/wrap.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/include/janet/janet.h b/src/include/janet/janet.h index dff5a67c..1e75b808 100644 --- a/src/include/janet/janet.h +++ b/src/include/janet/janet.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -113,7 +113,7 @@ extern "C" { #define JANET_THREAD_LOCAL #endif -/* Enable or disbale dynamic module loading. Enabled by default. */ +/* Enable or disable dynamic module loading. Enabled by default. */ #ifndef JANET_NO_DYNAMIC_MODULES #define JANET_DYNAMIC_MODULES #endif @@ -326,7 +326,7 @@ typedef enum JanetType { #define JANET_TFLAG_FUNCLIKE (JANET_TFLAG_CALLABLE | JANET_TFLAG_INDEXED | JANET_TFLAG_DICTIONARY | \ JANET_TFLAG_KEYWORD | JANET_TFLAG_SYMBOL) -/* We provide three possible implemenations of Janets. The preferred +/* We provide three possible implementations of Janets. The preferred * nanboxing approach, for 32 or 64 bits, and the standard C version. Code in the rest of the * application must interact through exposed interface. */ @@ -385,7 +385,6 @@ JANET_API Janet janet_nanbox_from_cpointer(const void *p, uint64_t tagmask); JANET_API Janet janet_nanbox_from_double(double d); JANET_API Janet janet_nanbox_from_bits(uint64_t bits); -/* Todo - check for single mask operation */ #define janet_truthy(x) \ (!(janet_checktype((x), JANET_NIL) || janet_checktype((x), JANET_FALSE))) @@ -634,7 +633,7 @@ struct JanetArray { int32_t capacity; }; -/* A bytebuffer type. Used as a mutable string or string builder. */ +/* A byte buffer type. Used as a mutable string or string builder. */ struct JanetBuffer { uint8_t *data; int32_t count; @@ -656,7 +655,7 @@ struct JanetKV { Janet value; }; -/* Some function defintion flags */ +/* Some function definition flags */ #define JANET_FUNCDEF_FLAG_VARARG 0x10000 #define JANET_FUNCDEF_FLAG_NEEDSENV 0x20000 #define JANET_FUNCDEF_FLAG_FIXARITY 0x40000 @@ -694,7 +693,7 @@ struct JanetFuncDef { int32_t defs_length; }; -/* A fuction environment */ +/* A function environment */ struct JanetFuncEnv { union { JanetFiber *fiber; @@ -744,7 +743,7 @@ struct JanetAbstractType { int (*gcmark)(void *data, size_t len); }; -/* Contains information about userdata */ +/* Contains information about abstract types */ struct JanetAbstractHeader { const JanetAbstractType *type; size_t size; diff --git a/src/mainclient/init.janet b/src/mainclient/init.janet index 86c217eb..759f98fb 100644 --- a/src/mainclient/init.janet +++ b/src/mainclient/init.janet @@ -1,4 +1,4 @@ -# Copyright 2017-2018 (C) Calvin Rose +# Copyright 2017-2019 (C) Calvin Rose (do diff --git a/src/mainclient/line.c b/src/mainclient/line.c index 8f005555..46987223 100644 --- a/src/mainclient/line.c +++ b/src/mainclient/line.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -184,7 +184,7 @@ static void clear() { static void refresh() { char seq[64]; JanetBuffer b; - + /* Keep cursor position on screen */ char *_buf = buf; int _len = len; @@ -296,7 +296,7 @@ static void kright() { static void kbackspace() { if (pos > 0) { memmove(buf + pos - 1, buf + pos, len - pos); - pos--; + pos--; buf[--len] = '\0'; refresh(); } @@ -445,7 +445,7 @@ static int checktermsupport() { } void janet_line_get(const uint8_t *p, JanetBuffer *buffer) { - prompt = (const char *)p; + prompt = (const char *)p; buffer->count = 0; historyi = 0; if (!isatty(STDIN_FILENO) || !checktermsupport()) { diff --git a/src/mainclient/line.h b/src/mainclient/line.h index d4f0499b..74c9e9a1 100644 --- a/src/mainclient/line.h +++ b/src/mainclient/line.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/mainclient/main.c b/src/mainclient/main.c index 294cd7f1..0f4ce7a4 100644 --- a/src/mainclient/main.c +++ b/src/mainclient/main.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/webclient/main.c b/src/webclient/main.c index 21eaa7a9..9510e1ab 100644 --- a/src/webclient/main.c +++ b/src/webclient/main.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -52,7 +52,7 @@ static int enter_loop(void) { return 0; } -/* Allow JS interop from within janet */ +/* Allow JS interoperation from within janet */ static Janet cfun_js(int32_t argc, Janet *argv) { janet_fixarity(argc, 1); JanetByteView bytes = janet_getbytes(argv, 0); @@ -60,7 +60,7 @@ static Janet cfun_js(int32_t argc, Janet *argv) { return janet_wrap_nil(); } -/* Intialize the repl */ +/* Initialize the repl */ EMSCRIPTEN_KEEPALIVE void repl_init(void) { int status; diff --git a/src/webclient/webinit.janet b/src/webclient/webinit.janet index 5ef92263..83b414e1 100644 --- a/src/webclient/webinit.janet +++ b/src/webclient/webinit.janet @@ -1,4 +1,5 @@ -# Copyright 2017-2018 (C) Calvin Rose +# Copyright 2017-2019 (C) Calvin Rose + (print (string "Janet " janet/version "-" janet/build " Copyright (C) 2017-2018 Calvin Rose")) (fiber/new (fn webrepl [] diff --git a/test/helper.janet b/test/helper.janet index f6b95b16..335fd5de 100644 --- a/test/helper.janet +++ b/test/helper.janet @@ -16,7 +16,7 @@ (++ numchecks) (file/write stdout "\e[32m✔\e[0m")) (do - (file/write stdout "\n\e[31m✘\e[0m ") + (file/write stdout "\n\e[31m✘\e[0m ") (set numchecks 0) (print e))) x) diff --git a/test/suite0.janet b/test/suite0.janet index b53ac2b2..f9cb47fe 100644 --- a/test/suite0.janet +++ b/test/suite0.janet @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Calvin Rose +# Copyright (c) 2019 Calvin Rose # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to @@ -79,7 +79,7 @@ (assert (= "\e" "\x1B") "escape character") (assert (= "\x09" "\t") "tab character") -# Mcarthy's 91 function +# McCarthy's 91 function (var f91 nil) (set f91 (fn [n] (if (> n 100) (- n 10) (f91 (f91 (+ n 11)))))) (assert (= 91 (f91 10)) "f91(10) = 91") @@ -217,7 +217,7 @@ # Merge sort # Imperative (and verbose) merge sort merge -(defn merge +(defn merge [xs ys] (def ret @[]) (def xlen (length xs)) diff --git a/test/suite1.janet b/test/suite1.janet index fa3f8981..6c0a26b5 100644 --- a/test/suite1.janet +++ b/test/suite1.janet @@ -1,5 +1,5 @@ -# Copyright (c) 2018 Calvin Rose - +# Copyright (c) 2019 Calvin Rose +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the @@ -95,7 +95,7 @@ # Find the maximum path from the top (root) # of the triangle to the leaves of the triangle. - + (defn myfold [xs ys] (let [xs1 (tuple/prepend xs 0) xs2 (tuple/append xs 0) @@ -190,7 +190,7 @@ (assert (= '[2 -2 2 0.5] (myfun 2)) "juxt") # Case statements -(assert +(assert (= :six (case (+ 1 2 3) 1 :one 2 :two @@ -238,7 +238,7 @@ (def arr (array)) (array/push arr :hello) (array/push arr :world) -(assert (array= arr @[:hello :world]) "array comparision") +(assert (array= arr @[:hello :world]) "array comparison") (assert (array= @[1 2 3 4 5] @[1 2 3 4 5]) "array comparison 2") (assert (array= @[:one :two :three :four :five] @[:one :two :three :four :five]) "array comparison 3") (assert (array= (array/slice @[1 2 3] 0 2) @[1 2]) "array/slice 1") diff --git a/test/suite2.janet b/test/suite2.janet index 7836e000..f791c1f0 100644 --- a/test/suite2.janet +++ b/test/suite2.janet @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Calvin Rose +# Copyright (c) 2019 Calvin Rose # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to diff --git a/test/suite3.janet b/test/suite3.janet index ef28d9c4..f53a1538 100644 --- a/test/suite3.janet +++ b/test/suite3.janet @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Calvin Rose +# Copyright (c) 2019 Calvin Rose # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to diff --git a/tools/marshal_core.janet b/tools/marshal_core.janet index cb7dcc69..2c856219 100644 --- a/tools/marshal_core.janet +++ b/tools/marshal_core.janet @@ -1,6 +1,6 @@ # # Tool to dump a marshalled version of the janet core to stdout. The -# image should eventually allow janet to be started from a precompiled +# image should eventually allow janet to be started from a pre-compiled # image rather than recompiled every time from the embedded source. More # work will go into shrinking the image (it isn't currently that large but # could be smaller), creating the mechanism to load the image, and modifying @@ -10,7 +10,7 @@ # Get image. This image contains as much of the core library and documentation that # can be written to an image (no cfunctions, no abstracts (stdout, stdin, stderr)), -# everyting else goes. Cfunctions and abstracts will be referenced from a register +# everything else goes. Cfunctions and abstracts will be referenced from a register # table which will be generated on janet startup. (def image (let [env-pairs (pairs (env-lookup _env)) essential-pairs (filter (fn [[k v]] (or (cfunction? v) (abstract? v))) env-pairs) diff --git a/tools/symcharsgen.c b/tools/symcharsgen.c index 9a2694a5..c56d57e4 100644 --- a/tools/symcharsgen.c +++ b/tools/symcharsgen.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/tools/xxd.c b/tools/xxd.c index 2f8cfcfb..90d700f3 100644 --- a/tools/xxd.c +++ b/tools/xxd.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Calvin Rose +* Copyright (c) 2019 Calvin Rose * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to