This makes sure that we catch all leftover instances of using SYB to do generic operations that we should be using Polyplate for instead. Most modules should only import Data, and possibly Typeable.
An implicitly used module is equivalent to a #USE directive before the first line of the main file. This, combined with changes in occbuild, are my current way of implementing the automatic use of the forall module in occam.
The previous method, using the C preprocessor was both nasty, and crazily resource-intensive. The new method stores stack size information in files that are read in and processed by the compiler when it comes time to link.
Now that we support separate compilation, some of the stack sizes for PROCs depend on the stack sizes of other PROCs that were compiled in different files. We can't just assume the default 512 bytes for these "foreign" PROCs, because that often won't be enough. So instead, we must make the stack sizes for the current PROCs depend on (i.e. use in the calculation) the stack sizes of the foreign PROCs.
This dependence adds some issues though. We cannot declare in one C file a const int that depends on the value of an extern const int from another C file (not valid C, it seems). So instead, we move all the stack size declarations to header files, and use #includes and the preprocessor to make sure that the stack sizes are statically determined.
This in turn simplifies the build process in some ways. These headers only need to be compiled by the .occ file that has the main process, by including them all into a C file and compiling that as before. It means that each .occ file only has one .o file resulting (plus two C headers*, and a .inc file) so linking is a bit less confusing.
* I am keeping the two C headers for now, rather than appending the sizes one to the normal header, because I'm not entirely sure whether having one header that the C file depends on may trigger a recompilation that we don't want in some build systems. I can always merge them later if that's not a valid worry.
This just about works, but it allocates the usual 512 bytes for all external PROCs being called, rather than using the actual stack_size for those external PROCs (this causes popcorn to overflow the stack if left with the default 512 bytes)
This falls a bit outside the compiler's remit, but it will be the same code to print out the lexed occam without highlighting, which I plan to use for doing libraries with Tock in a bit.
This changes the TLP code to use CCSP's stand-alone mode, and gets rid of the
old KRoC wrapper stuff. It also changes occam_stop everywhere in order to pass
the number of arguments (since ExternalCallN needs that now), and cleans up the
interaction with the C++ backend a bit.
The temporary files used during compilation are now just the output name with
an appropriate extension added (so when compiling to cgtest02, it'll produce
cgtest02.cpp, etc.). This is what GCC and KRoC do; it keeps the temp files with
the binaries that were produced from them, and avoids having to pick a sensible
directory to put randomly-named temp files in.
This particular file was badly in need of some love, being some of the first
code I wrote on Tock, and thus being a mix of my early style, my late style,
and Neil's style. I've cleaned it up quite a bit, fixing whitespace damage and
dodgy indentation, and making sure lists are alphabetised.