Version 1.14 – released on December 10, 2015
This is a maintenance release which uniformizes the naming of the built-in functions. This release also introduces a new functions for random number generation and type conversions.
If you experience issues that are not listed here, or simply need help with CPAL, you are much welcome to contact us.
What is new
- Added Pareto number generation functions:
uintX.rand_pareto(uintX: mult, float32: alpha)
, which returns integer values,float32.rand_pareto(alpha)
which returns real values (#253) - Added command
verbose
to turn off/on the display of variable assignments in the interpreter used in interactive mode, the default behavior is to show variable assignments (#263) - Added command-line option
-q
(for quiet) to suppress all butIO.print()
console ouputs during execution with the interpreter in the non-interactive mode - Added
my_enum.choice_uniform()
method andmy_channel.choice_uniform()
to select items at random:enum Color { BLUE, GREEN, RED, YELLOW }; var stack<int8>: a_stack_of_int[10]; processdef MyProc() { state Main { IO.println("%u", uint32.cast(Color.choice_uniform())); IO.println("%d", a_stack_of_int.choice_uniform()); } } process MyProc: aTask[50ms](); init() { a_stack_of_int.push(7); a_stack_of_int.push(0); a_stack_of_int.push(-4); }
- Added the following functions:
uintX.min(a, b)
,intX.min(a, b)
,uintX.max(a, b)
,intX.max(a, b)
with X in {8, 16, 32, 64}, as well astime64.min(a, b)
,time64.max(a, b)
(#141)
What has been fixed or improved
time()
function is deprecated and replaced bytime64.time()
(#206)print()
andprintln()
functions are deprecated and replaced resp. byIO.print()
andIO.println()
(#203)init() { var time64: time_4s45ms3ns = 4s + 45ms + 3ns; var time64: time_max = time64.LAST; var uint8: uint8_max = uint8.LAST; var int64: int64_min = int64.FIRST; IO.println("%t\n%t\n%u\n%d", time_4s45ms3ns, time_max, uint8_max, int64_min); }
- Fixed: more accurate parser error messages on arithmetic operations with incompatible types (#223)
syncIO()
is deprecated and replaced byIO.sync()
- Parameter of
exit()
changed touint8
(like exit codes on Unix) - Restricted
IO.print()
andIO.println()
arguments to primitive types, this means that enums must be explicitely casted (#221) pid()
is deprecated and replaced byself.pid
processdef MyProc() { ... var uint32: thisPID = self.pid; ... } process MyProc: task1[10ms](); process AnotherProc: task2[10ms](task1.pid);
- Renamed following built-in functions to snake case to respect CPAL naming conventions:
max_size()
,is_empty()
,not_empty()
,is_full()
,not_full()
andremove_current()
(#273) - [CPAL-editor] Fixed: CTRL+E shortcut to run interpreter in external terminal does not work on Windows (#256)
- [CPAL-editor] Fixed: default file extension for html export of CPAL source file is wrong (#266)
Code metrics and overhead data
- Test code coverage for the execution engine: 87.2% (lines of code), 92.2% (functions) and 77.2% (branches)
- Tests: parser=3603, interpreter=671, embedded targets=268
- Timing overhead (Cortex M4 at 120MHz with floating point unit): timer interrupt = 0.6us, scheduler overhead at process activation = 1.6us + n x 4.6 us where n is the number of active processes, process switching time = 2us