Skip to content

Commit d3b6b34

Browse files
authored
Merge pull request #5 from thwill1000/thwill-alpha5
Merge thwill-alpha5 branch into main
2 parents e8e6f24 + 9ed2965 commit d3b6b34

File tree

124 files changed

+9725
-2193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+9725
-2193
lines changed

CMakeLists.txt

Lines changed: 151 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,24 @@ FetchContent_MakeAvailable(googletest)
2121
add_definitions(-funsigned-char)
2222

2323
if (MMB4L_COVERAGE)
24+
message("** Configuring with code-coverage")
2425
set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
2526
set(GCC_COVERAGE_LINK_FLAGS "-lgcov")
2627
set(GCOV_LINK_LIBRARY gcov)
2728
endif()
2829

29-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wwrite-strings")
30-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wwrite-strings")
30+
set(XTRA_WARNING_FLAGS "-Wwrite-strings -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-result -Werror")
31+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} ${XTRA_WARNING_FLAGS}")
32+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} ${XTRA_WARNING_FLAGS}")
3133
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
3234

3335
set(MMB4L_CORE_SOURCE_FILES
36+
src/core/Commands.c
37+
src/core/Functions.c
38+
src/core/funtbl.c
3439
src/core/MMBasic.c
3540
src/core/Operators.c
36-
src/core/Functions.c
37-
src/core/Commands.c
41+
src/core/vartbl.c
3842
)
3943

4044
set(MMB4L_COMMANDS_SOURCE_FILES
@@ -50,6 +54,7 @@ set(MMB4L_COMMANDS_SOURCE_FILES
5054
src/commands/cmd_dummy.c
5155
src/commands/cmd_edit.c
5256
src/commands/cmd_end.c
57+
src/commands/cmd_erase.c
5358
src/commands/cmd_error.c
5459
src/commands/cmd_execute.c
5560
src/commands/cmd_files.c
@@ -190,6 +195,8 @@ add_executable(
190195
test_cmdline
191196
src/common/cmdline.c
192197
src/common/cstring.c
198+
src/common/memory.c
199+
src/common/parse.c
193200
src/common/gtest/cmdline_test.cxx
194201
)
195202

@@ -203,6 +210,34 @@ target_link_libraries(
203210

204211
gtest_discover_tests(test_cmdline)
205212

213+
################################################################################
214+
# test_cmd_run
215+
################################################################################
216+
217+
add_executable(
218+
test_cmd_run
219+
src/commands/cmd_run.c
220+
src/commands/gtest/cmd_run_test.cxx
221+
src/common/cstring.c
222+
src/common/memory.c
223+
src/common/mmresult.c
224+
src/common/parse.c
225+
src/core/funtbl.c
226+
src/core/MMBasic.c
227+
src/core/vartbl.c
228+
src/functions/fun_mmcmdline.c
229+
)
230+
231+
target_link_libraries(
232+
test_cmd_run
233+
gtest_main
234+
gmock
235+
gmock_main
236+
${GCOV_LINK_LIBRARY}
237+
)
238+
239+
gtest_discover_tests(test_cmd_run)
240+
206241
################################################################################
207242
# test_cstring
208243
################################################################################
@@ -222,6 +257,43 @@ target_link_libraries(
222257

223258
gtest_discover_tests(test_cstring)
224259

260+
################################################################################
261+
# test_funtbl
262+
################################################################################
263+
264+
add_executable(
265+
test_funtbl
266+
src/core/funtbl.c
267+
src/core/gtest/funtbl_test.cxx
268+
)
269+
270+
target_link_libraries(
271+
test_funtbl
272+
gtest_main
273+
gmock
274+
gmock_main
275+
)
276+
277+
gtest_discover_tests(test_funtbl)
278+
279+
################################################################################
280+
# test_hash
281+
################################################################################
282+
283+
add_executable(
284+
test_hash
285+
src/common/gtest/hash_test.cxx
286+
)
287+
288+
target_link_libraries(
289+
test_hash
290+
gtest_main
291+
gmock
292+
gmock_main
293+
)
294+
295+
gtest_discover_tests(test_hash)
296+
225297
################################################################################
226298
# test_options
227299
################################################################################
@@ -255,6 +327,7 @@ gtest_discover_tests(test_options)
255327
add_executable(
256328
test_parse
257329
src/common/cstring.c
330+
src/common/memory.c
258331
src/common/parse.c
259332
src/common/gtest/parse_test.cxx
260333
)
@@ -312,6 +385,27 @@ target_link_libraries(
312385

313386
gtest_discover_tests(test_program)
314387

388+
################################################################################
389+
# test_prompt
390+
################################################################################
391+
392+
add_executable(
393+
test_prompt
394+
src/common/cstring.c
395+
src/common/prompt.c
396+
src/common/gtest/prompt_test.cxx
397+
)
398+
399+
target_link_libraries(
400+
test_prompt
401+
gtest_main
402+
gmock
403+
gmock_main
404+
${GCOV_LINK_LIBRARY}
405+
)
406+
407+
gtest_discover_tests(test_prompt)
408+
315409
################################################################################
316410
# test_rx_buf
317411
################################################################################
@@ -331,3 +425,56 @@ target_link_libraries(
331425
)
332426

333427
gtest_discover_tests(test_rx_buf)
428+
429+
################################################################################
430+
# test_mmbasic_core
431+
################################################################################
432+
433+
add_executable(
434+
test_mmbasic_core
435+
src/common/cstring.c
436+
src/common/file.c
437+
src/common/interrupt.c
438+
src/common/memory.c
439+
src/common/mmresult.c
440+
src/common/mmtime.c
441+
src/common/parse.c
442+
src/common/path.c
443+
src/common/program.c
444+
src/common/rx_buf.c
445+
src/common/serial.c
446+
src/core/funtbl.c
447+
src/core/MMBasic.c
448+
src/core/vartbl.c
449+
src/core/gtest/mmbasic_core_test.cxx
450+
)
451+
452+
target_link_libraries(
453+
test_mmbasic_core
454+
gtest_main
455+
gmock
456+
gmock_main
457+
${GCOV_LINK_LIBRARY}
458+
)
459+
460+
gtest_discover_tests(test_mmbasic_core)
461+
462+
################################################################################
463+
# test_vartbl
464+
################################################################################
465+
466+
add_executable(
467+
test_vartbl
468+
src/core/vartbl.c
469+
src/core/gtest/vartbl_test.cxx
470+
)
471+
472+
target_link_libraries(
473+
test_vartbl
474+
gtest_main
475+
gmock
476+
gmock_main
477+
${GCOV_LINK_LIBRARY}
478+
)
479+
480+
gtest_discover_tests(test_vartbl)

ChangeLog

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,84 @@
11
ChangeLog
22
---------
33

4+
Version 0.5.0 - 3-Feb-2023:
5+
- Changed to semantic versioning scheme.
6+
Note that MMB4L is still versioned independently of Geoff and Peter's
7+
"mainline" MMBasic platforms.
8+
- MM.INFO(VERSION) will return the integer 5000000 for this release,
9+
divide by 10000000 to get float equivalent, e.g. 0.5
10+
- MM.INFO(VERSION MAJOR) will return major version, 0 for this release.
11+
- MM.INFO(VERSION MINOR) will return minor version, 5 for this release.
12+
- MM.INFO(VERSION MICRO) will return minor/patch version, 0 for this
13+
release.
14+
- MM.INFO(VERSION BUILD) will return the build number, 0 for this
15+
release and only included for use in some theoretical future.
16+
- Added "automatic path completion" to the MMBasic prompt.
17+
- Pressing TAB will attempt to complete (as far as can be unambiguously
18+
determined) a filename that the user is typing at the prompt, or sound
19+
the console bell if no completion is possible.
20+
- Added MM.INFO(CALLDEPTH) to return the current function/subroutine call
21+
depth.
22+
- 0 when at the global level, i.e. not in a function/subroutine.
23+
- Primarily for debugging purposes, though a possible production
24+
use-case would be to allow a program to "bail out" if recursion gets
25+
too deep.
26+
- Added MM.INFO(PID) to get the process ID of the MM4L process.
27+
- Added MM.INFO(CPUTIME) to get the value (in nanoseconds) of the CPU timer
28+
for the MMB4L process.
29+
- Changed function, label, subroutine and variable lookup to use hashmap.
30+
- Depending on the problem this might be expected to produce a 3-5%
31+
improvement in performance.
32+
- Changed syntax of RUN command to:
33+
RUN [file$] [, cmdline$]
34+
Both file$ and cmdline$ can now be string expressions instead of
35+
the legacy behaviour where the command line argument was "not processed" by
36+
MMBasic and was copied verbatim into the MM.CMDLINE$ of the new program.
37+
- This change means that cmdline$ can now be constructed from other
38+
variables and functions instead of having to be hardcoded, or
39+
finessed by using EXECUTE to construct the RUN statement.
40+
- If the text following the comma contains an unquoted minus sign then
41+
for backward compatibility MMB4L trys to use the legacy behaviour,
42+
but this does not work for all possible legacy command lines.
43+
Note that the behaviour of the * command is unchanged; expressions in any
44+
command line provided via * are not evaluated by MMB4L, e.g.
45+
*foo a$ + b$
46+
is equivalent to:
47+
RUN "foo", "a$ + b$"
48+
- Changed RUN file$ so that it is not necessary for file$ to have a ".bas"
49+
extension.
50+
- If file$ does not exist then will try appending the extensions
51+
".bas", ".BAS" and ".Bas" in turn.
52+
- Changed #INCLUDE "<file>" so that it is not necessary for <file> to have
53+
a ".inc" extension.
54+
- If <file> does not exist then will try appending the extension
55+
".inc", ".INC" and ".Inc" in turn.
56+
- Changed XMODEM to improve read/write performance.
57+
- It now reads/writes 128 characters at a time instead of 1.
58+
- Changed MMBasic prompt so that you can access the history with the up
59+
and down cursors even after you start typing a command.
60+
- Changed some error messages to be clearer and/or more specific.
61+
- Changed "mmbasic.syntax.nanorc" to improve syntax highlighting of comments.
62+
- Even so it is still not 100% correct.
63+
- Fixed bug where relative #INCLUDE files could not be found when running
64+
a symbolic link to an MMBasic file.
65+
- The path to the #INCLUDE files was incorrectly being resolved relative
66+
to the parent of the symbolic link instead of the parent of the target
67+
file.
68+
- Fixed several bugs with identifiers allowing / being limited to 32
69+
characters (not including variable/function type suffix).
70+
- Fixed bug with GOSUB/RETURN corrupting the interpreter state when using
71+
ON ERROR SKIP.
72+
- Fixed bug where function returns corrupted the interpreter state when using
73+
ON ERROR SKIP.
74+
- Fixed bug where an "Internal fault" error would be reported immediately if
75+
the console/tty dimensions could not be determined when displaying the
76+
MMBasic prompt.
77+
- This can be a transient problem so MMB4L now retries for 1 second
78+
before reporting a "Cannot determine terminal size" error.
79+
- Fixed bug in OPTION LIST for F<num> function key options whose values
80+
contained carriage-return character.
81+
482
Version 2022.01.00-a4 - 15-May-2022:
583
- MMB4L is now open-source and licensed under a modified 4-clause BSD license
684
similar to that for the PicoMite firmware and MMBasic for Windows. See the

LICENSE.MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MMBasic for Linux (MMB4L)
1212

1313
MIT License
1414

15-
Copyright (c) 2020-2022 Thomas Hugo Williams
15+
Copyright (c) 2020-2023 Thomas Hugo Williams
1616

1717
Permission is hereby granted, free of charge, to any person obtaining a copy
1818
of this software and associated documentation files (the "Software"), to deal

LICENSE.MMBasic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MMBasic for Linux (MMB4L)
22
=========================
33

4-
Copyright 2021-2022 Geoff Graham, Peter Mather and Thomas Hugo Williams.
4+
Copyright 2021-2023 Geoff Graham, Peter Mather and Thomas Hugo Williams.
55

66
Redistribution and use in source and binary forms, with or without
77
modification, are permitted provided that the following conditions are met:

0 commit comments

Comments
 (0)