Commit Graph

147 Commits

Author SHA1 Message Date
Neil Brown
ffd09847fe Removed genBytesIn' from the GenOps, in favour of adding a parameter to genBytesIn, and changed the tests and code accordingly 2007-10-13 14:51:29 +00:00
Neil Brown
d5d4580aa3 Changed the type of genSlice, and put the C++ version into the GenOps dictionary, as well as adding tests for the function 2007-10-13 13:20:40 +00:00
Neil Brown
886659fd09 Changed the C++ backend to pass the RETYPES tests (primarily white-space changes, and also reordering the parameters for tockArrayView) 2007-10-13 12:58:20 +00:00
Neil Brown
ec43e592f0 Fixed the initialisation of C++ channel arrays to initialise the correct array 2007-10-11 01:32:36 +00:00
Neil Brown
8d0b5fbe1a Added a helper function for receiving an array of bytes, and changed the C++CSP backend and tests to use the function 2007-10-11 00:51:07 +00:00
Neil Brown
cc2040679b Changed the C and C++ backends to pass the input tests 2007-10-10 20:46:23 +00:00
Neil Brown
5b10466e68 Fixed the channel arrays (and abbreviations thereof) to have the correct types (correcting an earlier mistake), and added helper functions to the support headers for easy initialisation of the arrays 2007-10-07 23:03:15 +00:00
Neil Brown
5e1e51ac15 Refactored the C++ genOutputItem to merge some duplicate code 2007-10-06 23:08:05 +00:00
Neil Brown
9af1ec78bb Fixed all the tests for sending items in C++, and made the tests pass 2007-10-06 23:05:03 +00:00
Neil Brown
6d29bbd260 Added some tests for outputs in the C and C++ backends, but the C++ backend needs fixing 2007-10-06 18:20:55 +00:00
Neil Brown
3b20d18937 Added tests for the genOutput and genOutputCase functions, corrected the C++ code, and added some helper functions to the C++ support header 2007-10-06 17:05:49 +00:00
Neil Brown
97ee0c4a4e Added tests for ProtocolCase in introduceSpec, and made the C++ version behave the same as the C version 2007-10-06 16:35:02 +00:00
Neil Brown
03a4b8e41b Removed the generate of tuples for sequential protocols in C++, since we're now using a byte-array approach 2007-10-06 16:22:51 +00:00
Neil Brown
062851dabf Added tests for introduceSpec and Is, for all types except arrays 2007-10-06 15:55:18 +00:00
Neil Brown
c3fad80f06 Changed the behaviour of the C++ version of declareArraySizes, moving towards potentially merging more of the C++ array handling with the C array handling 2007-10-06 12:49:30 +00:00
Neil Brown
e7cdaf2e90 Changed the type of genArraySizesLiteral, added tests for the C++ version and implemented the C++ version 2007-10-06 12:31:14 +00:00
Neil Brown
8ea4ad79e8 Changed the type of declareArraySizes, and added a C++ implementation of it 2007-10-06 12:22:40 +00:00
Neil Brown
071172954d Removed redundant/common code in the C++ backend relating to arrays 2007-10-06 11:59:29 +00:00
Neil Brown
a583403372 Removed the C++ code for IsChannelArray, so that the C version is used instead 2007-10-06 11:40:10 +00:00
Neil Brown
c521187cd2 Added a genArrayStoreName function to GenOps and implemented it for both C and C++ 2007-10-06 11:30:03 +00:00
Neil Brown
9d5164d9c1 Changed the generation of the record structs to use the altered genDeclaration (that can now generate declarations for inside records) 2007-10-05 20:06:11 +00:00
Neil Brown
904d1e8f5f Changed the genDeclaration function so that it can either generate stand-alone declarations (as it did before), or declarations inside records 2007-10-05 19:01:42 +00:00
Neil Brown
34609f1fee Corrected the C++ tests and implementation of arrays inside records -- the dimensions of the tockArrayView were not being set, but they should be. 2007-10-05 17:52:37 +00:00
Neil Brown
8cd20b9906 Changed the C++ implementation of introduceSpec to fall through to the C implementation for all unhandled cases (which will remove duplicate code) 2007-10-05 17:51:00 +00:00
Neil Brown
9effe37977 Removed the declareType function from GenOps (it has been merged with genType) and changed the C++ channel types to pass the new genType tests 2007-10-05 17:01:17 +00:00
Neil Brown
1f8a5555ac Added a test for genIf in the C and C++ backends 2007-10-04 14:36:56 +00:00
Neil Brown
af74ac1039 Added a test of genGetTime for the C and C++ backends 2007-10-04 14:06:15 +00:00
Neil Brown
b4ac249367 Changed the C and C++ channel arrays to be actual arrays of channels, not arrays of channel pointers as they were before.
The effects of this change will not be fully tested until further tests have been written (especially for genVariable).
2007-10-04 00:53:25 +00:00
Neil Brown
93610a5837 Changed the C++ arrays to use standard C-like arrays rather than std::vector as they used to 2007-10-04 00:19:38 +00:00
Neil Brown
b8556bfe6d Refactored some of the tested functions in the C and C++ backends to use genSizeSuffix rather than using _sizes/.extent directly 2007-10-04 00:07:15 +00:00
Neil Brown
f3e15b6f78 Changed the C genOverArray function to pass the test, and removed the now-redundant C++ version 2007-10-03 23:18:53 +00:00
Neil Brown
65fb758dbd Added tests for genDeclaration, and tweaked the backends to make the tests pass 2007-10-03 17:58:59 +00:00
Neil Brown
1f8bb0e44a Removed the genVariable' function from GenOps
Now that the C++ generator no longer overrides genVariable', it seems wise to remove it from the GenOps function dictionary.

You can call it via either genVariable or genVariableUnchecked anyway, so genVariable' is just used by the two former functions as implementation.  It can easily be put back into the dictionary later on, if that turns out to be necessary.
2007-10-03 16:57:03 +00:00
Neil Brown
9b96ea9899 Removed the C++CSP implementation of genVariable' by adding a new function (genDirectedVariable) that represents the only change from the C version (and added C and C++ version of genDirectedVariable accordingly) 2007-10-03 16:55:48 +00:00
Neil Brown
4111dd3cb7 Added a test for genArraySubscript, and made the C and C++ backends pass it 2007-10-03 16:43:07 +00:00
Neil Brown
e17367edfa Simplified the GenOps by removing a function (genArrayAbbrev) that did not need to be in there 2007-10-03 15:23:32 +00:00
Neil Brown
8a2894893c Changed the GenerateC[PPCSP] modules to pass the current tests (just a matter of changing the spacing in the output) 2007-10-03 14:08:34 +00:00
Neil Brown
639b662a98 Starting making the spacing in the generated C and C++ code consistent, so that it passes the tests 2007-10-02 14:50:04 +00:00
Neil Brown
15ecb2b178 Added the -fwarn-type-defaults compiler option (for when integer literals are given a default type) and fixed the few warnings that arose from doing so 2007-09-27 13:29:16 +00:00
Neil Brown
38c409d378 Added the -fwarn-unused-imports compiler option to warn about unused imports, and then set about pruning and ordering (mostly in my code) the import lists for all the modules 2007-09-27 13:13:46 +00:00
Neil Brown
4a0732629d Added support for the new AlternativeWait guard to the C++ backend 2007-09-27 10:05:31 +00:00
Neil Brown
41d4923e9c Added support for the new Wait process to the C and C++ backends 2007-09-26 23:18:21 +00:00
Neil Brown
b280158e26 Added code in the C and C++ backends for handling the new Time type and GetTime statements in the AST 2007-09-19 10:34:49 +00:00
Neil Brown
3e342a621c Added ShowOccam and ShowRain type-classes, and changed existing code to use these new show methods in error messages
The function showCode shows code as either occam or Rain depending on the frontend.  This is then used by a formatCode function that acts similar to 
printf, which makes it easy to format error messages that use showCode.
2007-09-16 17:20:57 +00:00
Neil Brown
8af4a9f687 Added generation of forward declarations to the C and C++ backends.
These declarations are necessary for recursive functions/procs, so that the (forward) declarations are visible to the implementations.

Later on, the declarations could be moved into header files, which would allow multiple source files to be compiled (generating multiple header files) and linked together using the gcc linker.  Alternatively, external C/C++ programs could use code originally written in occam/Rain by including the header files.
2007-09-12 12:09:35 +00:00
Neil Brown
aefb02caa6 Added missing cases for A.DirectedVariable in the C and C++ backends 2007-09-12 10:17:15 +00:00
Neil Brown
2ff46a9041 Rearranged the Rain source files, renamed a couple of Rain files, and changed the Makefile accordingly. 2007-09-10 17:28:57 +00:00