Occam 2.1 toolset language and library reference manual
August 1995
INMOS document number: 72-TDS-368-02
189 Pages
© SGS-Thomson 1995.
About this manual
This manual is the occam 2.1 Language and Libraries Reference Manual for the occam 2.1 Toolset.
The manual provides a language reference for the toolset and implementation data. A list of the library functions provided is followed by detailed information about each function. Details of extensions to the language are given in an appendix.
Host versions
The documentation set which accompanies the occam 2.1 toolset is designed to cover all host versions of the toolset:
- IBM 386 PC compatible running MS-DOS
- Sun 4 systems running SunOS or Solaris.
Contents
Contents overview Preface Host versions About this manual About the toolset documentation set Other documents Transputer targets supported by this toolset Documentation conventions
Libraries
1 The occam libraries 1.1 Introduction 1.2 Using the occam libraries 1.2.1 Linking libraries 1.2.2 Listing library contents 1.2.3 Library constants 2 Compiler libraries 2.1 Using compiler library routines 2.2 Mathematics functions 2.3 2D block moves 2.4 Bit manipulation functions 2.5 CRC functions 2.6 Floating point arithmetic support functions 2.7 Dynamic code loading support 2.8 Transputer-related procedures 2.9 Assertion test procedure 3 Mathematics libraries 3.1 Introduction and terminology 3.1.1 Inputs 3.1.2 Outputs 3.1.3 Accuracy 3.1.4 Test Procedures 3.1.5 Symmetry 3.1.6 The Function Specifications 3.2 Single and double length elementary function libraries ACOS, DACOS ALOG, DALOG ALOG10, DALOG10 ASIN, DASIN ATAN, DATAN ATAN2, DATAN2 COS, DCOS COSH, DCOSH EXP, DEXP POWER, DPOWER RAN, DRAN SIN, DSIN SINH, DSINH TAN, DTAN TANH, DTANH 3.3 T4 elementary function library ACOS, DACOS ALOG, DALOG ALOG10, DALOG10 ASIN, DASIN ATAN, DATAN ATAN2, DATAN2 COS, DCOS COSH, DCOSH EXP, DEXP POWER, DPOWER RAN, DRAN SIN, DSIN SINH, DSINH TAN, DTAN TANH, DTANH 4 Host file server library 4.1 Errors and the server run time library 4.2 Reading real numbers 4.3 Procedure descriptions 4.4 Host i/o procedures arranged by purpose 4.4.1 General host access 4.4.2 Keyboard input 4.4.3 Screen output 4.4.4 File access and management 4.4.5 File output 4.4.6 Server protocol buffers 4.4.7 Server protocol multiplexors 4.4.8 Host date and time 4.5 Host i/o procedure definitions so.ask so.buffer so.close so.commandline so.eof so.exit so.ferror so.flush so.fwrite.char so.fwrite.hex.int so.fwrite.hex.int32 so.fwrite.hex.int64 so.fwrite.int so.fwrite.int32 so.fwrite.int64 so.fwrite.nl so.fwrite.real32 so.fwrite.real64 so.fwrite.string so.fwrite.string.nl so.getenv so.getkey so.gets so.multiplexor so.open so.open.temp so.overlapped.buffer so.overlapped.multiplexor so.overlapped.pri.multiplexor so.parse.command.line so.pollkey so.popen.read so.pri.multiplexor so.puts so.read so.read.echo.any.int so.read.echo.hex.int so.read.echo.hex.int32 so.read.echo.hex.int64 so.read.echo.int so.read.echo.int32 so.read.echo.int64 so.read.echo.line so.read.echo.real32 so.read.echo.real64 so.read.line so.remove so.rename so.seek so.system so.tell so.test.exists so.time so.time.to.ascii so.time.to.date so.today.ascii so.today.date so.version so.write so.write.char so.write.hex.int so.write.hex.int32 so.write.hex.int64 so.write.int so.write.int32 so.write.int64 so.write.nl so.write.real32 so.write.real64 so.write.string so.write.string.nl 5 Stream i/o library 5.1 Naming conventions 5.2 Stream i/o procedures 5.2.1 Stream processes 5.2.2 Key stream input 5.2.3 Stream output 5.3 Stream i/o procedure definitions ks.keystream.sink ks.keystream.to.scrstream ks.read.char ks.read.int ks.read.int64 ks.read.line ks.read.real32 ks.read.real64 so.keystream.from.file so.keystream.from.kbd so.keystream.from.stdin so.scrstream.to.ANSI so.scrstream.to.file so.scrstream.to.stdout so.scrstream.to.TVI920 ss.beep ss.clear.eol ss.clear.eos ss.delete.chr ss.delete.chl ss.del.line ss.down ss.goto.xy ss.insert.char ss.ins.line ss.left ss.right ss.scrstream.copy ss.scrstream.fan.out ss.scrstream.from.array ss.scrstream.multiplexor ss.scrstream.sink ss.scrstream.to.array ss.up ss.write.char ss.write.endstream ss.write.hex.int ss.write.hex.int64 ss.write.int ss.write.int64 ss.write.nl ss.write.real32 ss.write.real64 ss.write.string ss.write.text.line 6 String handling library 6.1 String handling procedures 6.1.1 Character identification 6.1.2 String comparison 6.1.3 String editing 6.1.4 String searching 6.1.5 Line parsing 6.2 String handling procedure definitions append.char append.hex.int append.hex.int64 append.int append.int64 append.real32 append.real64 append.text char.pos compare.strings delete.string eqstr insert.string is.digit is.hex.digit is.id.char is.in.range is.lower is.upper next.int.from.line next.word.from.line string.pos search.match search.no.match str.shift to.lower.case to.upper.case 7 String conversion library 7.1 Procedure definitions BOOLTOSTRING HEXTOSTRING HEX16TOSTRING HEX32TOSTRING HEX64TOSTRING INTTOSTRING INT16TOSTRING INT32TOSTRING INT64TOSTRING REAL32TOSTRING REAL64TOSTRING STRINGTOBOOL STRINGTOHEX STRINGTOHEX16 STRINGTOHEX32 STRINGTOHEX64 STRINGTOINT STRINGTOINT16 STRINGTOINT32 STRINGTOINT64 STRINGTOREAL32 STRINGTOREAL64 8 Block CRC library 8.1 Example of use 8.2 Function definitions CRCFROMMSB CRCFROMLSB 9 Extraordinary link handling library 9.1 Procedure definitions InputOrFail.c InputOrFail.t OutputOrFail.c OutputOrFail.t Reinitialise 10 Debugging support library 10.1 Procedure definitions DEBUG.ASSERT DEBUG.MESSAGE DEBUG.STOP
Appendices
A Language extensions A.1 Syntax A.1.1 Compiler keywords A.1.2 Compiler directives A.1.3 String escape characters A.1.4 Tabs A.1.5 Relaxations on syntax A.2 Retyping channels to and from data items A.3 Low level programming A.3.1 ASM A.3.2 PLACE statements A.3.3 INLINE keyword B Implementation of occam on the transputer B.1 Memory allocation by the compiler B.1.1 Procedure code B.1.2 Compilation modules B.1.3 Workspace B.1.4 Vectorspace B.2 Type mapping B.3 Parameter passing B.3.1 VAL parameters B.3.2 Non-VAL parameters B.3.3 Alignment B.4 Calling sequence B.4.1 Registers B.4.2 Invocation stack B.4.3 Iret B.4.4 Parameters B.5 Implementation of channels B.6 Transputer timers (clocks) B.6.1 TIMER variables B.6.2 TIMERS as formal parameters B.7 CASE statement B.8 ALT statement B.9 Checking IF statements B.10 Implementation of PORTs B.11 Formal parameters B.12 Hardware dependencies B.13 Summary of implementation restrictions C Alias and usage checking C.1 Alias checking C.1.1 Introduction C.1.2 Rules C.1.3 Alias checking disabled C.2 Usage checking C.2.1 Introduction C.2.2 Checking of non-array elements C.2.3 Checking of arrays of variables and channels C.2.4 Arrays as procedure parameters C.2.5 Abbreviating variables and channels C.2.6 Channels C.2.7 Usage checking disabled Index