Commit Graph

119 Commits

Author SHA1 Message Date
Aryadev Chavali
8d3f4f896f stream: do not initialise file streams with a non-empty vector
Because of the not_inlined trick, a 0 initialised SBO vector is
completely valid to use if required.  Future /vec_ensure/'s will deal
with it appropriately.  So there's no need to initialise the vector
ahead of time like this.
2026-02-05 18:53:13 +00:00
Aryadev Chavali
0318dcbb65 stream: Make stream name a constant cstr
We don't deal with the memory for it anyway.
2026-02-05 18:52:47 +00:00
Aryadev Chavali
f7cfe16c67 main: Put all variable declarations at start of main to ensure decl
There is a chance that /end/ is jumped to without the FILE pointer or
stream actually being declared.  This deals with that.
2026-02-05 18:39:49 +00:00
Aryadev Chavali
3612313e76 test: TEST_INIT macro as a prologue for any unit test 2026-02-05 07:37:36 +00:00
Aryadev Chavali
762dabd3e5 tests: Better suite creation
While the previous method of in-lining a stack allocated array of
tests into the suite struct declaration was nice, we had to update
size manually.

This macro will allow us to just append new tests to the suite without
having to care for that.  It generates a uniquely named variable for
the test array, then uses that test array in the suite declaration.
Nice and easy.
2026-02-05 06:44:35 +00:00
Aryadev Chavali
61efa91403 alisp.org: add TODOs for all the tests required for streams 2026-02-05 06:32:26 +00:00
Aryadev Chavali
3add9beb59 sv: fix possible runtime issue with NULL SV's in sv_copy 2026-02-05 06:17:52 +00:00
Aryadev Chavali
df1076f7d7 tests: enable STREAM_SUITE 2026-02-05 06:17:31 +00:00
Aryadev Chavali
a809d9de25 test_stream: Enable only stream_test_string 2026-02-05 06:17:21 +00:00
Aryadev Chavali
3b14144ccc test_stream: implement stream_test_string 2026-02-05 06:17:13 +00:00
Aryadev Chavali
bd838c02ab test_stream: basic skeleton 2026-02-05 06:06:03 +00:00
Aryadev Chavali
54e9edcba6 test_lisp_api: added sys_test 2026-02-05 05:48:00 +00:00
Aryadev Chavali
b32f420cb9 lisp: split off lisp_free as it's own function
lisp_free will do a shallow clean of any object, freeing its
associated memory.  It won't recur through any containers, nor will it
freakout if you give it something that is constant (symbols, small
integers, NIL, etc).
2026-02-05 05:39:35 +00:00
Aryadev Chavali
34d3417e74 symtable: sym_table_cleanup -> sym_table_free 2026-02-05 05:39:22 +00:00
Aryadev Chavali
66770f22d9 alisp.org: Added some tasks 2026-02-05 05:35:51 +00:00
Aryadev Chavali
3d0e373862 test_lisp_api: added sym_unique_test 2026-02-05 05:34:54 +00:00
Aryadev Chavali
0e8cdd7507 test_lisp_api: sym_test -> sym_fresh_test 2026-02-05 05:34:39 +00:00
Aryadev Chavali
4d693c8a92 test_lisp_api: int_test -> smi_test, added smi_oob_test 2026-02-05 05:24:34 +00:00
Aryadev Chavali
1c88253b3c tests: fix size of LISP_API_SUITE tests 2026-02-05 05:23:38 +00:00
Aryadev Chavali
de6fcd17ee Makefile: added mode flag for full logs
MODE=full will initialise a debug build with all logs, including test
logs.  Otherwise, MODE=debug just sets up standard debug build with
main logs but no testing logs.  MODE=release optimises and strips all
logs.
2026-02-05 05:17:25 +00:00
Aryadev Chavali
91264d96e4 test: Added definition to make default testing less verbose
TEST_VERBOSE is a preprocesser directive which TEST is dependent on.
By default it is 0, in which case TEST simply fails if the condition
is not true.  Otherwise, a full log (as done previously) is made.
2026-02-05 05:16:11 +00:00
Aryadev Chavali
d88d7f7f23 tests: c23 allows you to inline stack allocated arrays in struct decls 2026-02-05 05:10:19 +00:00
Aryadev Chavali
16be3392b0 tests: slight cleanliness 2026-02-05 05:10:12 +00:00
Aryadev Chavali
2705ef9bb7 tests: Meaningful and pretty logging for tests 2026-02-05 04:56:11 +00:00
Aryadev Chavali
45ef1fa01a tests: Added string view suite
sv_copy is the only function, but we may have others later.
2026-02-05 04:48:42 +00:00
Aryadev Chavali
9095b118fd tests: split of symtable testing into its own suite
makes sense to be there, not in the lisp API
2026-02-05 04:48:42 +00:00
Aryadev Chavali
40ef094b68 alisp.org: Remove notes and overview
Not needed with what we're doing currently.  I'll make proper
documentation when I'm done.
2026-02-05 04:35:54 +00:00
Aryadev Chavali
656226c050 alisp.org: make a backlog for tasks 2026-02-05 04:35:47 +00:00
Aryadev Chavali
edb2f5c5c8 dir-locals: run testing, then examples for default compile-command
By default we should test all our code for regressions.  I'm always
running the examples anyway to test new features, so we should have
that recipe run afterwards.

If a test fails, that's first priority to fix.

If an example fails, time to continue working.
2026-02-05 04:34:29 +00:00
Aryadev Chavali
118a25055c main: the beginnings of alisp.out
We've started composing the stuff we've made so far I/O wise,
initialising a stream based off user command line input.  We even
allow stdin!
2026-02-05 04:32:48 +00:00
Aryadev Chavali
e7d3bca4d7 stream: fix bug with stream_next; return the next character
It seems we'd return the previously peeked character when
stream_next'ing, when really we should be sending the updated
character.
2026-02-05 04:29:07 +00:00
Aryadev Chavali
10d6876de4 reader: implement read_err_to_cstr 2026-02-05 04:07:59 +00:00
Aryadev Chavali
75daad53ea reader: add a few more read errors and read_err_to_cstr 2026-02-05 04:06:27 +00:00
Aryadev Chavali
1e451c57e8 stream: stream_line_col: get the line/column of stream currently
Best part is that this should only use cached data, so no chunking
required.
2026-02-05 04:04:54 +00:00
Aryadev Chavali
d14f015c38 stream: use the nonexistent errors in stream_init_* 2026-02-05 04:04:54 +00:00
Aryadev Chavali
26e545a732 stream: Rearranged STREAM_ERR to be nonzero positive
I don't know why I was thinking about having valid positive values for
STREAM_ERR.  Doesn't make sense.
2026-02-05 04:04:54 +00:00
Aryadev Chavali
169a165cfc stream: added stream_err_to_cstr
Simple routine, not really much to explain here.
2026-02-05 04:04:54 +00:00
Aryadev Chavali
438a494ac7 lisp: sys_cleanup -> sys_free 2026-02-05 04:04:54 +00:00
Aryadev Chavali
068e4aa9f0 Makefile: added -Werror to general flags
May as well remove all warnings if possible, though in most cases this
is just to ensure I catch everything and deal with it.
2026-02-05 04:04:54 +00:00
Aryadev Chavali
271e0bff9b Makefile: added examples recipe to run examples 2026-02-05 04:04:54 +00:00
Aryadev Chavali
010895331d examples: Added an example for hello world 2026-02-05 04:04:54 +00:00
Aryadev Chavali
6a75c1d9d4 Makefile: added VERBOSE_LOGS=1 declaration to DFLAGS for debug build 2026-02-05 04:04:54 +00:00
Aryadev Chavali
01b695eb6a base: implement LOG macro which only prints if VERBOSE_LOGS = 1
This allows us to make builds that don't have verbose logging, whether
they're debug or not.

We could have release builds that have verbose logging.
2026-02-05 04:04:54 +00:00
Aryadev Chavali
500661d68e LICENSE: Unlicense -> GPL Version 2 2026-02-05 04:04:54 +00:00
Aryadev Chavali
ea2f745f1e Split out tests a bit, made a stronger API for running the full test suite 2026-02-04 20:44:04 +00:00
Aryadev Chavali
0681bb4314 Not worth the trouble
You're telling me Ubuntu doesn't have a version of GCC with C23
standard?? Really???
2026-02-04 20:09:32 +00:00
Aryadev Chavali
2839da55db Update compiler choice in Makefile
Some checks failed
C/C++ CI / build (push) Has been cancelled
2026-02-04 20:08:28 +00:00
Aryadev Chavali
d4612fa0ef Merge remote-tracking branch 'github/master'
Some checks failed
C/C++ CI / build (push) Has been cancelled
2026-02-04 20:08:18 +00:00
oreodave
5de0e33fb3 Update C/C++ workflow to use debug and release modes 2026-02-04 20:07:10 +00:00
Aryadev Chavali
2d7adf595f Add testing to build system
Generate a testing executable, and provide a recipe for running it.
2026-02-04 20:06:38 +00:00