INFORMATION ON SYNCHRONOUS C (AKA SYNCCHARTS IN C) ================================================== The most interesting file is sc.h, which defines the SC macros. Most C files included in this distribution are examples that illustrate the usage of these macros. For further information, visit the SC Homepage: http://www.informatik.uni-kiel.de/rtsys/sc/ The technical background is explained in a technical report: http://rtsys.informatik.uni-kiel.de/~biblio/downloads/papers/report-0910.pdf http://rtsys.informatik.uni-kiel.de/~biblio/cgi-bin/bibcgi.cgi?key=vHanxleden09 An abridged version of that report: http://rtsys.informatik.uni-kiel.de/~biblio/downloads/papers/emsoft09.pdf http://rtsys.informatik.uni-kiel.de/~biblio/cgi-bin/bibcgi.cgi?key=vHanxleden09a REVISION INFORMATION ==================== ----------- Release 1.6.3, 14 March 2010 ----------- * Added self checking for causality, priority uniqueness, added corresponding check-* examples, adapted Makefile. * Brought compiler switches into canonical form ("_SC_*") and consolidated them a bit (got rid of _SC_TRACE and _SC_SUPPRESS_ERROR_EXIT). * To be more compliant with established Esterel practice, added RESET() operator, eliminated isInit-argument from TICKSTART(). ----------- Release 1.6.2, 22 February 2010 ----------- * Fixed bug in PRIO (thanks to Claus Traulsen for detecting it) * Added assertion to PRIO(p) to ensure that p is not already in use by an enabled thread * Cleaned up Exits examples ----------- Release 1.6.1, 30 November 2009 ----------- * Several changes under the hood, with simplifications of the switch-case logic handling introduced in Release 1.6. The main change was to replace break statements with goto's. Hence we don't have the headaches anymore of having to propagate breaks (no need anymore for _break and _while, see notes on Rel. 1.6). Also, can now again wrap SC macro definitions in 'do ... while (1), which makes them then/else safe and allows their usage in an arbitrary context. * Added Mailing List rt-sc-sj@informatik.uni-kiel.de, see https://lists.informatik.uni-kiel.de/mailman/listinfo/rt-sc-sj/ ----------- Release 1.6, 10 November 2009 ----------- * Added switch-case logic handling. - This is an alternative to the continuation handling via computed goto. It can be used with C compilers that don't support computed goto (unlike eg gcc). - The switch-case alternative is taken when the macro _SC_SWITCHLOGIC is defined, eg with a " -D _SC_SWITCHLOGIC" compiler switch. - As continuations are not specified as C labels, but instead as int's (see definition of labeltype), continuation identifiers must be declared. The alternative would have been to make do without identifiers, just using literal int constants, but that did not seem so nice and would have required substantial rewriting of the examples. One way to declare continuation identifiers is via an enumeration type. The Makefile target "%-switch.c:" automates this declaration of continuation identifiers. The target takes a foo.c, looks for all labels, and generates a foo-switch.c that defines an enumeration type _labeltype that includes these labels, and the standard labels generated by the macros. This Makefile target also converts labels into case statements. - In addition to the labels declared in _labeltype, which are interpreted as integers 0..n-1, where n is the number of labels, there are also the labels generated automatically (__LABEL__/__LABELL__ macros). The current definition of these labels ensures that these do not conflict with each other (__LABEL__ is even, __LABELL__ is odd). However, depending on the source lines where these automatic labels are generated and the size of n, there might be a conflict between the automatically generated labels and the other labels. This conflict would not be detected by the compiler, as the compiler checks for duplicate C labels, but not for conflicts between duplicate cases in a switch statement. For serious usage of SC, this issue should be resolved. For example, one might generate _labeltype after expanding the macros, which would require to first run foo.c through the C preprocessor and to construct _labeltype based on that. This would require some adaptation of the Makefile, which currently does not invoke the preprocessor, and assumes at most one label per line. - Compared to computed goto, there is (probably) a performance penalty, and there are also some inconveniences at the programmer level. Specifically, the dispatching employs a "break" statement, which is supposed to break out of the big enclosing switch statement. This mechanism breaks (ie, fails) if an SC macro that calls the dispatcher (eg, PAUSE) is enclosed in some iteration statement, or another switch statement, since then the "break" will not refer to the outer switch statement anymore, but instead to the enclosing iteration/switch statement. The _break macro has been added to still allow dispatching SC macros within user-defined iteration/switch statements. Specifically, one has to augment these statements with a following _break statement, which conditionally propagates a break. There is also a _while macro, to be used in do-while loops, which includes the _break. "do { ... } _while (cond)" expands to "do { ... } while (cond); _break". The _while macro can _not_ be used in a while loop, only do-while! With the current distribution of benchmarks, PCO.c uses the _break macro explicitly, all other examples use it implicitly as _while. [NOTE: THIS RESTRICTION HAS BEEN REMOVED AS OF RELEASE 1.6.1] - For the same reason, when using the switch/case logic, one cannot anymore use the "do ... while (0)" approach for making macros then/else-safe (see comment on _BEGIN/_END macros). This may require adding some braces in the source code, eg "if (...) then { PAUSE; } else ..." instead of just if (...) then PAUSE; else ...". [NOTE: THIS RESTRICTION HAS BEEN REMOVED AS OF RELEASE 1.6.1] * Added "-Wall -Wno-unused-variable -Wno-unused-label" compiler switches ----------- Release 1.5, 7 October 2009 ----------- * Folded id/prio mechanism into just prios. * Dumped PAR/PARE, introduced FORK/FORKE, with fewer args. * Mixed conventional C code into examples. * Added *-sc.c versions of examples that have tick function with SC operators only. * Added ABORT ----------- Release 1.4.3, 25 September 2009 ----------- * Added AWAIT, AWAITI, PRESENTE ----------- Release 1.4.2, 23 September 2009 ----------- * Added ABRO-expanded-annotated.c, ABRO-expanded-stripped.c * Slightly reorganized operators, making up my mind on semantically primitive operators (see revised notes on 1.4 below). * Updated (draft) technical report on SC, see http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/papers/report-0910.pdf ----------- Release 1.4.1, 23 September 2009 ----------- * Made Makefile look in current directory, added missing benchmarks (thanks to Claus Traulsen) * Added IfElseSafe robustness benchmark, to illustrate if/else issue (see notes on 1.4, below) ----------- Release 1.4, 23 September 2009 ----------- * Added macros __LABEL__, __LABELL__ to automatically create labels (thanks to Nicolas Berthier) Using these label macros, the following operators have been changed to not require a label anymore: JOIN [= else: JOINE(else)] PAUSE PRIO(p) Also added: // IF descendants have terminated, THEN proceed, ELSE pause, resume at 'else'. JOINE(else) The original JOIN/PAUSE/PRIO operators have been renamed as follows (the "G" suffix abbreviates a GOTO): JOINEG(then, else) [= JOINE(else); GOTO(then)] PAUSEG(label) [= PAUSE; GOTO(label)] PRIOG(p, label) [= PRIO(p); GOTO(label)] Semantically, JOINE, PAUSE, and PRIO are considered _primitive operators_, and JOIN, JOINEG, PAUSEG, and PRIOG _derived operators_. These primitive operators have been chosen to have the minimal number of visible labels. However, in terms of implementation, JOIN, JOINEG, PAUSEG, and PRIOG are the basic operators, from which the others are derived. These basic operators make all labels explicit. The semantically primitive operators are implemented with these basic and automatically created labels. * Embedded complex macros in "do { ... } while (0)", to handle situations such as "if (...) MACRO; else" (thanks to Nicolas Berthier) * For code compaction, added dispatcher sharing (thanks to Jan Lukoschus for suggesting this). This is enabled when mergeDispatch is defined. * Added HALT, SUSTAIN * Doxygen: Reformatted comments, added Makefile target 'doxy', added links to project home page * Added Makefile targets for crude code size statistics, using wc ----------- Release 1.3.3, 11 July 2009 ----------- * Added README.txt, LICENSE.txt ----------- Release 1.3.2, 19 June 2009 ----------- * Fixed bug when disabling tracing (thanks to Björn Duderstadt) ----------- Release 1.3.1, 15 June 2009 ----------- * Fixed bug in selectCidNoprio (thanks to Miro Spoenemann) ----------- Release 1.3, 10 June 2009 ----------- * Added state tracing (thanks to Vasco Grossmann for hint on #arg preprocessor directive) ----------- Release 1.2, 20 May 2009 ----------- * As documented in Technical Report 0910 ----------- Release 1.1, 11 May 2009 ----------- * Added fast dispatcher, based on x86 bsr ----------- Release 1.0, 5 March 2009 ----------- * Initial version