SaCStandard Library Interface

SaC Standard Library Interface

1 Utrace

1.1 UTrace.sac

/*-----------------------------------------------*/
module UTrace;
export all except { PrintSeparator, PrintHeader, Indent};
use StdIO : all;
use Structures : all;
use ArrayFormat : all;
use Indent : all;
/*
 *  global objects
 */
Indent offset = newIndent( 0) ;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * PrintSeparator(...) [ body ]
 ****************************************************************************/
void  PrintSeparator( string pattern)
/****************************************************************************
 * PrintHeader(...) [ body ]
 ****************************************************************************/
void  PrintHeader( string modName, int line)
/****************************************************************************
 * PrintFunEnter(...) [ body ]
 ****************************************************************************/
void  PrintFunEnter( string modName, int line, string funName)
/****************************************************************************
 * PrintFunLeave(...) [ body ]
 ****************************************************************************/
void  PrintFunLeave( string modName, int line, string funName)
/****************************************************************************
 * PrintArgsDone(...) [ body ]
 ****************************************************************************/
void  PrintArgsDone( string modName, int line, string funName)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( int[+] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( int[.,.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( int[.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( int arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( float[+] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( float[.,.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( float[.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( float arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( double[+] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( double[.,.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( double[.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( double arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( bool[+] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( bool[.,.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( bool[.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( bool arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( char[+] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( char[.,.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( char[.] arr)
/****************************************************************************
 * indentedShow(...) [ body ]
 ****************************************************************************/
void  indentedShow( char arr)
/****************************************************************************
 * PrintArg(...) [ body ]
 ****************************************************************************/
void  PrintArg( string modName, int line, string var, int[*] x)
/****************************************************************************
 * PrintArg(...) [ body ]
 ****************************************************************************/
void  PrintArg( string modName, int line, string var, float[*] x)
/****************************************************************************
 * PrintArg(...) [ body ]
 ****************************************************************************/
void  PrintArg( string modName, int line, string var, double[*] x)
/****************************************************************************
 * PrintArg(...) [ body ]
 ****************************************************************************/
void  PrintArg( string modName, int line, string var, bool[*] x)
/****************************************************************************
 * PrintArg(...) [ body ]
 ****************************************************************************/
void  PrintArg( string modName, int line, string var, char[*] x)
/****************************************************************************
 * PrintAssign(...) [ body ]
 ****************************************************************************/
void  PrintAssign( string modName, int line, string var, int[*] x)
/****************************************************************************
 * PrintAssign(...) [ body ]
 ****************************************************************************/
void  PrintAssign( string modName, int line, string var, float[*] x)
/****************************************************************************
 * PrintAssign(...) [ body ]
 ****************************************************************************/
void  PrintAssign( string modName, int line, string var, double[*] x)
/****************************************************************************
 * PrintAssign(...) [ body ]
 ****************************************************************************/
void  PrintAssign( string modName, int line, string var, bool[*] x)
/****************************************************************************
 * PrintAssign(...) [ body ]
 ****************************************************************************/
void  PrintAssign( string modName, int line, string var, char[*] x)
/****************************************************************************
 * PrintReturn(...) [ body ]
 ****************************************************************************/
void  PrintReturn( string modName, int line, int[*] x)
/****************************************************************************
 * PrintReturn(...) [ body ]
 ****************************************************************************/
void  PrintReturn( string modName, int line, float[*] x)
/****************************************************************************
 * PrintReturn(...) [ body ]
 ****************************************************************************/
void  PrintReturn( string modName, int line, double[*] x)
/****************************************************************************
 * PrintReturn(...) [ body ]
 ****************************************************************************/
void  PrintReturn( string modName, int line, bool[*] x)
/****************************************************************************
 * PrintReturn(...) [ body ]
 ****************************************************************************/
void  PrintReturn( string modName, int line, char[*] x)
/*-----------------------------------------------*/

1.2 Indent.sac

/*-----------------------------------------------*/
class Indent;
export all;
use StdIO : all;
use Structures : all;
/*
 *  type definitions
 */
classtype int Indent::Indent;
/*
 *  global objects
 */
Indent indent = to_Indent( 0) ;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * newIndent(...) [ body ]
 ****************************************************************************/
Indent newIndent( int value)
/****************************************************************************
 * getIndent(...) [ body ]
 ****************************************************************************/
int getIndent()
/****************************************************************************
 * getIndent(...) [ body ]
 ****************************************************************************/
int getIndent( Indent &i)
/****************************************************************************
 * setIndent(...) [ body ]
 ****************************************************************************/
void  setIndent( Indent &i, int val)
/****************************************************************************
 * doIndent(...) [ body ]
 ****************************************************************************/
void  doIndent( string pattern)
/****************************************************************************
 * doIndent(...) [ body ]
 ****************************************************************************/
void  doIndent( Indent &i, string pattern)
/****************************************************************************
 * incIndent(...) [ body ]
 ****************************************************************************/
void  incIndent( Indent &i)
/****************************************************************************
 * incIndent(...) [ body ]
 ****************************************************************************/
void  incIndent( Indent &i, int offset)
/****************************************************************************
 * incIndent(...) [ body ]
 ****************************************************************************/
void  incIndent()
/****************************************************************************
 * decIndent(...) [ body ]
 ****************************************************************************/
void  decIndent( Indent &i)
/****************************************************************************
 * decIndent(...) [ body ]
 ****************************************************************************/
void  decIndent( Indent &i, int offset)
/****************************************************************************
 * decIndent(...) [ body ]
 ****************************************************************************/
void  decIndent()
/*-----------------------------------------------*/

2 System

2.1 World.sac

/*-----------------------------------------------*/
class World;
export all except { create_TheWorld};
/*
 *  type definitions
 */
external classtype World::World;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n *  The global object TheWorld of class World serves as a representation of the\n *  execution environment. It provides access to resources residing\n *  outside the functional framework of a SAC program.\n *\n *  In order to allow concurrent access to unrelated parts of the\n *  execution environment, some other predefined global objects are \n *  derived from world upon program start. These represent disjoint\n *  partitions of the execution environment or outside world.\n *\n *  These are: - TheTerminal\n *             - TheFileSys\n *             - TheEnvironment\n *             - TheCommandLine\n *             - TheClock\n */external World create_TheWorld();
/*
 *  global objects
 */
World TheWorld = create_TheWorld() ;
/*-----------------------------------------------*/

2.2 TimeStamp.sac

/*-----------------------------------------------*/
module TimeStamp;
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
external void  timeStamp();
#pragma effect World::TheWorld
/*-----------------------------------------------*/

2.3 Terminal.sac

/*-----------------------------------------------*/
class Terminal;
export all except { create_TheTerminal};
/*
 *  type definitions
 */
external classtype Terminal::Terminal;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n *  The global object TheTerminal of class Terminal serves as a representation\n *  for a terminal screen. It is derived from the global object TheWorld in\n *  order to represent this part or sub-world of the execution environment.\n *  It is also used to synchronise the standard I/O streams stdin, stdout,\n *  and stderr.\n */external Terminal create_TheTerminal();
#pragma effect World::TheWorld
/*
 *  global objects
 */
Terminal TheTerminal = create_TheTerminal() ;
/*-----------------------------------------------*/

2.4 System.sac

/*-----------------------------------------------*/
module System;
import World : all;
import Terminal : all;
import FileSystem : all;
import CommandLine : all;
import Environment : all;
import Clock : all;
import SysErr : all;
import RuntimeError : all;
export all;
/*-----------------------------------------------*/

2.5 SysErr.sac

/*-----------------------------------------------*/
module SysErr;
use String : { string};
export all;
/*
 *  type definitions
 */
typedef int syserr;
/*
 *  prototypes for externals (FUNDECS)
 */
external bool fail( syserr ERROR);
external bool clear( syserr ERROR);
/*\n     * Check if the error condition produced by a call to a system function\n     * signals success or failure.\n     */external string strerror( syserr ERROR);
/* file system errors */external syserr Eperm();
external syserr Enoent();
external syserr Esrch();
external syserr Eintr();
external syserr Eio();
external syserr Enxio();
external syserr E2big();
external syserr Enoexec();
external syserr Ebadf();
external syserr Echild();
external syserr Eagain();
external syserr Enomem();
external syserr Eacces();
external syserr Efault();
external syserr Enotblk();
external syserr Ebusy();
external syserr Eexist();
external syserr Exdev();
external syserr Enodev();
external syserr Enotdir();
external syserr Eisdir();
external syserr Einval();
external syserr Enfile();
external syserr Emfile();
external syserr Enotty();
external syserr Etxtbsy();
external syserr Efbig();
external syserr Enospc();
external syserr Espipe();
external syserr Erofs();
external syserr Emlink();
external syserr Epipe();
external syserr Eloop();
external syserr Enametoolong();
/* operational errors */external syserr Enetdown();
external syserr Enetunreach();
external syserr Enetreset();
external syserr Econnaborted();
external syserr Econnreset();
external syserr Enobufs();
external syserr Eisconn();
external syserr Enotconn();
external syserr Eshutdown();
external syserr Etoomanyrefs();
external syserr Etimedout();
external syserr Econnrefused();
/* should be rearranged */external syserr Ehostdown();
external syserr Ehostunreach();
external syserr Enotempty();
/* quotas & mush */external syserr Eusers();
external syserr Edquot();
/* Network File System */external syserr Estale();
external syserr Eremote();
/*-----------------------------------------------*/

2.6 RuntimeError.sac

/*-----------------------------------------------*/
module RuntimeError;
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
external void  error( int result, String::string message, ...);
#pragma effect Terminal::TheTerminal
/*-----------------------------------------------*/

2.7 RTimer.sac

/*-----------------------------------------------*/
class RTimer;
use RTClock : all;
export all;
/*
 *  type definitions
 */
external classtype RTimer::RTimer;
/*
 *  prototypes for externals (FUNDECS)
 */
external RTimer createRTimer();
#pragma effect RTClock::TheRTClock
external void  destroyRTimer( RTimer rtimer);
#pragma effect RTClock::TheRTClock
external void  startRTimer( RTimer &rtimer);
#pragma effect RTClock::TheRTClock
external void  stopRTimer( RTimer &rtimer);
#pragma effect RTClock::TheRTClock
external void  resetRTimer( RTimer &rtimer);
external int, int getRTimerInts( RTimer &rtimer);
external double getRTimerDbl( RTimer &rtimer);
/*-----------------------------------------------*/

2.8 RTClock.sac

/*-----------------------------------------------*/
class RTClock;
export { TheRTClock, touch, gettime};
/*
 *  type definitions
 */
external classtype RTClock::RTClock;
/*
 *  prototypes for externals (FUNDECS)
 */
external RTClock createTheRTClock();
#pragma effect World::TheWorld
external void  touch( RTClock &rtclock);
external long, long gettime();
#pragma effect RTClock::TheRTClock
/*
 *  global objects
 */
RTClock TheRTClock = createTheRTClock() ;
/*-----------------------------------------------*/

2.9 Process.sac

/*-----------------------------------------------*/
module Process;
use FileSystem : { TheFileSystem};
use File : { File};
use String : { string};
use SysErr : { syserr};
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n   *  Functions to open and close processes.\n   */external syserr, File popen( string COMMAND, string MODE);
#pragma effect TheFileSystem
/*\n     * Open the process COMMAND in mode MODE. The modes supported are identical\n     * to the C version of this function. An error condition and a process\n     * handle are returned. You should inspect the error condition before\n     * using the process handle. The process handle must be closed by pclose.\n     */external void  pclose( File STREAM);
#pragma effect TheFileSystem
external int system( string COMMAND);
#pragma effect TheFileSystem
/*-----------------------------------------------*/

2.10 MTClock.sac

/*-----------------------------------------------*/
class MTClock;
export { TheMTClock, touch, gettime};
/*
 *  type definitions
 */
external classtype MTClock::MTClock;
/*
 *  prototypes for externals (FUNDECS)
 */
external MTClock createTheMTClock();
#pragma effect World::TheWorld
external void  touch( MTClock &mtclock);
external long, long gettime();
#pragma effect MTClock::TheMTClock
/*
 *  global objects
 */
MTClock TheMTClock = createTheMTClock() ;
/*-----------------------------------------------*/

2.11 GetOpt.sac

/*-----------------------------------------------*/
module GetOpt;
use String : { string};
use CommandLine : { TheCommandLine};
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
external char getopt( string opts);
#pragma effect TheCommandLine
/*\n     * Return the next command line option using the options given in \’opts\’.\n     * If the option requires an argument then this is available by optarg().\n     * If no more options are available then getopt returns optEND().\n     * See the manual page for getopt(3) for more details.\n     */external char optEND();
/*\n     * Return the option character that is used to signal end-of-options.\n     */external string optarg();
#pragma effect TheCommandLine
/*\n     * Retrieve the argument to the current option.\n     * If the option doesn\’t require an argument then this is empty.\n     */external char optopt();
#pragma effect TheCommandLine
/*\n     * Retrieve the last option value.\n     */external int optind();
#pragma effect TheCommandLine
/*\n     * Return the current index into argv.\n     */external void  optind( int set);
#pragma effect TheCommandLine
/*\n     * Set or reset the current option index into argv.\n     */external bool opterr();
#pragma effect TheCommandLine
/*\n     * Query if option error reporting is enabled.\n     */external void  opterr( bool set);
#pragma effect TheCommandLine
/*-----------------------------------------------*/

2.12 FileSystem.sac

/*-----------------------------------------------*/
class FileSystem;
use SysErr : { syserr};
use String : { string};
export all;
/*
 *  type definitions
 */
external classtype FileSystem::FileSystem;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n *  The global object TheFileSys of class FileSys serves as a representation\n *  for a file system. It is derived from the global object world in\n *  order to represent this part or sub-world of the execution environment.\n */external FileSystem create_TheFileSystem();
#pragma effect World::TheWorld
external syserr rename( string OLDNAME, string NEWNAME);
#pragma effect TheFileSystem
/*\n     * Rename file OLDNAME to NEWNAME. \n     */external syserr remove( string PATHNAME);
#pragma effect TheFileSystem
/*\n     * Remove the file given by PATHNAME from the file system. \n     */external syserr symlink( string PATHNAME, string LINKNAME);
#pragma effect TheFileSystem
/*\n     * Create a symbolic link to file PATHNAME which is called LINKNAME. \n     */external bool, syserr access( string PATHNAME, int HOW);
#pragma effect TheFileSystem
/*\n     * Test if access to file PATHNAME is granted.\n     * HOW specifies the type of access tested:\n     *  0: existence\n     *  1: read access\n     *  2: write access\n     *  3: execution access  \n     *\n     * In contrast to C, the result is true iff access is granted.\n     */external bool, syserr isdir( string PATHNAME);
#pragma effect TheFileSystem
/*\n     * Test PATHNAME for being a directory. \n     */external bool, syserr isreg( string PATHNAME);
#pragma effect TheFileSystem
/*\n     * Test PATHNAME for being a regular file. \n     */external bool, syserr islnk( string PATHNAME);
#pragma effect TheFileSystem
/*\n     * Test PATHNAME for being a symbolic link. \n     */external ulonglong, syserr filesize( string PATHNAME);
#pragma effect TheFileSystem
/* \n   *  Functions for dealing with directories.\n   */external string getcwd();
#pragma effect TheFileSystem
/*\n     * Get the current working directory. \n     */external syserr chdir( string PATHNAME);
#pragma effect TheFileSystem
/*\n     * Change the current working directory to PATHNAME. \n     */external syserr mkdir( string PATHNAME);
#pragma effect TheFileSystem
/*\n     * Create the directory PATHNAME. \n     */external syserr rmdir( string PATHNAME);
#pragma effect TheFileSystem
/*\n   *  Functions for dealing with temporary files and directories.\n   */external string P_tmpdir();
/*\n     * Path-prefix for storing temporary files on the specific system,\n     * e.g. \"/usr/tmp/\".\n     */external int L_tmpnam();
/*\n     * Maximum length of file names generated by tmpnam() or tempnam().\n     */external string mktemp( string TEMPLATE);
#pragma effect TheFileSystem
/*\n     * Create a unique file name,  typically  in  a  temporary\n     * file system. The  string TEMPLATE\n     * should  contain  a file name with six trailing Xs.\n     * These Xs are replaced by a letter and the current  process ID.\n     * The  letter  will be chosen so that the resulting\n     * name does not duplicate an existing file.\n     */external string tmpnam();
#pragma effect TheFileSystem
/*\n     * Generate a unique file name using the path-prefix\n     * defined by P_tmpdir().\n     */external string tmpnam( string DIR, string PREFIX);
#pragma effect TheFileSystem
/*
 *  global objects
 */
FileSystem TheFileSystem = create_TheFileSystem() ;
/*-----------------------------------------------*/

2.13 Environment.sac

/*-----------------------------------------------*/
class Environment;
use String : { string};
export all;
/*
 *  type definitions
 */
external classtype Environment::Environment;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n *  The global object TheEnvironment of class Environment serves as\n *  a representation of the environment.\n *  It is derived from the global object TheWorld in\n *  order to represent this part or sub-world of the execution environment.\n */external Environment create_TheEnvironment();
#pragma effect World::TheWorld
external string GetEnv( string ENVVAR);
#pragma effect TheEnvironment
external bool ExistEnv( string ENVVAR);
#pragma effect TheEnvironment
external bool SetEnv( string ENVVAR, string VALUE, bool OVERWRITE);
#pragma effect TheEnvironment
external void  UnsetEnv( string ENVVAR);
#pragma effect TheEnvironment
external int EnvCount();
#pragma effect TheEnvironment
external string IndexEnv( int N);
#pragma effect TheEnvironment
/*
 *  global objects
 */
Environment TheEnvironment = create_TheEnvironment() ;
/*-----------------------------------------------*/

2.14 Dir.sac

/*-----------------------------------------------*/
class Dir;
use SysErr : { syserr};
use String : { string};
use FileSystem : { TheFileSystem};
export all;
/*
 *  type definitions
 */
external classtype Dir::Dir;
/*
 *  prototypes for externals (FUNDECS)
 */
external syserr, Dir opendir( string NAME);
#pragma effect TheFileSystem
external void  closedir( Dir &DIR);
#pragma effect TheFileSystem
external string readdir( Dir &DIR);
#pragma effect TheFileSystem
external void  rewinddir( Dir &DIR);
#pragma effect TheFileSystem
external long telldir( Dir &DIR);
#pragma effect TheFileSystem
external void  seekdir( Dir &DIR, long POS);
#pragma effect TheFileSystem
/*-----------------------------------------------*/

2.15 CommandLine.sac

/*-----------------------------------------------*/
class CommandLine;
use String : { string};
export all;
/*
 *  type definitions
 */
external classtype CommandLine::CommandLine;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n   *  The global object TheCommandLine of class CommandLine serves as a \n   *  representation of the shell command used for starting program execution.\n   *  It is derived from the global object TheWorld in\n   *  order to represent this part or sub-world of the execution environment.\n   */external CommandLine create_TheCommandLine();
#pragma effect World::TheWorld
external int argc();
#pragma effect TheCommandLine
external string argv();
#pragma effect TheCommandLine
external string argv( int N);
#pragma effect TheCommandLine
/*
 *  global objects
 */
CommandLine TheCommandLine = create_TheCommandLine() ;
/*-----------------------------------------------*/

2.16 Clock.sac

/*-----------------------------------------------*/
class Clock;
use String : { string};
export all;
/*
 *  type definitions
 */
external classtype Clock::Clock;
external typedef time;
/*
 *  prototypes for externals (FUNDECS)
 */
external Clock create_TheClock();
#pragma effect World::TheWorld
external time to_time( int secs);
/* \n     * Convert seconds since the Epoch into a time value\n     */external time gettime();
#pragma effect TheClock
/* Get the current system time.\n     *\n     *  Note: Although the system clock of course is not effected by a call\n     *        to this function, the pragma effect is used instead of touch.\n     *        This is done to achieve a sequentialization which is necessary\n     *        since the state of the clock is not constant although it may\n     *        not be modified from within a SAC program.\n     */external time, bool mktime( int YEAR, int MON, int DAY, int HOUR, int MIN, int SEC);
/*\n   *  Functions for decomposing time values.\n   */external int sec( time T);
/*\n     * The number of seconds after the minute, normally in\n     * the range 0 to 59, but can be up to 61 to allow for\n     * leap seconds.\n     */external int min( time T);
/*\n     * The number of minutes after the hour, in the  range 0 to 59.\n     */external int hour( time T);
/*\n     * The  number  of hours past midnight, in the range 0 to 23.  \n     */external int mday( time T);
/*\n     * The day of the month, in the range 1 to 31.  \n     */external int mon( time T);
/*\n     * The number of months since January, in the range 0 to 11.  \n     */external int year( time T);
/*\n     * The year, starting with 0=1900.  \n     */external int wday( time T);
/*\n     * The  number of days since Sunday, in the range 0 to 6  \n     */external int yday( time T);
/*\n     * The number of days since January 1, in the range  0 to 365.  \n     */external int, int, int clock( time T);
/*\n     * Extract hours, minutes, and seconds from time value T. \n     */external int, int, int date( time T);
/*\n   *  Functions for getting additional information about the time.\n   */external int isdst( time T);
/*\n     * A flag that indicates whether daylight saving time\n     * is in effect at the time described.  The  value  is\n     * positive if daylight saving time is in effect, zero\n     * if it is not, and negative if  the  information  is\n     * not available.\n     */external bool isleap( int YEAR);
external bool isleap( time T);
/*\n     * Test the given year YEAR or the time value T respectively \n     * for being a leap year.\n     */external double difftime( time T1, time T0);
/*\n   *  Functions for converting time values and string representations.\n   */external string ctime( time T);
/*\n     * The ctime() function converts the time T into\n     * a string of the form\n     *\n     *        \"Wed Jun 30 21:49:08 1993\n\"\n     *\n     * The abbreviations for the days  of  the  week  are  ‘Sun\’,\n     * ‘Mon\’,  ‘Tue\’, ‘Wed\’, ‘Thu\’, ‘Fri\’, and ‘Sat\’.  \n     * The abbreviations for the months are ‘Jan\’,  ‘Feb\’,  ‘Mar\’,  ‘Apr\’,\n     * ‘May\’,  ‘Jun\’,  ‘Jul\’,  ‘Aug\’,  ‘Sep\’,  ‘Oct\’,  ‘Nov\’, and ‘Dec\’\n     * \n     */external string strftime( int LEN, string FORMAT, time T);
/*\n     * Convert the time T into a string of maximum length LEN\n     * concerning the format string FORMAT. Special time oriented\n     * conversion specifiers may be used (see C documentation).\n     * If an error occurs the returned string is empty.\n     */external time, string strptime( string S, string FORMAT);
/*\n     * Complementary function to strftime(),\n     * convert the string S into a time value concerning the format\n     * string FORMAT. Similar conversion specifiers may be applied as\n     * with the strftime() function (see C documentation for details).\n     * The resulting string contains the remainder of S not scanned\n     * by strptime(). If strptime() fails to match all of the format\n     * string an error occurs, the returned remainder string is empty,\n     * and the returned time is 0.\n     */external void  sleep( int SECONDS);
#pragma effect World::TheWorld
/*
 *  global objects
 */
Clock TheClock = create_TheClock() ;
/*-----------------------------------------------*/

3 Structures

3.1 Structures.sac

/*-----------------------------------------------*/
module Structures;
import Array : all;
import Char : all;
import Bits : all;
import String : all;
export all;
/*-----------------------------------------------*/

3.2 StringArray.sac

/*-----------------------------------------------*/
module StringArray;
use String : { string};
use Array : { *, all, -, abs, <, >=, +, zero, ++};
export all except { eq_SxS, eq_SxA, eq_AxS, eq_AxA, getIndicies, modarray_AxVxS, sel_VxA, stringArrayCreator, drop};
/*
 *  type definitions
 */
external typedef stringArray;
/*
 *  prototypes for externals (FUNDECS)
 */
external stringArray modarray_AxVxS( stringArray labs, int[.] idx, string str);
external string sel_VxA( int[.] idx, stringArray labs);
external int dim( stringArray s);
external int[.] shape( stringArray s);
external stringArray stringArrayCreator( int[.] shp, string s);
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * drop(...) [ body ]
 ****************************************************************************/
stringArray drop( int[.] v, stringArray array)
/****************************************************************************
 * where(...) [ body ]
 ****************************************************************************/
inline
int[+] where( bool[+] p, int A, int[+] B)
/****************************************************************************
 * modarray(...) [ body ]
 ****************************************************************************/
stringArray modarray( stringArray array, int[.] idx, stringArray val)
/****************************************************************************
 * sel(...) [ body ]
 ****************************************************************************/
stringArray sel( int[.] idx, stringArray array)
/****************************************************************************
 * to_string(...) [ body ]
 ****************************************************************************/
string to_string( stringArray a)
/****************************************************************************
 * to_stringArray(...) [ body ]
 ****************************************************************************/
stringArray to_stringArray( string s)
/****************************************************************************
 * genarray(...) [ body ]
 ****************************************************************************/
stringArray genarray( int[.] shp, stringArray s)
/****************************************************************************
 * eq_SxS(...) [ body ]
 ****************************************************************************/
inline
bool eq_SxS( stringArray a, stringArray b)
/****************************************************************************
 * eq_SxA(...) [ body ]
 ****************************************************************************/
inline
bool[*] eq_SxA( stringArray a, stringArray b)
/****************************************************************************
 * eq_AxS(...) [ body ]
 ****************************************************************************/
inline
bool[*] eq_AxS( stringArray a, stringArray b)
/****************************************************************************
 * eq_AxA(...) [ body ]
 ****************************************************************************/
inline
bool[*] eq_AxA( stringArray a, stringArray b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[*] ==( stringArray a, stringArray b)
/****************************************************************************
 * getIndicies(...) [ body ]
 ****************************************************************************/
int[.,.] getIndicies( int[.] shp)
/* I\’d love to name this funcion ++ but if I do then when I use Structures,\n * ++ on integers can no longer be found.\n * N.b. The specific error is:\n *   No definition found for a function \"Structures::++\" that accepts an\n *   argument of type \"int[0]{}\" as parameter no 1. Full argument types\n *   are \"( int[0]{}, int[.])\".\n */
/****************************************************************************
 * concatStringArrays(...) [ body ]
 ****************************************************************************/
stringArray concatStringArrays( stringArray m1, stringArray m2)
/*\n * Returns true if needle exists in haystack\n */
/****************************************************************************
 * in(...) [ body ]
 ****************************************************************************/
bool in( string needle, stringArray haystack)
/*\n * Returns the index into haystack for the string needle.\n * N.b. before calling this function call in to ensure that the needle you are\n * searching for really is in the haystack!\n */
/****************************************************************************
 * indexOf(...) [ body ]
 ****************************************************************************/
int[.] indexOf( string needle, stringArray haystack)
/*-----------------------------------------------*/

3.3 String.sac

/*-----------------------------------------------*/
module String;
import Char : all;
import ScalarArith : { &, !=, ==, +, >=, >, <=, <, ++};
import ArrayBasics : { shape, sel};
export all except { indent};
/*
 *  type definitions
 */
external typedef string;
/*
 *  prototypes for externals (FUNDECS)
 */
external string to_string( char[.] A, int LENGTH);
external string strmod( string S, int P, char C);
external string strins( string S1, int P, string S2);
/* Insert string S2 into string S1 starting at position P. */external string strovwt( string S1, int P, string S2);
external char strsel( string S, int P);
external string strcat( string S1, string S2);
external string +( string S1, string S2);
external string strncat( string S1, string S2, int N);
external int strcmp( string S1, string S2);
external int strncmp( string S1, string S2, int N);
external int strcasecmp( string S1, string S2);
external int strncasecmp( string S1, string S2, int N);
external int strlen( string S);
external string strtake( string S, int N);
external string strdrop( string S, int N);
external string strext( string S, int FIRST, int LEN);
external string sprintf( string FORMAT, ...);
external int, ... sscanf( string S, string FORMAT);
external string sscanf_str( string S, string FORMAT);
external int strchr( string S, char C);
external int strrchr( string S, char C);
external int strcspn( string S, string REJECT);
external int strspn( string S, string ACCEPT);
external int strstr( string HAYSTACK, string NEEDLE);
external string, string strtok( string S, string SEP);
external string chomp( string S);
external string rtrim( string S);
external string ltrim( string S);
external string trim( string S);
external int, string strtoi( string S, int BASE);
external float, string strtof( string S);
external double, string strtod( string S);
external int toi( string S);
external float tof( string S);
external double tod( string S);
external string tos( int N);
external string tos( float N);
external string tos( double N);
external string tos( bool B);
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * indent(...) [ body ]
 ****************************************************************************/
inline
string indent( int indent, string str)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( int[+] in)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( int in, int indent)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( int[+] in, int indent)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( float[+] in)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( float in, int indent)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( float[+] in, int indent)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( double[+] in)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( double in, int indent)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( double[+] in, int indent)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( bool[+] in)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( bool in, int indent)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
string tos( bool[+] in, int indent)
/****************************************************************************
 * to_string(...) [ body ]
 ****************************************************************************/
inline
string to_string( char[.] arr)
/****************************************************************************
 * tochar(...) [ body ]
 ****************************************************************************/
inline
char[.] tochar( string s)
/****************************************************************************
 * sel(...) [ body ]
 ****************************************************************************/
inline
char sel( int[.] index, string s)
/****************************************************************************
 * modarray(...) [ body ]
 ****************************************************************************/
inline
string modarray( string s, int[1] index, char c)
/****************************************************************************
 * modarray(...) [ body ]
 ****************************************************************************/
inline
string modarray( string s1, int[1] index, string s2)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool ==( string A, string B)
/****************************************************************************
 * !=(...) [ body ]
 ****************************************************************************/
inline
bool !=( string A, string B)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool <( string A, string B)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool <=( string A, string B)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool >( string A, string B)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool >=( string A, string B)
/****************************************************************************
 * isalpha(...) [ body ]
 ****************************************************************************/
inline
bool isalpha( string S)
/****************************************************************************
 * isupper(...) [ body ]
 ****************************************************************************/
inline
bool isupper( string S)
/****************************************************************************
 * islower(...) [ body ]
 ****************************************************************************/
inline
bool islower( string S)
/****************************************************************************
 * isdigit(...) [ body ]
 ****************************************************************************/
inline
bool isdigit( string S)
/****************************************************************************
 * isxdigit(...) [ body ]
 ****************************************************************************/
inline
bool isxdigit( string S)
/****************************************************************************
 * isspace(...) [ body ]
 ****************************************************************************/
inline
bool isspace( string S)
/****************************************************************************
 * ispunct(...) [ body ]
 ****************************************************************************/
inline
bool ispunct( string S)
/****************************************************************************
 * isalnum(...) [ body ]
 ****************************************************************************/
inline
bool isalnum( string S)
/****************************************************************************
 * isprint(...) [ body ]
 ****************************************************************************/
inline
bool isprint( string S)
/****************************************************************************
 * isgraph(...) [ body ]
 ****************************************************************************/
inline
bool isgraph( string S)
/****************************************************************************
 * iscntrl(...) [ body ]
 ****************************************************************************/
inline
bool iscntrl( string S)
/****************************************************************************
 * tolower(...) [ body ]
 ****************************************************************************/
inline
string tolower( string S)
/****************************************************************************
 * toupper(...) [ body ]
 ****************************************************************************/
inline
string toupper( string S)
/*-----------------------------------------------*/

3.4 List.sac

/*-----------------------------------------------*/
module List;
export all;
/*
 *  type definitions
 */
external typedef list;
/*
 *  prototypes for externals (FUNDECS)
 */
external list nil();
external list cons( int ELEM, list LIST);
external int hd( list LIST);
external list tl( list LIST);
external bool empty( list LIST);
external list append( list LIST1, list LIST2);
external int nth( int N, list LIST);
external int length( list LIST);
external list drop( int N, list LIST);
external list take( int N, list LIST);
/*-----------------------------------------------*/

3.5 Grey.sac

/*-----------------------------------------------*/
module Grey;
use Array : { min, max};
import ScalarArith : { tod, toi};
export all;
/*
 *  type definitions
 */
typedef int grey;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * newGrey(...) [ body ]
 ****************************************************************************/
inline
grey newGrey( int g)
/****************************************************************************
 * newGrey(...) [ body ]
 ****************************************************************************/
inline
grey newGrey( double g)
/****************************************************************************
 * toi(...) [ body ]
 ****************************************************************************/
inline
int[*] toi( grey g)
/****************************************************************************
 * tod(...) [ body ]
 ****************************************************************************/
inline
double[*] tod( grey g)
/****************************************************************************
 * sel(...) [ body ]
 ****************************************************************************/
inline
grey[*] sel( int[.] idx, grey[*] a)
/****************************************************************************
 * dim(...) [ body ]
 ****************************************************************************/
inline
int dim( grey[*] a)
/****************************************************************************
 * shape(...) [ body ]
 ****************************************************************************/
inline
int[.] shape( grey[*] a)
/****************************************************************************
 * reshape(...) [ body ]
 ****************************************************************************/
inline
grey[*] reshape( int[.] shp, grey[*] a)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
grey +( grey g1, grey g2)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
grey -( grey g1, grey g2)
/*-----------------------------------------------*/

3.6 Constants.sac

/*-----------------------------------------------*/
module Constants;
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
external byte minbyte();
external byte maxbyte();
external short minshort();
external short maxshort();
external int minint();
external int maxint();
external long minlong();
external long maxlong();
external longlong minlonglong();
external longlong maxlonglong();
external ubyte minubyte();
external ubyte maxubyte();
external ushort minushort();
external ushort maxushort();
external uint minuint();
external uint maxuint();
external ulong minulong();
external ulong maxulong();
external ulonglong minulonglong();
external ulonglong maxulonglong();
external float minfloat();
external float maxfloat();
external double mindouble();
external double tinydouble();
external double maxdouble();
external double epidouble();
/*-----------------------------------------------*/

3.7 ComplexScalarArith.sac

/*-----------------------------------------------*/
module ComplexScalarArith;
export all;
use ArrayBasics : { sel};
use ScalarArith : { &, |};
use ComplexBasics : all;
/*
 *  function definitions (FUNDEFS)
 */
/*  Binary operations on complex numbers.  */
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
complex +( complex X1, complex X2)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
complex -( complex X1, complex X2)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
complex -( complex X1)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
complex *( complex X1, complex X2)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
complex /( complex X1, complex X2)
/*  Functions for specific complex manipulations. */
/****************************************************************************
 * conj(...) [ body ]
 ****************************************************************************/
inline
complex conj( complex X)
/****************************************************************************
 * abs(...) [ body ]
 ****************************************************************************/
inline
complex abs( complex X)
/* relational operations */
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool ==( complex X1, complex X2)
/****************************************************************************
 * !=(...) [ body ]
 ****************************************************************************/
inline
bool !=( complex X1, complex X2)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool <( complex X1, complex X2)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool <=( complex X1, complex X2)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool >( complex X1, complex X2)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool >=( complex X1, complex X2)
/****************************************************************************
 * min(...) [ body ]
 ****************************************************************************/
inline
complex min( complex X1, complex X2)
/****************************************************************************
 * max(...) [ body ]
 ****************************************************************************/
inline
complex max( complex X1, complex X2)
/*-----------------------------------------------*/

3.8 ComplexBasics.sac

/*-----------------------------------------------*/
module ComplexBasics;
export all;
use ArrayBasics : { sel};
use Math : { atan2};
/*
 *  type definitions
 */
typedef double[2] complex;
/*
 *  function definitions (FUNDEFS)
 */
/*  Functions for composing and decomposing of complex numbers.  */
/****************************************************************************
 * real(...) [ body ]
 ****************************************************************************/
inline
double real( complex CPX)
/****************************************************************************
 * imag(...) [ body ]
 ****************************************************************************/
inline
double imag( complex CPX)
/*  \n *  Simple conversion functions between complex, real and integer\n *  numbers.\n */
/****************************************************************************
 * toc(...) [ body ]
 ****************************************************************************/
inline
complex toc( int REAL, int IMAG)
/****************************************************************************
 * toc(...) [ body ]
 ****************************************************************************/
inline
complex toc( float REAL, float IMAG)
/****************************************************************************
 * toc(...) [ body ]
 ****************************************************************************/
inline
complex toc( double REAL, double IMAG)
/****************************************************************************
 * toc(...) [ body ]
 ****************************************************************************/
inline
complex toc( double[2] COMP)
/****************************************************************************
 * toc(...) [ body ]
 ****************************************************************************/
inline
complex toc( int REAL)
/****************************************************************************
 * toc(...) [ body ]
 ****************************************************************************/
inline
complex toc( float REAL)
/****************************************************************************
 * toc(...) [ body ]
 ****************************************************************************/
inline
complex toc( double REAL)
/* Extract real and imag part from a complex number. */
/****************************************************************************
 * toi(...) [ body ]
 ****************************************************************************/
inline
int, int toi( complex C)
/****************************************************************************
 * tof(...) [ body ]
 ****************************************************************************/
inline
float, float tof( complex C)
/****************************************************************************
 * tod(...) [ body ]
 ****************************************************************************/
inline
double, double tod( complex C)
/****************************************************************************
 * todv(...) [ body ]
 ****************************************************************************/
inline
double[2] todv( complex C)
/****************************************************************************
 * tos(...) [ body ]
 ****************************************************************************/
inline
String::string tos( complex c)
/****************************************************************************
 * ptoi(...) [ body ]
 ****************************************************************************/
inline
int, int ptoi( complex C)
/****************************************************************************
 * ptof(...) [ body ]
 ****************************************************************************/
inline
float, float ptof( complex C)
/****************************************************************************
 * ptod(...) [ body ]
 ****************************************************************************/
inline
double, double ptod( complex C)
/*  Functions for composing and decomposing of complex numbers\n      using polar coordinates.  */
/****************************************************************************
 * polar(...) [ body ]
 ****************************************************************************/
inline
complex polar( double MAG, double ANGLE)
/****************************************************************************
 * polar(...) [ body ]
 ****************************************************************************/
inline
complex polar( double MAG)
/****************************************************************************
 * normSq(...) [ body ]
 ****************************************************************************/
inline
double normSq( complex CPX)
/****************************************************************************
 * norm(...) [ body ]
 ****************************************************************************/
inline
double norm( complex CPX)
/****************************************************************************
 * arg(...) [ body ]
 ****************************************************************************/
inline
double arg( complex CPX)
/*  Complex constants.  */
/****************************************************************************
 * i(...) [ body ]
 ****************************************************************************/
inline
complex i()
/****************************************************************************
 * zero(...) [ body ]
 ****************************************************************************/
inline
complex zero()
/****************************************************************************
 * zero(...) [ body ]
 ****************************************************************************/
inline
complex zero( complex[*] a)
/****************************************************************************
 * one(...) [ body ]
 ****************************************************************************/
inline
complex one()
/****************************************************************************
 * one(...) [ body ]
 ****************************************************************************/
inline
complex one( complex[*] a)
/*-----------------------------------------------*/

3.9 Complex.sac

/*-----------------------------------------------*/
module Complex;
import ComplexBasics : all;
import ComplexScalarArith : all;
import ComplexArrayBasics : all;
import ComplexArrayArith : all;
import ComplexArrayTransform : all;
export all;
/*-----------------------------------------------*/

3.10 Color8.sac

/*-----------------------------------------------*/
module Color8;
use Array : all except { *, -, +, reshape, dim, shape, sel, tod, toi};
import Array : { *, -, +, reshape, dim, shape, sel, tod, toi};
use MathArray : all;
export all except { Weights2Clut, genSteps};
/*
 *  type definitions
 */
typedef int[3] color;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * black(...) [ body ]
 ****************************************************************************/
inline
color black()
/****************************************************************************
 * white(...) [ body ]
 ****************************************************************************/
inline
color white()
/****************************************************************************
 * red(...) [ body ]
 ****************************************************************************/
inline
color red()
/****************************************************************************
 * green(...) [ body ]
 ****************************************************************************/
inline
color green()
/****************************************************************************
 * blue(...) [ body ]
 ****************************************************************************/
inline
color blue()
/****************************************************************************
 * red(...) [ body ]
 ****************************************************************************/
inline
int red( color col)
/****************************************************************************
 * green(...) [ body ]
 ****************************************************************************/
inline
int green( color col)
/****************************************************************************
 * blue(...) [ body ]
 ****************************************************************************/
inline
int blue( color col)
/****************************************************************************
 * newColor(...) [ body ]
 ****************************************************************************/
inline
color newColor( int[3] col)
/****************************************************************************
 * newColor(...) [ body ]
 ****************************************************************************/
inline
color newColor( int x, int y, int z)
/****************************************************************************
 * toi(...) [ body ]
 ****************************************************************************/
inline
int[3] toi( color c)
/****************************************************************************
 * toi(...) [ body ]
 ****************************************************************************/
inline
int[*] toi( color[*] c)
/****************************************************************************
 * tod(...) [ body ]
 ****************************************************************************/
inline
double[3] tod( color c)
/****************************************************************************
 * tod(...) [ body ]
 ****************************************************************************/
inline
double[*] tod( color[*] c)
/****************************************************************************
 * Weights2Clut(...) [ body ]
 ****************************************************************************/
inline
color[256] Weights2Clut( double[256] w, color c1, color c2)
/****************************************************************************
 * genSteps(...) [ body ]
 ****************************************************************************/
inline
double[256] genSteps( double from, double to)
/****************************************************************************
 * genLinearClut(...) [ body ]
 ****************************************************************************/
inline
color[256] genLinearClut( color c1, color c2)
/****************************************************************************
 * genLogarithmicClut(...) [ body ]
 ****************************************************************************/
inline
color[256] genLogarithmicClut( double from, double to, color c1, color c2)
/****************************************************************************
 * genExponentialClut(...) [ body ]
 ****************************************************************************/
inline
color[256] genExponentialClut( double from, double to, color c1, color c2)
/****************************************************************************
 * genAlternatingClut(...) [ body ]
 ****************************************************************************/
inline
color[256] genAlternatingClut( color c1, color c2)
/*\n * h_in is the hue in degrees [0:360]\n * s_in is the saturation in % [0:100]\n * b_in is the brightness in % [0:100]\n */
/****************************************************************************
 * Hsb2Rgb(...) [ body ]
 ****************************************************************************/
inline
color Hsb2Rgb( int h_in, int s_in, int b_in)
/****************************************************************************
 * Hsb2Rgb(...) [ body ]
 ****************************************************************************/
inline
color[*] Hsb2Rgb( int[*] h_in, int s_in, int b_in)
/****************************************************************************
 * Hsb2Rgb(...) [ body ]
 ****************************************************************************/
inline
color[*] Hsb2Rgb( int[*] h_in, int[*] s_in, int[*] b_in)
/****************************************************************************
 * sel(...) [ body ]
 ****************************************************************************/
inline
color[*] sel( int idx, color[*] clut)
/****************************************************************************
 * sel(...) [ body ]
 ****************************************************************************/
inline
color[*] sel( int[.] idx, color[*] a)
/****************************************************************************
 * dim(...) [ body ]
 ****************************************************************************/
inline
int dim( color[*] a)
/****************************************************************************
 * shape(...) [ body ]
 ****************************************************************************/
inline
int[.] shape( color[*] a)
/****************************************************************************
 * reshape(...) [ body ]
 ****************************************************************************/
inline
color[*] reshape( int[.] shp, color[*] a)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
color +( color a, color b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
color[*] +( color[*] a, color[*] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
color -( color a, color b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
color[*] -( color[*] a, color[*] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
color *( color c, double x)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
color[*] *( color[*] c, double x)
/*-----------------------------------------------*/

3.11 Char.sac

/*-----------------------------------------------*/
module Char;
use ArrayBasics : { shape, sel};
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
/********************************************************************************\n *\n * Macros for generating MACRO calls for all logic operations\n *\n ********************************************************************************/external bool isalpha( char C);
external bool isupper( char C);
external bool islower( char C);
external bool isdigit( char C);
external bool isxdigit( char C);
external bool isspace( char C);
external bool ispunct( char C);
external bool isalnum( char C);
external bool isprint( char C);
external bool isgraph( char C);
external bool iscntrl( char C);
external bool isascii( int N);
external char toascii( int N);
external char tolower( char C);
external char toupper( char C);
external char tochar( int N);
external char tochar( long N);
external char tochar( float N);
external char tochar( double N);
external char tochar( char N);
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * tochar(...) [ body ]
 ****************************************************************************/
inline
char[*] tochar( int[+] a)
/****************************************************************************
 * tochar(...) [ body ]
 ****************************************************************************/
inline
char[*] tochar( long[+] a)
/****************************************************************************
 * tochar(...) [ body ]
 ****************************************************************************/
inline
char[*] tochar( float[+] a)
/****************************************************************************
 * tochar(...) [ body ]
 ****************************************************************************/
inline
char[*] tochar( double[+] a)
/****************************************************************************
 * tochar(...) [ body ]
 ****************************************************************************/
inline
char[*] tochar( bool[+] a)
/****************************************************************************
 * tochar(...) [ body ]
 ****************************************************************************/
inline
char[*] tochar( char[+] a)
/*-----------------------------------------------*/

3.12 Bool.sac

/*-----------------------------------------------*/
module Bool;
export all;
/*
 *  function definitions (FUNDEFS)
 */
/*\n *  Type conversion operations.\n */
/****************************************************************************
 * toi(...) [ body ]
 ****************************************************************************/
inline
int toi( bool b)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( bool i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( byte i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( short i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( int i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( long i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( longlong i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( ubyte i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( ushort i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( uint i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( ulong i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( ulonglong i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( float i)
/****************************************************************************
 * to_bool(...) [ body ]
 ****************************************************************************/
inline
bool to_bool( double i)
/*-----------------------------------------------*/

3.13 Bits.sac

/*-----------------------------------------------*/
module Bits;
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
external int BitShiftRight( int k, int val);
external int BitShiftLeft( int k, int val);
external int BitRotateRight( int k, int val);
external int BitRotateLeft( int k, int val);
external int BitAND( int mask, int val);
external int BitOR( int mask, int val);
external int BitXOR( int mask, int val);
external int BitOnesComplement( int val);
external int BitTwosComplement( int val);
/*-----------------------------------------------*/

3.14 Array.sac

/*-----------------------------------------------*/
module Array;
import ArrayBasics : all;
import ArrayArith : all;
import ArrayTransform : all;
export all;
/*-----------------------------------------------*/

4 Stdio

4.1 TermFile.sac

/*-----------------------------------------------*/
class TermFile;
use String : { string};
use Terminal : { TheTerminal};
export all except { createStdIn, createStdOut, createStdErr};
/*
 *  type definitions
 */
external classtype TermFile::TermFile;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n   * Initialiser Functions creating standard I/O TermFiles\n   */external TermFile createStdIn();
#pragma effect TheTerminal
external TermFile createStdOut();
#pragma effect TheTerminal
external TermFile createStdErr();
#pragma effect TheTerminal
/*\n   *  Functions for low-level input / output operations\n   */external void  fputc( char C, TermFile &STREAM);
#pragma effect TheTerminal
/*\n     * Put the character C to the output stream STREAM which must be\n     * either stdout or stderr.\n     */external char fgetc( TermFile &STREAM);
#pragma effect TheTerminal
/*\n     * Get the next character from the input stream STREAM which must\n     * be stdin.\n     */external void  fputs( string S, TermFile &STREAM);
#pragma effect TheTerminal
external void  puts( string S);
#pragma effect TheTerminal
external void  ungetc( char C, TermFile &STREAM);
#pragma effect TheTerminal
/*\n   *  Functions for formatted input / output operations\n   */external void  fprintf( TermFile &STREAM, string FORMAT, ...);
#pragma effect TheTerminal
external void  printf( string FORMAT, ...);
#pragma effect TheTerminal, stdout
external int, ... fscanf( TermFile &STREAM, string FORMAT);
#pragma effect TheTerminal
external int, ... scanf( string FORMAT);
#pragma effect TheTerminal, stdin
/*\n     * Scan the given stream STREAM concerning the format string FORMAT.\n     * The syntax of format strings is identical to C except that the\n     * string conversion specifier %s is not supported. \n     * This function may be used to scan values of types\n     * char, int, float, and double. To scan strings use either fscans\n     * or fscanl, respectively.\n     * The int result gives the number of successfully performed \n     * conversions.\n     */external string fscans( TermFile &STREAM, int MAX);
#pragma effect TheTerminal
/*\n      * Read the next character string from the input stream STREAM. Strings\n      * are delimited by any whitespace character including the \n      * end-of-file symbol. Always read at most MAX characters.\n      * Upon failure an empty string is returned.\n      */external string fscanl( TermFile &STREAM, int MAX);
#pragma effect TheTerminal
/*\n   *  Miscellaneous functions for operating on standard I/O streams\n   */external void  fflush( TermFile &STREAM);
#pragma effect TheTerminal
/*\n     * Write the buffer of a buffered output stream STREAM which must be \n     * either stdout or stderr to the respective file or terminal device.\n     */external bool feof( TermFile &STREAM);
#pragma effect TheTerminal
/*
 *  global objects
 */
TermFile stderr = createStdErr() ;
TermFile stdout = createStdOut() ;
TermFile stdin = createStdIn() ;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * putc(...) [ body ]
 ****************************************************************************/
inline
void  putc( char C)
/****************************************************************************
 * getc(...) [ body ]
 ****************************************************************************/
inline
char getc()
/****************************************************************************
 * ungetc(...) [ body ]
 ****************************************************************************/
inline
void  ungetc( char C)
/****************************************************************************
 * scans(...) [ body ]
 ****************************************************************************/
inline
string scans( int MAX)
/****************************************************************************
 * scanl(...) [ body ]
 ****************************************************************************/
inline
string scanl( int MAX)
/****************************************************************************
 * flush(...) [ body ]
 ****************************************************************************/
inline
void  flush()
/****************************************************************************
 * eof(...) [ body ]
 ****************************************************************************/
inline
bool eof()
/*-----------------------------------------------*/

4.2 StdIO.sac

/*-----------------------------------------------*/
module StdIO;
import File : all;
import TermFile : all;
import BinFile : all;
import ScalarIO : all;
import ArrayIO : all;
export all;
/*-----------------------------------------------*/

4.3 ScalarIO.sac

/*-----------------------------------------------*/
module ScalarIO;
use IOresources : all;
use String : { string, to_string, strlen};
use ScalarArith : all;
use ArrayFormat : all;
use TermFile : { TermFile};
export all;
/*
 *  function definitions (FUNDEFS)
 */
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, int n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, float n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, float n, int prec)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, double n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, double n, int prec)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( File &stream, bool n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( File &stream, bool n, int mode)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, char c)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, string s)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, int n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, float n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, float n, int prec)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, double n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, double n, int prec)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( TermFile &stream, bool n)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( TermFile &stream, bool n, int mode)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, char c)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, string s)
/*****************************************************************/
/****************************************************************************
 * show(...) [ body ]
 ****************************************************************************/
void  show( bool c)
/*****************************************************************/
/****************************************************************************
 * show(...) [ body ]
 ****************************************************************************/
void  show( int c)
/*****************************************************************/
/****************************************************************************
 * show(...) [ body ]
 ****************************************************************************/
void  show( float c)
/*****************************************************************/
/****************************************************************************
 * show(...) [ body ]
 ****************************************************************************/
void  show( double c)
/*****************************************************************/
/****************************************************************************
 * show(...) [ body ]
 ****************************************************************************/
void  show( char c)
/*****************************************************************/
/****************************************************************************
 * show(...) [ body ]
 ****************************************************************************/
void  show( ulonglong c)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( int n)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( float n)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( float n, int prec)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( double n)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( double n, int prec)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( bool n)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( bool n, int mode)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( char c)
/*****************************************************************/
/****************************************************************************
 * fscanint(...) [ body ]
 ****************************************************************************/
inline
bool, int fscanint( File &stream)
/*****************************************************************/
/****************************************************************************
 * fscanfloat(...) [ body ]
 ****************************************************************************/
inline
bool, float fscanfloat( File &stream)
/*****************************************************************/
/****************************************************************************
 * fscandouble(...) [ body ]
 ****************************************************************************/
inline
bool, double fscandouble( File &stream)
/*****************************************************************/
/****************************************************************************
 * fscanbool(...) [ body ]
 ****************************************************************************/
bool, bool fscanbool( File &stream)
/*****************************************************************/
/****************************************************************************
 * fscanchar(...) [ body ]
 ****************************************************************************/
inline
bool, char fscanchar( File &stream)
/*****************************************************************/
/****************************************************************************
 * fscanstring(...) [ body ]
 ****************************************************************************/
inline
bool, string fscanstring( File &stream, int length)
/*****************************************************************/
/****************************************************************************
 * fscanint(...) [ body ]
 ****************************************************************************/
inline
bool, int fscanint( TermFile &stream)
/*****************************************************************/
/****************************************************************************
 * fscanfloat(...) [ body ]
 ****************************************************************************/
inline
bool, float fscanfloat( TermFile &stream)
/*****************************************************************/
/****************************************************************************
 * fscandouble(...) [ body ]
 ****************************************************************************/
inline
bool, double fscandouble( TermFile &stream)
/*****************************************************************/
/****************************************************************************
 * fscanbool(...) [ body ]
 ****************************************************************************/
bool, bool fscanbool( TermFile &stream)
/*****************************************************************/
/****************************************************************************
 * fscanchar(...) [ body ]
 ****************************************************************************/
inline
bool, char fscanchar( TermFile &stream)
/*****************************************************************/
/****************************************************************************
 * fscanstring(...) [ body ]
 ****************************************************************************/
inline
bool, string fscanstring( TermFile &stream, int length)
/*****************************************************************/
/****************************************************************************
 * scanint(...) [ body ]
 ****************************************************************************/
inline
bool, int scanint()
/*****************************************************************/
/****************************************************************************
 * scanfloat(...) [ body ]
 ****************************************************************************/
inline
bool, float scanfloat()
/*****************************************************************/
/****************************************************************************
 * scandouble(...) [ body ]
 ****************************************************************************/
inline
bool, double scandouble()
/*****************************************************************/
/****************************************************************************
 * scanbool(...) [ body ]
 ****************************************************************************/
bool, bool scanbool()
/*****************************************************************/
/****************************************************************************
 * scanchar(...) [ body ]
 ****************************************************************************/
inline
bool, char scanchar()
/*****************************************************************/
/****************************************************************************
 * scanstring(...) [ body ]
 ****************************************************************************/
inline
bool, string scanstring( int length)
/*-----------------------------------------------*/

4.4 PPM.sac

/*-----------------------------------------------*/
module PPM;
use Color8 : { color, shape};
use File : { File, fopen, fclose};
use RuntimeError : { error};
use ScalarArith : { ==};
use String : { string};
use TermFile : { TermFile, stdin, stdout};
export { readPPM, printPPM};
/*
 *  prototypes for externals (FUNDECS)
 */
external color[.,.] readStream( TermFile &stream);
#pragma effect Terminal::TheTerminal
external color[.,.] readStream( File &stream);
#pragma effect FileSystem::TheFileSystem
external void  writeStream( TermFile &stream, color[.,.] image, int[2] shp, bool binary);
#pragma effect Terminal::TheTerminal
external void  writeStream( File &stream, color[.,.] image, int[2] shp, bool binary);
#pragma effect FileSystem::TheFileSystem
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * readPPM(...) [ body ]
 ****************************************************************************/
inline
color[.,.] readPPM()
/****************************************************************************
 * readPPM(...) [ body ]
 ****************************************************************************/
inline
color[.,.] readPPM( string name)
/****************************************************************************
 * printPPM(...) [ body ]
 ****************************************************************************/
inline
void  printPPM( color[.,.] img)
/****************************************************************************
 * printPPM(...) [ body ]
 ****************************************************************************/
inline
void  printPPM( color[.,.] img, string name, bool binary)
/*-----------------------------------------------*/

4.5 PGM.sac

/*-----------------------------------------------*/
class PGM;
use String : { string};
use ArrayBasics : { shape};
use File : { File, fopen, fclose};
use SysErr : { fail};
use RuntimeError : { error};
use ScalarArith : { ==, >};
use ArrayTransform : { maxval};
export all;
/*
 *  type definitions
 */
external classtype PGM::PGM;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n     * Open an existing PGM file using filename \’name\’\n     * and read the PGM header.\n     */external PGM parsePGM( File &fp);
#pragma effect FileSystem::TheFileSystem
/*\n     * Read the PGM header from an open file stream.\n     */external void  freePGM( PGM &pgm);
#pragma effect FileSystem::TheFileSystem
external int PGMwidth( PGM &pgm);
#pragma effect FileSystem::TheFileSystem
/*\n     * Extract the width of the PGM image.\n     */external int PGMheight( PGM &pgm);
#pragma effect FileSystem::TheFileSystem
/*\n     * Extract the height of the PGM image.\n     */external int PGMmaxval( PGM &pgm);
#pragma effect FileSystem::TheFileSystem
/*\n     * Extract the maximum possible pixel value of the PGM image.\n     */external int[.,.] readPGMdata( PGM &pgm);
#pragma effect FileSystem::TheFileSystem
/*\n     * Read the pixel data from file and return it as an image.\n     */external File PGMstream( PGM &pgm);
#pragma effect FileSystem::TheFileSystem
/*\n     * Extract the file pointer from the PGM data structure.\n     */external PGM newPGM( int[2] shp, int mval, bool binary, File &fp);
#pragma effect FileSystem::TheFileSystem
/*\n     * Allocate a new PGM structure for writing.\n     */external void  writePGMheader( PGM &pgm);
#pragma effect FileSystem::TheFileSystem
external void  writePGMdata( int[.,.] data, PGM &pgm);
#pragma effect FileSystem::TheFileSystem
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * readPGM(...) [ body ]
 ****************************************************************************/
int[.,.], int readPGM( string filename)
/*\n     * Read a PGM image from file \’filename\’.\n     * Return:\n     *     - the data as a two dimensional int array\n     *     - the maximum pixel value in the range [1, 65535].\n     *       Usually the maximum pixel value is 255,\n     *       but for 16-bit images it is 65535.\n     *       In very rare cases it has another value.\n     */
/****************************************************************************
 * readPGM(...) [ body ]
 ****************************************************************************/
int[.,.], int readPGM( File stream)
/*\n     * Read a PGM image from the open file stream \’stream\’.\n     * Return:\n     *     - the data as a two dimensional int array\n     *     - the maximum pixel value in the range [1, 65535].\n     *       Usually the maximum pixel value is 255,\n     *       but for 16-bit images it is 65535.\n     *       In very rare cases it has another value.\n     */
/****************************************************************************
 * openPGM(...) [ body ]
 ****************************************************************************/
PGM openPGM( string name)
/*\n     * Write the PGM data to file.\n     */
/****************************************************************************
 * writePGM(...) [ body ]
 ****************************************************************************/
void  writePGM( int[.,.] image, int[2] shp, int mval, bool binary, string name)
/*\n     * Write \’image\’ to file using the PGM image format:\n     * \’shp\’ gives the dimensions.\n     * \’mval\’ specifies the bitness: 255 for 8-bit, 65535 for 16-bit.\n     * \’binary\’ specifies binary mode if true, else text mode.\n     * \’name\’ gives the filename.\n     */
/****************************************************************************
 * writePGM(...) [ body ]
 ****************************************************************************/
void  writePGM( int[.,.] image, int[2] shp, int mval, bool binary, File stream)
/*\n * Write an image to file in the PGM format.\n */
/****************************************************************************
 * writePGM(...) [ body ]
 ****************************************************************************/
inline
void  writePGM( int[.,.] img, int mval, bool binary, string filename)
/*\n * Write an image to file in the binary PGM format.\n */
/****************************************************************************
 * writePGM(...) [ body ]
 ****************************************************************************/
inline
void  writePGM( int[.,.] img, int mval, string filename)
/*\n * Write an image to file in the PGM format\n * and calculate a suitable \’mval\’.\n */
/****************************************************************************
 * writePGM(...) [ body ]
 ****************************************************************************/
inline
void  writePGM( int[.,.] img, bool binary, string filename)
/*\n * Write an image to file in the binary PGM format\n * and calculate a suitable \’mval\’.\n */
/****************************************************************************
 * writePGM(...) [ body ]
 ****************************************************************************/
inline
void  writePGM( int[.,.] img, string filename)
/*-----------------------------------------------*/

4.6 ListIO.sac

/*-----------------------------------------------*/
module ListIO;
use IOresources : all;
use List : all;
use String : { string, to_string};
use ScalarIO : { scanint};
use ScalarArith : all;
use TermFile : { TermFile};
export all;
/*
 *  function definitions (FUNDEFS)
 */
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( File &stream, list L)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( File &stream, list L, int ElemsPerLine)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( File &stream, list L, int ElemsPerLine, int ColWidth)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( TermFile &stream, list L)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( TermFile &stream, list L, int ElemsPerLine)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
void  fprint( TermFile &stream, list L, int ElemsPerLine, int ColWidth)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( list L)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( list L, int ElemsPerLine)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
void  print( list L, int ElemsPerLine, int ColWidth)
/*-----------------------------------------------*/

4.7 IOresources.sac

/*-----------------------------------------------*/
module IOresources;
import File : { File};
import TermFile : { TermFile, stdin, stdout, stderr};
import Terminal : { TheTerminal};
import FileSystem : { TheFileSystem};
import World : { TheWorld};
export all;
/*-----------------------------------------------*/

4.8 GreyIO.sac

/*-----------------------------------------------*/
module GreyIO;
use IOresources : all;
use Grey : { grey};
import ArrayIO : { print};
import ScalarIO : { print};
export all;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( grey[*] c)
/*-----------------------------------------------*/

4.9 File.sac

/*-----------------------------------------------*/
class File;
use FileSystem : { TheFileSystem};
use String : { string};
use SysErr : { syserr};
export all;
/*
 *  type definitions
 */
external classtype File::File;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n   *  Functions to open and close files.\n   */external syserr, File fopen( string NAME, string MODE);
#pragma effect TheFileSystem
/*\n     * Open the file NAME in mode MODE. The modes supported are identical\n     * to the C version of this function. An error condition and a file\n     * handle are returned. You should inspect the error condition before\n     * using the file handle.\n     */external syserr, File mkstemp( string template);
#pragma effect TheFileSystem
/*\n     * Create a temporary file using a name generated by the function\n     * mkstemp, and returns the corresponding file handle. The file is \n     * opened for update (\"w+\"). An error condition is\n     * returned as well. You should inspect the error condition before\n     * using the file handle.\n     */external void  fclose( File STREAM);
#pragma effect TheFileSystem
external void  fremove( string fname);
#pragma effect TheFileSystem
/*\n   *  Functions for low-level input / output operations\n   */external void  fputc( char C, File &STREAM);
external char fgetc( File &STREAM);
/*\n     * Get the next character from the input stream STREAM. \n     */external void  ungetc( char C, File &STREAM);
external void  fputs( string S, File &STREAM);
external void  fprintf( File &STREAM, string FORMAT, ...);
external int, ... fscanf( File &STREAM, string FORMAT);
external string fscans( File &STREAM, int MAX);
external string fscanl( File &STREAM, int MAX);
external bool feof( File &STREAM);
/*\n     * Test the stream STREAM for having reached the end of the respective \n     * file.\n     */external void  fflush( File &STREAM);
external void  fseek( File &STREAM, int OFFSET, int BASE);
external int ftell( File &STREAM);
/*\n     * Return the offset of the current byte relative to\n     * the beginning of the file associated with STREAM.\n     */external void  rewind( File &STREAM);
/*
 *  function definitions (FUNDEFS)
 */
/*\n     * Create a temporary file using a name generated by the function\n     * mkstemp, and returns the corresponding file handle. The file is \n     * opened for update (\"w+\"). An error condition is\n     * returned as well. You should inspect the error condition before\n     * using the file handle.\n     * The name of the resulting file is derived from the template\n     * argument. It should look like a file name with six trailing \’X\’s.\n     * Each X is then replaced by a character  from  the  portable  file \n     * name character set. The characters are chosen such that the \n     * resulting name does not duplicate the name of an existing file.\n     */
/****************************************************************************
 * tmpfile(...) [ body ]
 ****************************************************************************/
syserr, File tmpfile()
/*-----------------------------------------------*/

4.10 FibreIO.sac

/*-----------------------------------------------*/
module FibreIO;
use IOresources : all;
use Array : { shape, sel, dim};
use String : { string};
use StringArray : { stringArray};
use TermFile : { TermFile};
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
/*****************************************************************\n * FibreScan on File\n */external int FibreScanInt( File &stream);
external float FibreScanFloat( File &stream);
external double FibreScanDouble( File &stream);
external int[*] FibreScanIntArray( File &stream);
external float[*] FibreScanFloatArray( File &stream);
external double[*] FibreScanDoubleArray( File &stream);
external stringArray FibreScanStringArray( File &stream);
external int FibreScanInt( TermFile &stream);
external float FibreScanFloat( TermFile &stream);
external double FibreScanDouble( TermFile &stream);
external int[*] FibreScanIntArray( TermFile &stream);
external float[*] FibreScanFloatArray( TermFile &stream);
external double[*] FibreScanDoubleArray( TermFile &stream);
external stringArray FibreScanStringArray( TermFile &stream);
external int[*] FibreScanIntArrayStr( string stream);
external float[*] FibreScanFloatArrayStr( string stream);
external double[*] FibreScanDoubleArrayStr( string stream);
external stringArray FibreScanStringArrayStr( string stream);
external void  FibrePrint( File &stream, int DIM, int[+] SHAPE, int[+] ARRAY);
external void  FibrePrint( File &stream, int DIM, int[+] SHAPE, float[+] ARRAY);
external void  FibrePrint( File &stream, int DIM, int[+] SHAPE, double[+] ARRAY);
external void  FibrePrint( File &stream, int DIM, int[+] SHAPE, stringArray ARRAY);
external void  FibrePrint( TermFile &stream, int DIM, int[+] SHAPE, int[+] ARRAY);
external void  FibrePrint( TermFile &stream, int DIM, int[+] SHAPE, float[+] ARRAY);
external void  FibrePrint( TermFile &stream, int DIM, int[+] SHAPE, double[+] ARRAY);
external void  FibrePrint( TermFile &stream, int DIM, int[+] SHAPE, stringArray ARRAY);
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * FibreScanIntArray(...) [ body ]
 ****************************************************************************/
int[*] FibreScanIntArray()
/****************************************************************************
 * FibreScanFloatArray(...) [ body ]
 ****************************************************************************/
float[*] FibreScanFloatArray()
/****************************************************************************
 * FibreScanDoubleArray(...) [ body ]
 ****************************************************************************/
double[*] FibreScanDoubleArray()
/****************************************************************************
 * FibreScanStringArray(...) [ body ]
 ****************************************************************************/
stringArray FibreScanStringArray()
/*****************************************************************/
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( File &stream, int[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( File &stream, int arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( File &stream, float[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( File &stream, float arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( File &stream, double[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( File &stream, double arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( File &stream, stringArray arr)
/*****************************************************************/
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( TermFile &stream, int[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( TermFile &stream, int arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( TermFile &stream, float[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( TermFile &stream, float arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( TermFile &stream, double[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( TermFile &stream, double arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( TermFile &stream, stringArray arr)
/*****************************************************************/
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( int[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( int arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( float[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( float arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( double[+] arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( double arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( StringArray::stringArray arr)
/****************************************************************************
 * FibrePrint(...) [ body ]
 ****************************************************************************/
inline
void  FibrePrint( string scaler)
/*-----------------------------------------------*/

4.11 ComplexIO.sac

/*-----------------------------------------------*/
module ComplexIO;
use IOresources : all;
use String : { string, to_string, sprintf};
use Complex : { complex, imag, real, toc, shape, dim};
use ScalarArith : { ==};
use TermFile : { TermFile};
export { print, fprint};
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n *  prototypes for externals (FUNDECS)\n */external void  printarray( File &stream, int d, int[.] s, complex[*] a);
external void  printarray( TermFile &stream, int d, int[.] s, complex[*] a);
external void  printarray( File &stream, string format, int d, int[.] s, complex[*] a);
external void  printarray( TermFile &stream, string format, int d, int[.] s, complex[*] a);
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, complex c)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, complex c, int mode)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( File &stream, complex c, int mode, int prec)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, complex c)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, complex c, int mode)
/*****************************************************************/
/****************************************************************************
 * fprint(...) [ body ]
 ****************************************************************************/
inline
void  fprint( TermFile &stream, complex c, int mode, int prec)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( complex c)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( complex c, int mode)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( complex c, int mode, int prec)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( complex[+] arr)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( complex[+] arr, int mode)
/*****************************************************************/
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( complex[+] arr, int mode, int prec)
/*****************************************************************/
/****************************************************************************
 * fscancomplex(...) [ body ]
 ****************************************************************************/
inline
bool, complex fscancomplex( File &stream)
/*****************************************************************/
/****************************************************************************
 * fscancomplex(...) [ body ]
 ****************************************************************************/
inline
bool, complex fscancomplex( File &stream, int mode)
/*****************************************************************/
/****************************************************************************
 * fscancomplex(...) [ body ]
 ****************************************************************************/
inline
bool, complex fscancomplex( TermFile &stream)
/*****************************************************************/
/****************************************************************************
 * fscancomplex(...) [ body ]
 ****************************************************************************/
inline
bool, complex fscancomplex( TermFile &stream, int mode)
/*****************************************************************/
/****************************************************************************
 * scancomplex(...) [ body ]
 ****************************************************************************/
inline
bool, complex scancomplex()
/*****************************************************************/
/****************************************************************************
 * scancomplex(...) [ body ]
 ****************************************************************************/
inline
bool, complex scancomplex( int mode)
/*-----------------------------------------------*/

4.12 Color8IO.sac

/*-----------------------------------------------*/
module Color8IO;
use IOresources : all;
use Color8 : { color};
import ArrayIO : { print};
export all;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * print(...) [ body ]
 ****************************************************************************/
inline
void  print( color[*] c)
/*-----------------------------------------------*/

4.13 BinFile.sac

/*-----------------------------------------------*/
class BinFile;
use World : { TheWorld};
use FileSystem : { TheFileSystem};
use String : { string};
use SysErr : { syserr};
export all;
/*
 *  type definitions
 */
external classtype BinFile::BinFile;
/*
 *  prototypes for externals (FUNDECS)
 */
/*\n   *  Functions to open and close files.\n   */external syserr, BinFile binfopen( string NAME, int FLAGS);
#pragma effect TheFileSystem
/*\n     * Open the file NAME with flags FLAGS. The flags are set in the\n     * same way as for the C version of this function. The permissions\n     * of a newly created file will be set to 00600 & ~umask. An error\n     * condition and a file handle are returned. You should inspect\n     * the error condition before using the file handle.\n     */external syserr binfclose( BinFile BINSTREAM);
#pragma effect TheFileSystem
/*\n   * Functions that act as wrappers for the most important \n   * C flags for file IO. \n   */external int O_RDONLY();
/*\n     * Returns the C constant O_RDONLY, which is used to open files with\n     * read only access.\n     */external int O_WRONLY();
/*\n     * Returns the C constant O_WRONLY, which is used to open files with\n     * write only access.\n     */external int O_RDWR();
/*\n     * Returns the C constant O_RDWR, which is used to open files with\n     * read and write access.\n     */external int O_CREAT();
/*\n     * Returns the C constant O_CREAT, meaning that a file with the\n     * designated name will be created on opening if it does not\n     * yet exist.\n     */external int O_TRUNC();
/*\n   *  Functions to read from and write to files.\n   */external double[+] binfReadDoubleArray( BinFile &binstream, int DIM, int[.] SHAPE);
external void  binfWriteDoubleArray( BinFile &binstream, int DIM, int[+] SHAPE, double[+] ARRAY);
/*-----------------------------------------------*/

5 Numerical

5.1 SaCMath.sac

/*-----------------------------------------------*/
module SaCMath;
export all;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * pow2(...) [ body ]
 ****************************************************************************/
inline
int pow2( int a)
/* round down */
/****************************************************************************
 * log2(...) [ body ]
 ****************************************************************************/
inline
int log2( int a)
/*-----------------------------------------------*/

5.2 Numerical.sac

/*-----------------------------------------------*/
module Numerical;
import Math : all;
import MathArray : all;
export all;
/*-----------------------------------------------*/

5.3 MathArray.sac

/*-----------------------------------------------*/
module MathArray;
use ScalarArith : { zero};
use ArrayBasics : all;
import Math : all;
export all;
/*
 *  function definitions (FUNDEFS)
 */
/*****************************************************************************\n *\n *   Definition of SAC standard module MathArray.\n *\n *****************************************************************************/
/****************************************************************************
 * log(...) [ body ]
 ****************************************************************************/
inline
float[+] log( float[+] A)
/****************************************************************************
 * log(...) [ body ]
 ****************************************************************************/
inline
double[+] log( double[+] A)
/****************************************************************************
 * log2(...) [ body ]
 ****************************************************************************/
inline
float[+] log2( float[+] A)
/****************************************************************************
 * log2(...) [ body ]
 ****************************************************************************/
inline
double[+] log2( double[+] A)
/****************************************************************************
 * log10(...) [ body ]
 ****************************************************************************/
inline
float[+] log10( float[+] A)
/****************************************************************************
 * log10(...) [ body ]
 ****************************************************************************/
inline
double[+] log10( double[+] A)
/****************************************************************************
 * exp(...) [ body ]
 ****************************************************************************/
inline
float[+] exp( float[+] A)
/****************************************************************************
 * exp(...) [ body ]
 ****************************************************************************/
inline
double[+] exp( double[+] A)
/****************************************************************************
 * fabs(...) [ body ]
 ****************************************************************************/
inline
float[+] fabs( float[+] A)
/****************************************************************************
 * fabs(...) [ body ]
 ****************************************************************************/
inline
double[+] fabs( double[+] A)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
float[+] sqrt( float[+] A)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
double[+] sqrt( double[+] A)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
float[+] floor( float[+] A)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
double[+] floor( double[+] A)
/****************************************************************************
 * pow(...) [ body ]
 ****************************************************************************/
inline
float[+] pow( float[+] A, float S)
/****************************************************************************
 * pow(...) [ body ]
 ****************************************************************************/
inline
double[+] pow( double[+] A, double S)
/*-----------------------------------------------*/

5.4 Math.sac

/*-----------------------------------------------*/
module Math;
use ScalarArith : all;
export all;
/*
 *  prototypes for externals (FUNDECS)
 */
/* Trigonometric functions.  */external double cos( double X);
external double sin( double X);
/* Sine of X.  */external double tan( double X);
/* Tangent of X.  */external double acos( double X);
/* Arc cosine of X.  */external double asin( double X);
/* Arc sine of X.  */external double atan( double X);
/* Arc tangent of X.  */external double atan2( double X, double Y);
/* Hyperbolic functions.  */external double cosh( double X);
/* Hyperbolic cosine of X.  */external double sinh( double X);
/* Hyperbolic sine of X.  */external double tanh( double X);
/* Hyperbolic tangent of X.  */external double acosh( double X);
/* Hyperbolic arc cosine of X.  */external double asinh( double X);
/* Hyperbolic arc sine of X.  */external double atanh( double X);
/* Exponential and logarithmic functions.  */external double exp( double X);
/* Exponentional function of X.  */external float expf( float X);
/* Exponentional function of X.  */external double, int frexp( double X);
/* Break X into a normalized fraction and an integral power of 2.  */external double ldexp( double X, int EXP);
/* X times (two to the EXP power).  */external double log( double X);
/* Natural logarithm of X.  */external double log10( double X);
/* Base-ten logarithm of X.  */external double log2( double X);
/* Base-two logarithm of X.  */external double expm1( double X);
/* Return exp(X) - 1.  */external double log1p( double X);
/* Return log(1 + X).  */external double, double modf( double X);
/* Power functions.  */external double pow( double X, double Y);
/* Return X to the Y power.  */external float powf( float X, float Y);
/* Return X to the Y power.  */external double sqrt( double X);
/* Return the square root of X.  */external float sqrtf( float X);
/* Return the square root of X.  */external double cbrt( double X);
/* Nearest integer, absolute value, and remainder functions.  */external double ceil( double X);
/* Smallest integral value not less than X.  */external double fabs( double X);
/* Absolute value of X.  */external double floor( double X);
/* Largest integer not greater than X.  */external double fmod( double X, double Y);
/* Range testing functions  */external bool isinf( double X);
external bool isnan( double X);
external bool finite( double X);
external double copysign( double X, double Y);
/* Return X with its signed changed to Y\’s.  */external double rint( double X);
/* Return the integer nearest X in the direction of the\n       prevailing rounding mode.  */external double hypot( double X, double Y);
/*
 *  function definitions (FUNDEFS)
 */
/* Trigonometric functions.  */
/****************************************************************************
 * cos(...) [ body ]
 ****************************************************************************/
inline
float cos( float X)
/* Cosine of X.  */
/****************************************************************************
 * sin(...) [ body ]
 ****************************************************************************/
inline
float sin( float X)
/* Sine of X.  */
/****************************************************************************
 * sincos(...) [ body ]
 ****************************************************************************/
inline
float, float sincos( float x)
/****************************************************************************
 * sincos(...) [ body ]
 ****************************************************************************/
inline
double, double sincos( double x)
/****************************************************************************
 * tan(...) [ body ]
 ****************************************************************************/
inline
float tan( float X)
/* Tangent of X.  */
/****************************************************************************
 * acos(...) [ body ]
 ****************************************************************************/
inline
float acos( float X)
/* Arc cosine of X.  */
/****************************************************************************
 * asin(...) [ body ]
 ****************************************************************************/
inline
float asin( float X)
/* Arc sine of X.  */
/****************************************************************************
 * atan(...) [ body ]
 ****************************************************************************/
inline
float atan( float X)
/* Arc tangent of X.  */
/****************************************************************************
 * atan2(...) [ body ]
 ****************************************************************************/
inline
float atan2( float X, float Y)
/* Hyperbolic functions.  */
/****************************************************************************
 * cosh(...) [ body ]
 ****************************************************************************/
inline
float cosh( float X)
/* Hyperbolic cosine of X.  */
/****************************************************************************
 * sinh(...) [ body ]
 ****************************************************************************/
inline
float sinh( float X)
/* Hyperbolic sine of X.  */
/****************************************************************************
 * tanh(...) [ body ]
 ****************************************************************************/
inline
float tanh( float X)
/* Hyperbolic tangent of X.  */
/****************************************************************************
 * acosh(...) [ body ]
 ****************************************************************************/
inline
float acosh( float X)
/* Hyperbolic arc cosine of X.  */
/****************************************************************************
 * asinh(...) [ body ]
 ****************************************************************************/
inline
float asinh( float X)
/* Hyperbolic arc sine of X.  */
/****************************************************************************
 * atanh(...) [ body ]
 ****************************************************************************/
inline
float atanh( float X)
/* Exponential and logarithmic functions.  */
/****************************************************************************
 * exp(...) [ body ]
 ****************************************************************************/
inline
float exp( float X)
/* Exponentional function of X.  */
/****************************************************************************
 * frexp(...) [ body ]
 ****************************************************************************/
inline
float, int frexp( float X)
/* Break X into a normalized fraction and an integral power of 2.  */
/****************************************************************************
 * ldexp(...) [ body ]
 ****************************************************************************/
inline
float ldexp( float X, int EXP)
/* X times (two to the EXP power).  */
/****************************************************************************
 * log(...) [ body ]
 ****************************************************************************/
inline
float log( float X)
/* Natural logarithm of X.  */
/****************************************************************************
 * log10(...) [ body ]
 ****************************************************************************/
inline
float log10( float X)
/* Base-ten logarithm of X.  */
/****************************************************************************
 * log2(...) [ body ]
 ****************************************************************************/
inline
float log2( float X)
/* Base-two logarithm of X.  */
/****************************************************************************
 * expm1(...) [ body ]
 ****************************************************************************/
inline
float expm1( float X)
/* Return exp(X) - 1.  */
/****************************************************************************
 * log1p(...) [ body ]
 ****************************************************************************/
inline
float log1p( float X)
/* Return log(1 + X).  */
/****************************************************************************
 * modf(...) [ body ]
 ****************************************************************************/
inline
float, float modf( float X)
/* Power functions.  */
/****************************************************************************
 * pow(...) [ body ]
 ****************************************************************************/
inline
float pow( float X, float Y)
/* Return X to the Y power.  */
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
float sqrt( float X)
/* Return the square root of X.  */
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
float cbrt( float X)
/* Nearest integer, absolute value, and remainder functions.  */
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
float ceil( float X)
/* Smallest integral value not less than X.  */
/****************************************************************************
 * fabs(...) [ body ]
 ****************************************************************************/
inline
float fabs( float X)
/* Absolute value of X.  */
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
float floor( float X)
/* Largest integer not greater than X.  */
/****************************************************************************
 * fmod(...) [ body ]
 ****************************************************************************/
inline
float fmod( float X, float Y)
/* Miscellaneous  */
/****************************************************************************
 * copysign(...) [ body ]
 ****************************************************************************/
inline
float copysign( float X, float Y)
/* Return X with its signed changed to Y\’s.  */
/****************************************************************************
 * rint(...) [ body ]
 ****************************************************************************/
inline
float rint( float X)
/* Return the integer nearest X in the direction of the\n       prevailing rounding mode.  */
/****************************************************************************
 * hypot(...) [ body ]
 ****************************************************************************/
inline
float hypot( float X, float Y)
/* Return ‘sqrt(X*X + Y*Y)\’.  */
/****************************************************************************
 * sign(...) [ body ]
 ****************************************************************************/
inline
int sign( float x)
/****************************************************************************
 * sign(...) [ body ]
 ****************************************************************************/
inline
int sign( double x)
/* Numerical constants */
/****************************************************************************
 * fl_e(...) [ body ]
 ****************************************************************************/
inline
float fl_e()
/****************************************************************************
 * fl_log2e(...) [ body ]
 ****************************************************************************/
inline
float fl_log2e()
/****************************************************************************
 * fl_log10e(...) [ body ]
 ****************************************************************************/
inline
float fl_log10e()
/****************************************************************************
 * fl_ln2(...) [ body ]
 ****************************************************************************/
inline
float fl_ln2()
/****************************************************************************
 * fl_ln10(...) [ body ]
 ****************************************************************************/
inline
float fl_ln10()
/****************************************************************************
 * fl_pi(...) [ body ]
 ****************************************************************************/
inline
float fl_pi()
/****************************************************************************
 * fl_pi_2(...) [ body ]
 ****************************************************************************/
inline
float fl_pi_2()
/****************************************************************************
 * fl_pi_rec(...) [ body ]
 ****************************************************************************/
inline
float fl_pi_rec()
/****************************************************************************
 * fl_pi_4(...) [ body ]
 ****************************************************************************/
inline
float fl_pi_4()
/****************************************************************************
 * fl_pi_rec_2(...) [ body ]
 ****************************************************************************/
inline
float fl_pi_rec_2()
/****************************************************************************
 * fl_sqrtpi_rec_2(...) [ body ]
 ****************************************************************************/
inline
float fl_sqrtpi_rec_2()
/****************************************************************************
 * fl_sqrt2(...) [ body ]
 ****************************************************************************/
inline
float fl_sqrt2()
/****************************************************************************
 * fl_sqrt2_rec(...) [ body ]
 ****************************************************************************/
inline
float fl_sqrt2_rec()
/****************************************************************************
 * e(...) [ body ]
 ****************************************************************************/
inline
double e()
/****************************************************************************
 * log2e(...) [ body ]
 ****************************************************************************/
inline
double log2e()
/****************************************************************************
 * log10e(...) [ body ]
 ****************************************************************************/
inline
double log10e()
/****************************************************************************
 * ln2(...) [ body ]
 ****************************************************************************/
inline
double ln2()
/****************************************************************************
 * ln10(...) [ body ]
 ****************************************************************************/
inline
double ln10()
/****************************************************************************
 * pi(...) [ body ]
 ****************************************************************************/
inline
double pi()
/****************************************************************************
 * pi_2(...) [ body ]
 ****************************************************************************/
inline
double pi_2()
/****************************************************************************
 * pi_rec(...) [ body ]
 ****************************************************************************/
inline
double pi_rec()
/****************************************************************************
 * pi_4(...) [ body ]
 ****************************************************************************/
inline
double pi_4()
/****************************************************************************
 * pi_rec_2(...) [ body ]
 ****************************************************************************/
inline
double pi_rec_2()
/****************************************************************************
 * sqrtpi_rec_2(...) [ body ]
 ****************************************************************************/
inline
double sqrtpi_rec_2()
/****************************************************************************
 * sqrt2(...) [ body ]
 ****************************************************************************/
inline
double sqrt2()
/****************************************************************************
 * sqrt2_rec(...) [ body ]
 ****************************************************************************/
inline
double sqrt2_rec()
/*-----------------------------------------------*/

5.5 FixedPoint.sac

/*-----------------------------------------------*/
module FixedPoint;
use SaCMath : all;
export all;
/*
 *  type definitions
 */
typedef int fixedpoint_32;
typedef int fixedpoint_24;
typedef int fixedpoint_16;
typedef int fixedpoint_8;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 +( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] +( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] +( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] +( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 +( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] +( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] +( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] +( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 +( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] +( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] +( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] +( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 +( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] +( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] +( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * +(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] +( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 -( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] -( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] -( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] -( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 -( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] -( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] -( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] -( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 -( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] -( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] -( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] -( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 -( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] -( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] -( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * -(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] -( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 /( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] /( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] /( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] /( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 /( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] /( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] /( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] /( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 /( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] /( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] /( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] /( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 /( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] /( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] /( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * /(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] /( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 *( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] *( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] *( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] *( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 *( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] *( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] *( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] *( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 *( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] *( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] *( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] *( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 *( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] *( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] *( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * *(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] *( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 sqrt( fixedpoint_8 arg)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] sqrt( fixedpoint_8[+] a)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 sqrt( fixedpoint_16 arg)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] sqrt( fixedpoint_16[+] a)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 sqrt( fixedpoint_24 arg)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] sqrt( fixedpoint_24[+] a)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 sqrt( fixedpoint_32 arg)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] sqrt( fixedpoint_32[+] a)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 cbrt( fixedpoint_8 arg)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] cbrt( fixedpoint_8[+] a)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 cbrt( fixedpoint_16 arg)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] cbrt( fixedpoint_16[+] a)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 cbrt( fixedpoint_24 arg)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] cbrt( fixedpoint_24[+] a)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 cbrt( fixedpoint_32 arg)
/****************************************************************************
 * cbrt(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] cbrt( fixedpoint_32[+] a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int trunc( fixedpoint_8 a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int[+] trunc( fixedpoint_8[+] a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int trunc( fixedpoint_16 a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int[+] trunc( fixedpoint_16[+] a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int trunc( fixedpoint_24 a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int[+] trunc( fixedpoint_24[+] a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int trunc( fixedpoint_32 a)
/****************************************************************************
 * trunc(...) [ body ]
 ****************************************************************************/
inline
int[+] trunc( fixedpoint_32[+] a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int floor( fixedpoint_8 a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int[+] floor( fixedpoint_8[+] a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int floor( fixedpoint_16 a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int[+] floor( fixedpoint_16[+] a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int floor( fixedpoint_24 a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int[+] floor( fixedpoint_24[+] a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int floor( fixedpoint_32 a)
/****************************************************************************
 * floor(...) [ body ]
 ****************************************************************************/
inline
int[+] floor( fixedpoint_32[+] a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int ceil( fixedpoint_8 a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int[+] ceil( fixedpoint_8[+] a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int ceil( fixedpoint_16 a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int[+] ceil( fixedpoint_16[+] a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int ceil( fixedpoint_24 a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int[+] ceil( fixedpoint_24[+] a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int ceil( fixedpoint_32 a)
/****************************************************************************
 * ceil(...) [ body ]
 ****************************************************************************/
inline
int[+] ceil( fixedpoint_32[+] a)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool <( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool <( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool <( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool <( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * <(...) [ body ]
 ****************************************************************************/
inline
bool[+] <( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool >( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool >( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool >( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool >( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * >(...) [ body ]
 ****************************************************************************/
inline
bool[+] >( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool ==( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool ==( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool ==( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool ==( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * ==(...) [ body ]
 ****************************************************************************/
inline
bool[+] ==( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool <=( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool <=( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool <=( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool <=( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * <=(...) [ body ]
 ****************************************************************************/
inline
bool[+] <=( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool >=( fixedpoint_8 a, fixedpoint_8 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_8[+] a, fixedpoint_8[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_8[+] a, fixedpoint_8 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_8 a, fixedpoint_8[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool >=( fixedpoint_16 a, fixedpoint_16 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_16[+] a, fixedpoint_16[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_16[+] a, fixedpoint_16 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_16 a, fixedpoint_16[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool >=( fixedpoint_24 a, fixedpoint_24 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_24[+] a, fixedpoint_24[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_24[+] a, fixedpoint_24 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_24 a, fixedpoint_24[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool >=( fixedpoint_32 a, fixedpoint_32 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_32[+] a, fixedpoint_32[+] b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_32[+] a, fixedpoint_32 b)
/****************************************************************************
 * >=(...) [ body ]
 ****************************************************************************/
inline
bool[+] >=( fixedpoint_32 a, fixedpoint_32[+] b)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int to_int( fixedpoint_8 a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int( fixedpoint_8[+] a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int to_int( fixedpoint_16 a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int( fixedpoint_16[+] a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int to_int( fixedpoint_24 a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int( fixedpoint_24[+] a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int to_int( fixedpoint_32 a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int( fixedpoint_32[+] a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int to_raw( fixedpoint_8 a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int[+] to_raw( fixedpoint_8[+] a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int to_raw( fixedpoint_16 a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int[+] to_raw( fixedpoint_16[+] a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int to_raw( fixedpoint_24 a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int[+] to_raw( fixedpoint_24[+] a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int to_raw( fixedpoint_32 a)
/****************************************************************************
 * to_raw(...) [ body ]
 ****************************************************************************/
inline
int[+] to_raw( fixedpoint_32[+] a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 to_fixedpoint_8( int a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] to_fixedpoint_8( int[+] a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 to_fixedpoint_16( int a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] to_fixedpoint_16( int[+] a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 to_fixedpoint_24( int a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] to_fixedpoint_24( int[+] a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 to_fixedpoint_32( int a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] to_fixedpoint_32( int[+] a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 to_fixedpoint_8( fixedpoint_8 a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] to_fixedpoint_8( fixedpoint_8[+] a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 to_fixedpoint_16( fixedpoint_8 a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] to_fixedpoint_16( fixedpoint_8[+] a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 to_fixedpoint_24( fixedpoint_8 a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] to_fixedpoint_24( fixedpoint_8[+] a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 to_fixedpoint_32( fixedpoint_8 a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] to_fixedpoint_32( fixedpoint_8[+] a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 to_fixedpoint_8( fixedpoint_16 a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] to_fixedpoint_8( fixedpoint_16[+] a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 to_fixedpoint_16( fixedpoint_16 a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] to_fixedpoint_16( fixedpoint_16[+] a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 to_fixedpoint_24( fixedpoint_16 a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] to_fixedpoint_24( fixedpoint_16[+] a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 to_fixedpoint_32( fixedpoint_16 a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] to_fixedpoint_32( fixedpoint_16[+] a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 to_fixedpoint_8( fixedpoint_24 a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] to_fixedpoint_8( fixedpoint_24[+] a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 to_fixedpoint_16( fixedpoint_24 a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] to_fixedpoint_16( fixedpoint_24[+] a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 to_fixedpoint_24( fixedpoint_24 a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] to_fixedpoint_24( fixedpoint_24[+] a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 to_fixedpoint_32( fixedpoint_24 a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] to_fixedpoint_32( fixedpoint_24[+] a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8 to_fixedpoint_8( fixedpoint_32 a)
/****************************************************************************
 * to_fixedpoint_8(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_8[+] to_fixedpoint_8( fixedpoint_32[+] a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16 to_fixedpoint_16( fixedpoint_32 a)
/****************************************************************************
 * to_fixedpoint_16(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_16[+] to_fixedpoint_16( fixedpoint_32[+] a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24 to_fixedpoint_24( fixedpoint_32 a)
/****************************************************************************
 * to_fixedpoint_24(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_24[+] to_fixedpoint_24( fixedpoint_32[+] a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32 to_fixedpoint_32( fixedpoint_32 a)
/****************************************************************************
 * to_fixedpoint_32(...) [ body ]
 ****************************************************************************/
inline
fixedpoint_32[+] to_fixedpoint_32( fixedpoint_32[+] a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[2] to_int2( fixedpoint_8 a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int2( fixedpoint_8[+] a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[2] to_int2( fixedpoint_16 a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int2( fixedpoint_16[+] a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[2] to_int2( fixedpoint_24 a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int2( fixedpoint_24[+] a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[2] to_int2( fixedpoint_32 a)
/****************************************************************************
 * to_int2(...) [ body ]
 ****************************************************************************/
inline
int[+] to_int2( fixedpoint_32[+] a)
/****************************************************************************
 * fraction(...) [ body ]
 ****************************************************************************/
inline
int fraction( fixedpoint_8 a)
/****************************************************************************
 * fraction(...) [ body ]
 ****************************************************************************/
inline
int fraction( fixedpoint_16 a)
/****************************************************************************
 * fraction(...) [ body ]
 ****************************************************************************/
inline
int fraction( fixedpoint_24 a)
/****************************************************************************
 * fraction(...) [ body ]
 ****************************************************************************/
inline
int fraction( fixedpoint_32 a)
/****************************************************************************
 * to_int(...) [ body ]
 ****************************************************************************/
inline
int to_int( int a)
/*-----------------------------------------------*/

5.6 ComplexMath.sac

/*-----------------------------------------------*/
module ComplexMath;
export all;
use ComplexBasics : all;
use ComplexScalarArith : all;
use ArrayBasics : { sel};
/*
 *  function definitions (FUNDEFS)
 */
/*  Trigonometric functions on complex numbers.  */
/****************************************************************************
 * sin(...) [ body ]
 ****************************************************************************/
inline
complex sin( complex X)
/****************************************************************************
 * cos(...) [ body ]
 ****************************************************************************/
inline
complex cos( complex X)
/****************************************************************************
 * tan(...) [ body ]
 ****************************************************************************/
inline
complex tan( complex X)
/****************************************************************************
 * asin(...) [ body ]
 ****************************************************************************/
inline
complex asin( complex X)
/****************************************************************************
 * acos(...) [ body ]
 ****************************************************************************/
inline
complex acos( complex X)
/****************************************************************************
 * atan(...) [ body ]
 ****************************************************************************/
inline
complex atan( complex X)
/* Hyperbolic functions on complex numbers.  */
/****************************************************************************
 * sinh(...) [ body ]
 ****************************************************************************/
inline
complex sinh( complex X)
/****************************************************************************
 * cosh(...) [ body ]
 ****************************************************************************/
inline
complex cosh( complex X)
/****************************************************************************
 * tanh(...) [ body ]
 ****************************************************************************/
inline
complex tanh( complex X)
/****************************************************************************
 * asinh(...) [ body ]
 ****************************************************************************/
inline
complex asinh( complex X)
/****************************************************************************
 * acosh(...) [ body ]
 ****************************************************************************/
inline
complex acosh( complex X)
/****************************************************************************
 * atanh(...) [ body ]
 ****************************************************************************/
inline
complex atanh( complex X)
/* Exponential and logarithmic functions on complex numbers.  */
/****************************************************************************
 * exp(...) [ body ]
 ****************************************************************************/
inline
complex exp( complex X)
/****************************************************************************
 * log(...) [ body ]
 ****************************************************************************/
inline
complex log( complex X)
/* Power functions on complex numbers.  */
/****************************************************************************
 * pow(...) [ body ]
 ****************************************************************************/
inline
complex pow( complex BASE, complex EXPON)
/****************************************************************************
 * pow(...) [ body ]
 ****************************************************************************/
inline
complex pow( complex BASE, double EXPON)
/****************************************************************************
 * pow(...) [ body ]
 ****************************************************************************/
inline
complex pow( double BASE, complex EXPON)
/****************************************************************************
 * sqrt(...) [ body ]
 ****************************************************************************/
inline
complex sqrt( complex X)
/*-----------------------------------------------*/

6 Classes

6.1 Random

6.1.1 Random.sac

/*-----------------------------------------------*/
class Random;
export all;
/*
 *  type definitions
 */
external classtype Random::Random;
/*
 *  prototypes for externals (FUNDECS)
 */
external void  srandom( uint SEED);
#pragma effect Random::RandomGen
external int random( int MIN, int MAX);
#pragma effect Random::RandomGen
external double random( double MIN, double MAX);
#pragma effect Random::RandomGen
/*
 *  global objects
 */
Random RandomGen;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * random(...) [ body ]
 ****************************************************************************/
int[*] random( int[.] shp, int MIN, int MAX)
/****************************************************************************
 * random(...) [ body ]
 ****************************************************************************/
double[*] random( int[.] shp, double MIN, double MAX)
/*-----------------------------------------------*/

6.1.2 RandLC.sac

/*-----------------------------------------------*/
class RandLC;
use ScalarArith : all;
use ArrayBasics : all;
export all;
/*
 *  type definitions
 */
classtype double[6] RandLC::RandLC;
/*
 *  function definitions (FUNDEFS)
 */
/*\n* randlc_init\n* initialisation of randlc\n*/
/****************************************************************************
 * create_randlc(...) [ body ]
 ****************************************************************************/
RandLC create_randlc( double x, double a)
/*\n * delete_randlc\n */
/****************************************************************************
 * delete_randlc(...) [ body ]
 ****************************************************************************/
void  delete_randlc( RandLC randlc)
/* randlc\n *\n *  generates random number\n */
/****************************************************************************
 * randlc(...) [ body ]
 ****************************************************************************/
double randlc( RandLC &randlc)
/*-----------------------------------------------*/

6.1.3 Rand48.sac

/*-----------------------------------------------*/
class Rand48;
export all;
/*
 *  type definitions
 */
external classtype Rand48::Rand48;
/*
 *  prototypes for externals (FUNDECS)
 */
external Rand48 randGen();
external void  srandom( long SEED);
#pragma effect Rand48::RandomGen
external int random( int MIN, int MAX);
#pragma effect Rand48::RandomGen
external double random( double MIN, double MAX);
#pragma effect Rand48::RandomGen
/*
 *  global objects
 */
Rand48 RandomGen = randGen() ;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * random(...) [ body ]
 ****************************************************************************/
int[*] random( int[.] shp, int MIN, int MAX)
/****************************************************************************
 * random(...) [ body ]
 ****************************************************************************/
double[*] random( int[.] shp, double MIN, double MAX)
/*-----------------------------------------------*/

6.1.4 Rand.sac

/*-----------------------------------------------*/
class Rand;
export all;
/*
 *  type definitions
 */
external classtype Rand::Rand;
/*
 *  prototypes for externals (FUNDECS)
 */
external Rand randGen();
external void  srandom( uint SEED);
#pragma effect Rand::RandomGen
external int random( int MIN, int MAX);
#pragma effect Rand::RandomGen
external int rand();
#pragma effect Rand::RandomGen
external double random( double MIN, double MAX);
#pragma effect Rand::RandomGen
/*
 *  global objects
 */
Rand RandomGen = randGen() ;
/*
 *  function definitions (FUNDEFS)
 */
/****************************************************************************
 * random(...) [ body ]
 ****************************************************************************/
int[*] random( int[.] shp, int MIN, int MAX)
/****************************************************************************
 * random(...) [ body ]
 ****************************************************************************/
double[*] random( int[.] shp, double MIN, double MAX)
/*-----------------------------------------------*/

6.2 Auxiliary

6.2.1 Counter.sac

/*-----------------------------------------------*/
class Counter;
use ScalarArith : { +};
export all;
/*
 *  type definitions
 */
classtype int Counter::Counter;
/*
 *  function definitions (FUNDEFS)
 */
/** <!-- ****************************************************************** -->\n * @brief Creates a new counter with initial value 0.\n * \n * @return created counter object\n ******************************************************************************/
/****************************************************************************
 * newCounter(...) [ body ]
 ****************************************************************************/
Counter newCounter()
/** <!-- ****************************************************************** -->\n * @brief Creates a new counter with initial value v.\n * \n * @param v initial value for new counter\n * \n * @return created counter object\n ******************************************************************************/
/****************************************************************************
 * newCounter(...) [ body ]
 ****************************************************************************/
Counter newCounter( int v)
/** <!-- ****************************************************************** -->\n * @brief Returns the current value of the counter\n * \n * @param cnt counter object\n * \n * @return counter object\’s value\n ******************************************************************************/
/****************************************************************************
 * valueOf(...) [ body ]
 ****************************************************************************/
int valueOf( Counter &cnt)
/** <!-- ****************************************************************** -->\n * @brief Increments the counter by one.\n * \n * @param cnt the counter object to update\n ******************************************************************************/
/****************************************************************************
 * increment(...) [ body ]
 ****************************************************************************/
void  increment( Counter &cnt)
/** <!-- ****************************************************************** -->\n * @brief Increments the counter by the value of the second argument.\n *\n * @param cnt the counter object to update\n ******************************************************************************/
/****************************************************************************
 * incrementBy(...) [ body ]
 ****************************************************************************/
void  incrementBy( Counter &cnt, int x)
/** <!-- ****************************************************************** -->\n * @brief Returns the current value of the counter object and\n *        increments the counter object by one\n * \n * @param cnt counter object to inspect and modify\n * \n * @return value of counter object before updating\n ******************************************************************************/
/****************************************************************************
 * next(...) [ body ]
 ****************************************************************************/
int next( Counter &cnt)
/*-----------------------------------------------*/

7 Auxiliary

7.1 Interval.sac

/*-----------------------------------------------*/
class Interval;
export { Interval};
/*
 *  type definitions
 */
external classtype Interval::Interval;
/*-----------------------------------------------*/

7.2 Hiding.sac

/*-----------------------------------------------*/
module Hiding;
export all;
use Array : all;
/*
 *  function definitions (FUNDEFS)
 */
/*\n * AKV -> AKS\n * AKS -> AKS\n * AKD -> AKD\n * AUD -> AUD\n * SCALAR -> SCALAR\n */
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
int[*] hideValue( int[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
int[*] hideValue( int i, int[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
char[*] hideValue( char[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
char[*] hideValue( int i, char[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
float[*] hideValue( float[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
float[*] hideValue( int i, float[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
double[*] hideValue( double[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
double[*] hideValue( int i, double[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
bool[*] hideValue( bool[*] in)
/****************************************************************************
 * hideValue(...) [ body ]
 ****************************************************************************/
inline
bool[*] hideValue( int i, bool[*] in)
/*\n * AKV -> AKD\n * AKS -> AKD\n * AKD -> AKD\n * AUD -> AUD\n * SCALAR -> SCALAR\n */
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
int[*] hideShape( int[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
int[*] hideShape( int i, int[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
char[*] hideShape( char[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
char[*] hideShape( int i, char[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
float[*] hideShape( float[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
float[*] hideShape( int i, float[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
double[*] hideShape( double[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
double[*] hideShape( int i, double[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
bool[*] hideShape( bool[*] in)
/****************************************************************************
 * hideShape(...) [ body ]
 ****************************************************************************/
inline
bool[*] hideShape( int i, bool[*] in)
/*\n * AKV -> AUD\n * AKS -> AUD\n * AKD -> AUD\n * AUD -> AUD\n * SCALAR -> AUD\n */
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
int[*] hideDimensionality( int[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
int[*] hideDimensionality( int i, int[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
char[*] hideDimensionality( char[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
char[*] hideDimensionality( int i, char[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
float[*] hideDimensionality( float[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
float[*] hideDimensionality( int i, float[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
double[*] hideDimensionality( double[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
double[*] hideDimensionality( int i, double[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
bool[*] hideDimensionality( bool[*] in)
/****************************************************************************
 * hideDimensionality(...) [ body ]
 ****************************************************************************/
inline
bool[*] hideDimensionality( int i, bool[*] in)
/*-----------------------------------------------*/

7.3 C99Benchmarking.sac

/*-----------------------------------------------*/
class C99Benchmarking;
import Interval : all;
use String : { string, sprintf, +};
use Array : all except { +};
use StdIO : all;
export { Interval, start, end, benchThis, returnResultUnit, printResult, getInterval, destroyInterval};
/*
 *  type definitions
 */
external classtype C99Benchmarking::C99Benchmarking;
/*
 *  prototypes for externals (FUNDECS)
 */
external C99Benchmarking create_TheBenchmarkObject();
#pragma effect World::TheWorld
external Interval _getInterval_u( string interval_name, int interval_number, int unit_time);
#pragma effect C99Benchmarking::TheBenchmarkObject
external Interval _getInterval( string interval_name, int interval_number);
#pragma effect C99Benchmarking::TheBenchmarkObject
external Interval _getInterval( string interval_name);
#pragma effect C99Benchmarking::TheBenchmarkObject
external Interval _getInterval( int interval_number);
#pragma effect C99Benchmarking::TheBenchmarkObject
external string benchUnitType( Interval &interval);
#pragma effect C99Benchmarking::TheBenchmarkObject
external void  benchStart( Interval &interval, double timestamp);
#pragma effect C99Benchmarking::TheBenchmarkObject
external void  benchEnd( Interval &interval, double timestamp);
#pragma effect C99Benchmarking::TheBenchmarkObject
external int benchUnit( Interval &interval);
#pragma effect C99Benchmarking::TheBenchmarkObject
external double benchRes( Interval &interval);
#pragma effect C99Benchmarking::TheBenchmarkObject
external int benchNum( Interval &interval);
#pragma effect C99Benchmarking::TheBenchmarkObject
external string benchName( Interval &interval);
#pragma effect C99Benchmarking::TheBenchmarkObject
/*\n * This function simply affects TheBenchmarkObject and nothing else.\n * Use it to inhibit code movement. The most common use for benchThis\n * is to call it within a function body of a function body that should be\n * evaluated after a call to start and before a call to end.\n */external void  benchThis();
#pragma effect C99Benchmarking::TheBenchmarkObject
external void  benchDestroyInterval( Interval interval);
#pragma effect C99Benchmarking::TheBenchmarkObject
/*
 *  global objects
 */
C99Benchmarking TheBenchmarkObject = create_TheBenchmarkObject() ;
/*
 *  function definitions (FUNDEFS)
 */
/*** time unit ***/
/****************************************************************************
 * getInterval(...) [ body ]
 ****************************************************************************/
Interval getInterval( string interval_name, int interval_number, int unit_time)
/*** !time unit ***/
/****************************************************************************
 * getInterval(...) [ body ]
 ****************************************************************************/
Interval getInterval( string interval_name, int interval_number)
/****************************************************************************
 * getInterval(...) [ body ]
 ****************************************************************************/
Interval getInterval( string interval_name)
/****************************************************************************
 * getInterval(...) [ body ]
 ****************************************************************************/
Interval getInterval( int interval_number)
/****************************************************************************
 * benchTime(...) [ body ]
 ****************************************************************************/
double benchTime( int unit_time)
/****************************************************************************
 * start(...) [ body ]
 ****************************************************************************/
void  start( Interval &interval)
/****************************************************************************
 * end(...) [ body ]
 ****************************************************************************/
void  end( Interval &interval)
/****************************************************************************
 * returnResultUnit(...) [ body ]
 ****************************************************************************/
double, string returnResultUnit( Interval &int1)
/****************************************************************************
 * printResult(...) [ body ]
 ****************************************************************************/
void  printResult( Interval &int1)
/****************************************************************************
 * printResult(...) [ body ]
 ****************************************************************************/
void  printResult( Interval &int1, Interval &int2)
/****************************************************************************
 * printResult(...) [ body ]
 ****************************************************************************/
void  printResult( Interval &int1, Interval &int2, Interval &int3)
/****************************************************************************
 * printResult(...) [ body ]
 ****************************************************************************/
void  printResult( Interval &int1, Interval &int2, Interval &int3, Interval &int4)
/****************************************************************************
 * printResult(...) [ body ]
 ****************************************************************************/
void  printResult( Interval &int1, Interval &int2, Interval &int3, Interval &int4, Interval &int5)
/****************************************************************************
 * printResult(...) [ body ]
 ****************************************************************************/
void  printResult( Interval &int1, Interval &int2, Interval &int3, Interval &int4, Interval &int5, Interval &int6)
/****************************************************************************
 * printResult(...) [ body ]
 ****************************************************************************/
void  printResult( Interval &int1, Interval &int2, Interval &int3, Interval &int4, Interval &int5, Interval &int6, Interval &int7)
/****************************************************************************
 * printResults(...) [ body ]
 ****************************************************************************/
void  printResults( StringArray::stringArray names, double[.] results)
/****************************************************************************
 * destroyInterval(...) [ body ]
 ****************************************************************************/
void  destroyInterval( Interval interval)
/*-----------------------------------------------*/

7.4 Benchmarking.sac

/*-----------------------------------------------*/
module Benchmarking;
export all;
import C99Benchmarking : all;
/*-----------------------------------------------*/