Skip to content

Releases: Sentido-Labs/cedro

Corrected continue label for consistency

21 Mar 16:08

Choose a tag to compare

The most important changes are much improved error messages and a correction to the way the continue label; works: this discussion in Reddit made me realize that it was misleading, as the jump went to outside the labeled loop, instead of going back to the loop condition which using goto is done by placing the label at the end of the block.

The new way is to put the label in front of the loop condition instead, which I find clearer than putting the label at the end of the loop. Cedro will then move the label to the end of the loop as required by the C compiler.

The old way, jumping with continue to a label right before a loop, still works for the case when you want to re-try the loop, although it is no longer shown in the examples.

Digit separators, binary number literals, Windows compatibility

04 Sep 12:19

Choose a tag to compare

There are options now to specify the desired C standard version for output, --c89, --c23 etc. which are a better way of specifying whether you want for instance the #embed directives to be expanded or not. It was a mistake to do this with parameters to the Cedro #pragma because this does not depend on how the source code is written (as in auto vs. defer) but on the C compiler being used. As such, it belongs in a command line option.

Unless --c23 is specified, digit separators, either apostrophe ' or underscore _, are removed from number literals. The underscore is a better choice, but the C committee could not use it because of compatibility with C++, which picked it because of the conflict with the custom literal suffixes that already used underscores: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2606.pdf

Also unless --c23 is specified, binary number literals such as 0b10100110 are converted to hexadecimal literals such as 0xA6.

Finally, a user (D.M.) reported problems under Microsoft® Windows which are fixed in this release by not assuming that the environment variable LANG is defined, and by using binary mode for file I/O.

Much faster binary include/embed

04 Aug 10:42

Choose a tag to compare

This release includes an alternative method for embedding binary files, using string literals instead of byte literals when possible.

It is more efficient but less compatible, activated by the option --embed-as-string=<limit>: if a file is smaller than the byte size limit, it is embedded using string literals. If not, byte literals are used.

This takes roughly the same time to generate, but in an informal test with an 8 MB file it compiled between 28 and 72 times faster depending on the compiler used.

See “Use #embed from C23 today with the Cedro pre-processor”.

Compatibility with C23

24 Jul 13:55

Choose a tag to compare

Binary inclusion now supports the upcoming standard #embed "…" syntax.
It is ignored by default to leave it to the compiler which will be much more efficient, and can be enabled by adding #embed to the Cedro #pragma: #pragma Cedro 1.0 #embed
The purpose is to make it easy to switch between C23 and C89/C99+Cedro: remove #embed from the #pragma line when using a C23 compiler, or add it when using an earlier standard.

Since C23 also repurposes auto, the existing compile-time option to use defer instead is now a run-time option, available both as a command line option --defer-instead-of-auto, and as a #pragma parameter: #pragma Cedro 1.0 defer. Can be combined with #embed by using a comma: #pragma Cedro 1.0 #embed, defer

Correct location for compiler error messages by default

28 May 08:48

Choose a tag to compare

The option --discard-comments causes the compiler error messages to point to wrong locations in some cases.
Even if #line directives are inserted everywhere, removing comments can also affect the column numbers.

This release sets that option to false by default in cedrocc.

There are no other changes.

Loop macros, label break, slices

27 Apr 18:25

Choose a tag to compare

This version adds three features:

In addition, the cedro-new template now has two variants: an interactive graphic demonstration using NanoVG, and an HTTP server draft using libuv.

It also fixes a number of mistakes, including the problem with binary inclusion where it failed if the first byte of a file was less than 16.

1.0.4 Left-associative backstitch and better error reporting.

14 Dec 17:41

Choose a tag to compare

This improves error reporting: now errors are output as #error directives so that the compiler emits an error, and the code is truncated after that to avoid polluting the error logs.

Also, the backstitch @ operator is now left-associative and can be used in exactly the same way as the functional languages listed in the documentation, threading the output of a function call as input for the next: x @ one() @ two() @ three()three(two(one(x))).

1.0.3 Accept empty backstitch segments with pre-/suffix.

07 Dec 12:16

Choose a tag to compare

1.0.2 started handling the case where there are no segments after the backstitch operator, which is useful when adding a prefix to a function call for instance, which I find easier to scan visually while still being unambiguous even without type information.
This release extends that to suffixes.

Another change is that in previous releases, NDEBUG was always defined by mistake so assertions were not checked.
That mistake was introduced in 0cd7f95 “Support disabling assertions with NDEBUG.” on 2021-07-01.

1.0.2

20 Nov 20:24

Choose a tag to compare

Bug-fix release: the previous v1.0.1 release made quote includes for files next to the main C file not be found if that path was not added explicitly to the compiler options, and the backstitch macro failed to handle the case where there is nothing after the @ operator which, although not part of the initial requirements and the manual, turned out to be useful. Supporting that case actually simplified the code a little bit.

Improved `cedrocc` amalgamation abilities.

26 Oct 12:45

Choose a tag to compare

There are no changes to the core cedro program, but cedrocc has been fixed to simplify exporting simple programs to Cedro-free standard C, by also processing includes of Cedro files when CEDRO_CC is an empty string and the output goes to stdout instead of the compiler.

When a file is included, cedrocc checks whether it has the Cedro pragma (#pragma Cedro 1.0) and if so, it inserts its translation to standard C into the output, while leaving normal included files to the compiler.

It was doing that before, just not when writing to stdout.