Home » Archimedes archive » Acorn User » AU 1994-02.adf » !C_Interp_C_Interp » Manual

Manual

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1994-02.adf » !C_Interp_C_Interp
Filename: Manual
Read OK:
File size: 4774 bytes
Load address: 0000
Exec address: 0000
File contents
C Interpreter � The Serial Port 1993
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

By Nigel Brown & Bob Voisey
Version 0.90g

Overview
--------

!Interpret implements a subset of the C programming language.  Unlike
traditional C compilers, however, this program interprets the source
programs without undergoing an intermediate compilation stage.

Initially developed for use as a script language within our software
products (Arcterm, ArcBBS & Sourcerer), !Interpret has now been
released as a stand alone interpreter in the hope that somebody might
find it useful.

Interpreters have some advantages over compilers:..

  - Easy to use; no need to worry about complex cli switches
  - Fast debugging; the lengthy compilation step is eliminated
  - Compact on disk; no intermediate object files are created

..they also have some disadvantages:

  - Slow execution; interpreters are much slower than compiled code
  - Poor management; it can be harder to keep your sources organised

Because the C programming language was designed for use with a
compiler, the syntax does not lend itself to interpretation so readily
as that of languages such as BASIC.  As a result interpreted C does
not generally run as quickly as, for example, BBC Basic.  Despite
this many programmers may prefer to code in the elegant syntax of C.


About this manual
-----------------

This document is not a C tutorial guide.  Rather, its purpose is to
define the subset of C implemented by the interpreter, and to outline
the differences between that and regular C.  If you have not encountered
the C programming language before, !Interpret might be a good program
with which to start - however you WILL need a programming guide to
fully understand some of the facilities.

Information within this manual is given in good faith, however The Serial
Port cannot guarantee it's accuracy, nor the suitability of !Interpret
for any particular task.


The Examples directory
----------------------

Along with !Interpret you will find an Examples directory.  Contained
within are a number of sources specifically designed to demonstrate
the facilities provided by the interpreter.  First time C programmers
may find these files useful, since theoretical C and practical C
sources are sometimes at variance.


Restrictions of !Interpret
--------------------------

They say you never get something for nothing.  In this case you _do_
get quite a lot of C, but certainly not an entire implementation.
Specifically, !Interpret does not support:

  - Structures (ie struct {} types)
  - Typedefs (user definable types)
  - Enumerated variables (ie enum {} types)
  - Floating point (ie long, double etc)
  - Miscellaneous constructs (notably do and switch)
  - Multiple source files (including #include directives)

Furthermore, !Interpret handles some C syntax in a slightly different
way to regular C.  These differences will be discussed in the appropriate
sections of this manual.

Although the above limitations are rather depressing news for experienced
C coders, the greater part of the language definition is implemented and
expressions are evaluated in just the same way as in regular C (with a
recursive descent parser).


Running !Interpret
------------------

There are two ways to run !Interpret:

 1.  Double click the application, whereupon you will be prompted to
     enter the name of the source file to be interpreted.  If the file
     is not in the current directory you will need to specify a full
     file path.  To assist you, an Obey file called !Here is included
     in the Examples directory to change the current directory to
     that location.

 2.  Run !Interpret by hand, from the cli or from an Obey file.
     Syntax: !Interpret <Source filename>
         Eg: !Interpret Examples.MySource

Once a source file has been loaded, execution will commence immediately.
To abort execution, hit the Escape key.  If an error occurs, execution
will terminate and the error will be reported.  !Interpret has no
equivalent of the BBC Basic interactive command mode.


Comments
--------

Blocks of source can be marked as comments, in which case the interpreter
completely ignores them.  These blocks can be embedded anywhere within
the source.  The delimiters are @* <comment> *@.

 @* This is a comment *@
 my_func(int i @* This comment won't be parsed *@)
 {
 }

Experienced C programmers will probably have noticed that these are not
the traditional comment delimiters.  Unfortunately this change was
necessary to avoid a more complex bug within the interpreter.  It is
anticipated that this problem will be fixed for the next release so
that we can return to the much loved /* ... */ syntax.


Functions
---------

Each source file must have at least one function - the approximate
equivalent of BBC Basic procedures and functions.  A function is
declared by specifying it's name and a parameter list.

 run_print(char *name, int record)
 {
 }

This syntax differs from regular C in the following ways:

   i You must not declare the function type
  ii Functions need not be predeclared

Item (i) comes about because an interpreted language need not know
in advance the type of data to be passed between functions.  If you
attempt to declare the function type the interpreter will assume
that you're declaring a variable, and will not run your code.

Item (ii) is brought about for similar reasons, the consequence being
that you can forward-reference functions without having to predeclare
prototypes.

Values are returned by functions in the same was as with regular C.

 run_print(char *name, int record)
 {
 record++;
 return record;
 }


Global & Local Variables
------------------------

Variables are declared in the same way as with regular C, either near
the top of the source (before any functions) for globals or at the top
of a function (before any expressions) for locals.  The following
types of variable are supported:

  - int     32-bit signed integer
  - int[n]  Array of int, with n elements
  - int *   Pointer to int
  - char    8-bit signed byte (ASCII conversion supported with 'x')
  - char[n] Array of char, with n elements (commonly used for strings)
  - char *  Pointer to char

Pointers to variables are processed in the same way as with regular C.
To indirect an expression, the * operator is used:

 char string[32];
 char c;

 *string = 0;     @* Sets first byte of the char array to NULL *@

 c = *(string+2); @* These are *@
 c = string[2];   @* analogous *@

To specify the address of an expression, the & operator is used:

 int i;

 scanf("%d",&i);  @* Store the value at the int pointed to by &i *@

!Interpret is not as fussy as regular C with regard type casting.  In
general the int type can be used to represent any 32 bit quantity and
the char type, any 8 bit quantity.  This is particularly true in the
context of library function calls, as explained later.


Expressions
-----------

!Interpret parses expressions in the same was as C.  As with compiled C,
function elements within an expression may be evaluated in any order
and may be nested to any practical depth.  The following numerical
operators are valid within an expression:

  ++   Auto increment (post or pre indexed)
  --   Auto decrement (post or pre indexed)
   +   Add
   -   Sub
   *   Multiply
   /   Divide
   %   Modulo

The following logical operators are valid within an expression:

  ==   Equality
  !=   Non equality
   <   Less than
   >   Greater than
  >=   Greater than or equal to
  <=   Less than or equal to
  &&   Logical AND
  ||   Logical OR
   !   Logical NOT

Expressions can be enclosed within parenthesis to define the order of
calculation.  For example, the following expression is valid:

 printf("The result is: %d",(i=get_int(++num_to_get%2)));


Construct Syntax
----------------

!Interpret implements the following regular C constructs:

  - if() {} else {}
  - for( ; ; ) {}
  - while() {}

The if() construct has the following format:

 if(condition)
   {
   ...
   }
 else
   {
   ...
   }

 If condition is true the first program block will execute, otherwise the
 second block will run.

The for(;;) construct has the following format:

 for(init_command; condition; loop_command)
   {
   ...
   }

 The init_command is executed once, then loop_command and the program
 block are executed repeatedly until condition is true.

The while() construct has the following format:

 while(condition)
   {
   ...
   }

 The program block will execute repeatedly until condition becomes false.

If the break command is executed within any of the program blocks for
the above constructs, execution will jump past the construct to the
next piece of code.  For example:

 while(!quit)
   {
   puts("Run until quit..");
   if(escape_pressed())
     break;
   }
 puts("..or until escape is pressed!");

If the return command is executed within any of the program blocks for
the above constructs, any nested structures will be unwound correctly
and execution will return to the calling function.  For example:

 main()
 {
 wait_for_key();
 }

 wait_for_key()
 {
 while(!time_out())
   {
   if(key_pressed())
     return;
   }
 }


Library Functions
-----------------

A number of useful functions are built into !Interpret.  You can call
these like any other function and, where valid, they will return values
like any other function.  Where necessary, the interpreter performs
type casting on your behalf.

It is beyond the scope of this manual to fully document the library,
however a brief summary of each function is provided below.

Function                                               Returns
--------------------------------------------------------------
bbc_vdu(int character)                                 none
bbc_vduw(int word)                                     none
bbc_stringprint(char *string_to_print)                 none
bbc_cls()                                              none
bbc_colour(int text_colour)                            none
bbc_tab(int x, int y)                                  none
bbc_plot(int plotcode, int x, int y)                   none
bbc_mode(int mode)                                     none
bbc_move(int x, int y)                                 none
bbc_moveby(int x, int y)                               none
bbc_draw(int x, int y)                                 none
bbc_drawby(int x, int y)                               none
bbc_rectangle(int x, int y, int h, int w)              none
bbc_rectanglefill(int x, int y, int h, int w)          none
bbc_circle(int x, int y, int r)                        none
bbc_circlefill(int x, int y, int r)                    none
bbc_origin(int x, int y)                               none
bbc_gwindow(int x0, y0, x1, y1)                        none
bbc_clg()                                              none
bbc_fill(int x, int y)                                 none
bbc_gcol(int plottype, int col)                        none
bbc_tint(int col, int tint)                            none
bbc_palette(int log, int phys, int r, int g, int b)    none
bbc_point(int x, int y)                                int colour
bbc_vduvars(int *in, int *out)                         none
bbc_modevar(int mode, int varno)                       int modevar
bbc_get()                                              int key
bbc_cursor(int curs_type)                              none
bbc_adval(int buffnum)                                 int val
bbc_getbeat()                                          int beat_val
bbc_getbeats()                                         int cycl_len
bbc_gettempo()                                         int beat_rate
bbc_inkey(int time_num)                                int key
bbc_setbeats(int cycl_len)                             none
bbc_settempo(int beat_rate)                            none
bbc_sound(int chan, int amp, int pitch, int dur)       none
bbc_soundoff()                                         none
bbc_soundon()                                          none
bbc_stereo(int chan, int pos)                          none
bbc_voices(int num_chan)                               none

isalnum(char character)                                int true_or_false
isalpha(char character)                                int true_or_false
iscntrl(char character)                                int true_or_false
isdigit(char character)                                int true_or_false
isgraph(char character)                                int true_or_false
islower(char character)                                int true_or_false
isprint(char character)                                int true_or_false
ispunct(char character)                                int true_or_false
isspace(char character)                                int true_or_false
isupper(char character)                                int true_or_false
isxdigit(char character)                               int true_or_false
tolower(char character)                                char character
toupper(char character)                                char character

remove(char *fname)                                    int success_flag
rename(char *old, char *new)                           int success_flag
tmpfile()                                              int file_handle
tmpname(char *result)                                  char fname
fclose(int file_handle)                                int success_flag
fflush(int file_handle)                                int EOF_flag
fopen(char *fname, char *mode)                         int file_handle
freopen(char *fname, char *mode, int file_handle)      int file_handle
setbuf(int file_handle, char *buf)                     none
setvbuf(int file_handle,char *buf, int mode,int size)  int success_flag
fprintf(int file_handle, char *format, ...)            int num_chars
printf(char *format, ...)                              int num_chars
sprintf(char *string, char *format, ...)               int num_chars
fscanf(int file_handle, char *format, ...)             int num_items
scanf(char *format, ...)                               int num_items
sscanf(char *string, char *format, ...)                int num_items
fgetc(int file_handle)                                 char character
fgets(char *buf, int buf_size, int file_handle)        char *string
fputc(char character, int file_handle)                 int EOF_flag
fputs(char *string, int file_handle)                   int EOF_flag
getc(int file_handle)                                  char character
getchar()                                              char character
gets(char *buf)                                        char *string
putc(char character, int file_handle)                  int EOF_flag
putchar(char character)                                int EOF_flag
puts(char *string)                                     int EOF_flag
ungetc(char character, int file_handle)                int EOF_flag
fread(int *ptr, int size, int num, int file_handle)    int num_read
fwrite(int *ptr, int size, int num, int file_handle)   int num_write
fgetpos(int file_handle, int *pos)                     int success_flag
fseek(int file_handle, int offset, int whence)         int success_flag
fsetpos(int file_handle, int *pos)                     int success_flag
ftell(int file_handle)                                 int file_pos
rewind(int file_handle)                                none
clearerr(int file_handle)                              none
feof(int file_handle)                                  int EOF_flag
ferror(int file_handle)                                int err_flag;
perror(char *string)                                   none

atoi(char *string)                                     int int_value
atol(char *string)                                     int int_value
rand()                                                 int rand_value
srand(int seed)                                        none
malloc(int size)                                       int *ptr
calloc(int num, int size)                              int *ptr
realloc(int *ptr, int size)                            int *ptr
free(int *ptr)                                         none
system(char *command)                                  int success_value
getenv(char *name)                                     char *result
abs(int num)                                           int result
clock()                                                int time

memset(int *ptr, char character, int size)             none
memchr(char *string, char character, int size)         int *ptr
memcmp(int *ptr1, int *ptr2, int size)                 int same_flag
memmove(int *ptr1, int *ptr2, int size)                int *ptr1
memcpy(int *ptr1, int *ptr2, int size)                 int *ptr1
strtok(char *string1, char *string2)                   char *result
strstr(char *string1, char *string2)                   char *result
strspn(char *string1, char *string2)                   int size
strchr(char *string, char character)                   char *result
strpbrk(char *string1, char *string2)                  char *result
strcspn(char *string1, char *string2)                  int size
strrchr(char *string, char character)                  char *result
strcfrm(char *string1, char *string2, int num)         int size
strcoll(char *string1, char *string2)                  int result
strncmp(char *string1, char *string2, int num)         int result
strcmp(char *string1, char *string2)                   int result
strncat(char *string1, char *string2, int num)         char *result
strcat(char *string1, char *string2)                   char *result
strncpy(char *string1, char *string2, int num)         char *result
strcpy(char *string1, char *string2)                   char *result

os_swi(int *regs[])                                    none

For detailed descriptions of these functions refer to the BBC Basic
Guide and any basic C tutorial guide.


Technical Support
-----------------

The Serial Port regret that they cannot provide technical support for
this freeware program.  The authors will be pleased to receive any
bug reports or comments via email, however, at the following address:

    bob@cryton.demon.co.uk
or  Bob Voisey (#9) on The World of Cryton BBS (2:252/102)
00000000  43 20 49 6e 74 65 72 70  72 65 74 65 72 20 a9 20  |C Interpreter . |
00000010  54 68 65 20 53 65 72 69  61 6c 20 50 6f 72 74 20  |The Serial Port |
00000020  31 39 39 33 0a 3d 2d 3d  2d 3d 2d 3d 2d 3d 2d 3d  |1993.=-=-=-=-=-=|
00000030  2d 3d 2d 3d 2d 3d 2d 3d  2d 3d 2d 3d 2d 3d 2d 3d  |-=-=-=-=-=-=-=-=|
00000040  2d 3d 2d 3d 2d 3d 2d 3d  2d 0a 0a 42 79 20 4e 69  |-=-=-=-=-..By Ni|
00000050  67 65 6c 20 42 72 6f 77  6e 20 26 20 42 6f 62 20  |gel Brown & Bob |
00000060  56 6f 69 73 65 79 0a 56  65 72 73 69 6f 6e 20 30  |Voisey.Version 0|
00000070  2e 39 30 67 0a 0a 4f 76  65 72 76 69 65 77 0a 2d  |.90g..Overview.-|
00000080  2d 2d 2d 2d 2d 2d 2d 0a  0a 21 49 6e 74 65 72 70  |-------..!Interp|
00000090  72 65 74 20 69 6d 70 6c  65 6d 65 6e 74 73 20 61  |ret implements a|
000000a0  20 73 75 62 73 65 74 20  6f 66 20 74 68 65 20 43  | subset of the C|
000000b0  20 70 72 6f 67 72 61 6d  6d 69 6e 67 20 6c 61 6e  | programming lan|
000000c0  67 75 61 67 65 2e 20 20  55 6e 6c 69 6b 65 0a 74  |guage.  Unlike.t|
000000d0  72 61 64 69 74 69 6f 6e  61 6c 20 43 20 63 6f 6d  |raditional C com|
000000e0  70 69 6c 65 72 73 2c 20  68 6f 77 65 76 65 72 2c  |pilers, however,|
000000f0  20 74 68 69 73 20 70 72  6f 67 72 61 6d 20 69 6e  | this program in|
00000100  74 65 72 70 72 65 74 73  20 74 68 65 20 73 6f 75  |terprets the sou|
00000110  72 63 65 0a 70 72 6f 67  72 61 6d 73 20 77 69 74  |rce.programs wit|
00000120  68 6f 75 74 20 75 6e 64  65 72 67 6f 69 6e 67 20  |hout undergoing |
00000130  61 6e 20 69 6e 74 65 72  6d 65 64 69 61 74 65 20  |an intermediate |
00000140  63 6f 6d 70 69 6c 61 74  69 6f 6e 20 73 74 61 67  |compilation stag|
00000150  65 2e 0a 0a 49 6e 69 74  69 61 6c 6c 79 20 64 65  |e...Initially de|
00000160  76 65 6c 6f 70 65 64 20  66 6f 72 20 75 73 65 20  |veloped for use |
00000170  61 73 20 61 20 73 63 72  69 70 74 20 6c 61 6e 67  |as a script lang|
00000180  75 61 67 65 20 77 69 74  68 69 6e 20 6f 75 72 20  |uage within our |
00000190  73 6f 66 74 77 61 72 65  0a 70 72 6f 64 75 63 74  |software.product|
000001a0  73 20 28 41 72 63 74 65  72 6d 2c 20 41 72 63 42  |s (Arcterm, ArcB|
000001b0  42 53 20 26 20 53 6f 75  72 63 65 72 65 72 29 2c  |BS & Sourcerer),|
000001c0  20 21 49 6e 74 65 72 70  72 65 74 20 68 61 73 20  | !Interpret has |
000001d0  6e 6f 77 20 62 65 65 6e  0a 72 65 6c 65 61 73 65  |now been.release|
000001e0  64 20 61 73 20 61 20 73  74 61 6e 64 20 61 6c 6f  |d as a stand alo|
000001f0  6e 65 20 69 6e 74 65 72  70 72 65 74 65 72 20 69  |ne interpreter i|
00000200  6e 20 74 68 65 20 68 6f  70 65 20 74 68 61 74 20  |n the hope that |
00000210  73 6f 6d 65 62 6f 64 79  20 6d 69 67 68 74 0a 66  |somebody might.f|
00000220  69 6e 64 20 69 74 20 75  73 65 66 75 6c 2e 0a 0a  |ind it useful...|
00000230  49 6e 74 65 72 70 72 65  74 65 72 73 20 68 61 76  |Interpreters hav|
00000240  65 20 73 6f 6d 65 20 61  64 76 61 6e 74 61 67 65  |e some advantage|
00000250  73 20 6f 76 65 72 20 63  6f 6d 70 69 6c 65 72 73  |s over compilers|
00000260  3a 2e 2e 0a 0a 20 20 2d  20 45 61 73 79 20 74 6f  |:....  - Easy to|
00000270  20 75 73 65 3b 20 6e 6f  20 6e 65 65 64 20 74 6f  | use; no need to|
00000280  20 77 6f 72 72 79 20 61  62 6f 75 74 20 63 6f 6d  | worry about com|
00000290  70 6c 65 78 20 63 6c 69  20 73 77 69 74 63 68 65  |plex cli switche|
000002a0  73 0a 20 20 2d 20 46 61  73 74 20 64 65 62 75 67  |s.  - Fast debug|
000002b0  67 69 6e 67 3b 20 74 68  65 20 6c 65 6e 67 74 68  |ging; the length|
000002c0  79 20 63 6f 6d 70 69 6c  61 74 69 6f 6e 20 73 74  |y compilation st|
000002d0  65 70 20 69 73 20 65 6c  69 6d 69 6e 61 74 65 64  |ep is eliminated|
000002e0  0a 20 20 2d 20 43 6f 6d  70 61 63 74 20 6f 6e 20  |.  - Compact on |
000002f0  64 69 73 6b 3b 20 6e 6f  20 69 6e 74 65 72 6d 65  |disk; no interme|
00000300  64 69 61 74 65 20 6f 62  6a 65 63 74 20 66 69 6c  |diate object fil|
00000310  65 73 20 61 72 65 20 63  72 65 61 74 65 64 0a 0a  |es are created..|
00000320  2e 2e 74 68 65 79 20 61  6c 73 6f 20 68 61 76 65  |..they also have|
00000330  20 73 6f 6d 65 20 64 69  73 61 64 76 61 6e 74 61  | some disadvanta|
00000340  67 65 73 3a 0a 0a 20 20  2d 20 53 6c 6f 77 20 65  |ges:..  - Slow e|
00000350  78 65 63 75 74 69 6f 6e  3b 20 69 6e 74 65 72 70  |xecution; interp|
00000360  72 65 74 65 72 73 20 61  72 65 20 6d 75 63 68 20  |reters are much |
00000370  73 6c 6f 77 65 72 20 74  68 61 6e 20 63 6f 6d 70  |slower than comp|
00000380  69 6c 65 64 20 63 6f 64  65 0a 20 20 2d 20 50 6f  |iled code.  - Po|
00000390  6f 72 20 6d 61 6e 61 67  65 6d 65 6e 74 3b 20 69  |or management; i|
000003a0  74 20 63 61 6e 20 62 65  20 68 61 72 64 65 72 20  |t can be harder |
000003b0  74 6f 20 6b 65 65 70 20  79 6f 75 72 20 73 6f 75  |to keep your sou|
000003c0  72 63 65 73 20 6f 72 67  61 6e 69 73 65 64 0a 0a  |rces organised..|
000003d0  42 65 63 61 75 73 65 20  74 68 65 20 43 20 70 72  |Because the C pr|
000003e0  6f 67 72 61 6d 6d 69 6e  67 20 6c 61 6e 67 75 61  |ogramming langua|
000003f0  67 65 20 77 61 73 20 64  65 73 69 67 6e 65 64 20  |ge was designed |
00000400  66 6f 72 20 75 73 65 20  77 69 74 68 20 61 0a 63  |for use with a.c|
00000410  6f 6d 70 69 6c 65 72 2c  20 74 68 65 20 73 79 6e  |ompiler, the syn|
00000420  74 61 78 20 64 6f 65 73  20 6e 6f 74 20 6c 65 6e  |tax does not len|
00000430  64 20 69 74 73 65 6c 66  20 74 6f 20 69 6e 74 65  |d itself to inte|
00000440  72 70 72 65 74 61 74 69  6f 6e 20 73 6f 20 72 65  |rpretation so re|
00000450  61 64 69 6c 79 0a 61 73  20 74 68 61 74 20 6f 66  |adily.as that of|
00000460  20 6c 61 6e 67 75 61 67  65 73 20 73 75 63 68 20  | languages such |
00000470  61 73 20 42 41 53 49 43  2e 20 20 41 73 20 61 20  |as BASIC.  As a |
00000480  72 65 73 75 6c 74 20 69  6e 74 65 72 70 72 65 74  |result interpret|
00000490  65 64 20 43 20 64 6f 65  73 0a 6e 6f 74 20 67 65  |ed C does.not ge|
000004a0  6e 65 72 61 6c 6c 79 20  72 75 6e 20 61 73 20 71  |nerally run as q|
000004b0  75 69 63 6b 6c 79 20 61  73 2c 20 66 6f 72 20 65  |uickly as, for e|
000004c0  78 61 6d 70 6c 65 2c 20  42 42 43 20 42 61 73 69  |xample, BBC Basi|
000004d0  63 2e 20 20 44 65 73 70  69 74 65 0a 74 68 69 73  |c.  Despite.this|
000004e0  20 6d 61 6e 79 20 70 72  6f 67 72 61 6d 6d 65 72  | many programmer|
000004f0  73 20 6d 61 79 20 70 72  65 66 65 72 20 74 6f 20  |s may prefer to |
00000500  63 6f 64 65 20 69 6e 20  74 68 65 20 65 6c 65 67  |code in the eleg|
00000510  61 6e 74 20 73 79 6e 74  61 78 20 6f 66 20 43 2e  |ant syntax of C.|
00000520  0a 0a 0a 41 62 6f 75 74  20 74 68 69 73 20 6d 61  |...About this ma|
00000530  6e 75 61 6c 0a 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |nual.-----------|
00000540  2d 2d 2d 2d 2d 2d 0a 0a  54 68 69 73 20 64 6f 63  |------..This doc|
00000550  75 6d 65 6e 74 20 69 73  20 6e 6f 74 20 61 20 43  |ument is not a C|
00000560  20 74 75 74 6f 72 69 61  6c 20 67 75 69 64 65 2e  | tutorial guide.|
00000570  20 20 52 61 74 68 65 72  2c 20 69 74 73 20 70 75  |  Rather, its pu|
00000580  72 70 6f 73 65 20 69 73  20 74 6f 0a 64 65 66 69  |rpose is to.defi|
00000590  6e 65 20 74 68 65 20 73  75 62 73 65 74 20 6f 66  |ne the subset of|
000005a0  20 43 20 69 6d 70 6c 65  6d 65 6e 74 65 64 20 62  | C implemented b|
000005b0  79 20 74 68 65 20 69 6e  74 65 72 70 72 65 74 65  |y the interprete|
000005c0  72 2c 20 61 6e 64 20 74  6f 20 6f 75 74 6c 69 6e  |r, and to outlin|
000005d0  65 0a 74 68 65 20 64 69  66 66 65 72 65 6e 63 65  |e.the difference|
000005e0  73 20 62 65 74 77 65 65  6e 20 74 68 61 74 20 61  |s between that a|
000005f0  6e 64 20 72 65 67 75 6c  61 72 20 43 2e 20 20 49  |nd regular C.  I|
00000600  66 20 79 6f 75 20 68 61  76 65 20 6e 6f 74 20 65  |f you have not e|
00000610  6e 63 6f 75 6e 74 65 72  65 64 0a 74 68 65 20 43  |ncountered.the C|
00000620  20 70 72 6f 67 72 61 6d  6d 69 6e 67 20 6c 61 6e  | programming lan|
00000630  67 75 61 67 65 20 62 65  66 6f 72 65 2c 20 21 49  |guage before, !I|
00000640  6e 74 65 72 70 72 65 74  20 6d 69 67 68 74 20 62  |nterpret might b|
00000650  65 20 61 20 67 6f 6f 64  20 70 72 6f 67 72 61 6d  |e a good program|
00000660  0a 77 69 74 68 20 77 68  69 63 68 20 74 6f 20 73  |.with which to s|
00000670  74 61 72 74 20 2d 20 68  6f 77 65 76 65 72 20 79  |tart - however y|
00000680  6f 75 20 57 49 4c 4c 20  6e 65 65 64 20 61 20 70  |ou WILL need a p|
00000690  72 6f 67 72 61 6d 6d 69  6e 67 20 67 75 69 64 65  |rogramming guide|
000006a0  20 74 6f 0a 66 75 6c 6c  79 20 75 6e 64 65 72 73  | to.fully unders|
000006b0  74 61 6e 64 20 73 6f 6d  65 20 6f 66 20 74 68 65  |tand some of the|
000006c0  20 66 61 63 69 6c 69 74  69 65 73 2e 0a 0a 49 6e  | facilities...In|
000006d0  66 6f 72 6d 61 74 69 6f  6e 20 77 69 74 68 69 6e  |formation within|
000006e0  20 74 68 69 73 20 6d 61  6e 75 61 6c 20 69 73 20  | this manual is |
000006f0  67 69 76 65 6e 20 69 6e  20 67 6f 6f 64 20 66 61  |given in good fa|
00000700  69 74 68 2c 20 68 6f 77  65 76 65 72 20 54 68 65  |ith, however The|
00000710  20 53 65 72 69 61 6c 0a  50 6f 72 74 20 63 61 6e  | Serial.Port can|
00000720  6e 6f 74 20 67 75 61 72  61 6e 74 65 65 20 69 74  |not guarantee it|
00000730  27 73 20 61 63 63 75 72  61 63 79 2c 20 6e 6f 72  |'s accuracy, nor|
00000740  20 74 68 65 20 73 75 69  74 61 62 69 6c 69 74 79  | the suitability|
00000750  20 6f 66 20 21 49 6e 74  65 72 70 72 65 74 0a 66  | of !Interpret.f|
00000760  6f 72 20 61 6e 79 20 70  61 72 74 69 63 75 6c 61  |or any particula|
00000770  72 20 74 61 73 6b 2e 0a  0a 0a 54 68 65 20 45 78  |r task....The Ex|
00000780  61 6d 70 6c 65 73 20 64  69 72 65 63 74 6f 72 79  |amples directory|
00000790  0a 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
000007a0  2d 2d 2d 2d 2d 2d 2d 0a  0a 41 6c 6f 6e 67 20 77  |-------..Along w|
000007b0  69 74 68 20 21 49 6e 74  65 72 70 72 65 74 20 79  |ith !Interpret y|
000007c0  6f 75 20 77 69 6c 6c 20  66 69 6e 64 20 61 6e 20  |ou will find an |
000007d0  45 78 61 6d 70 6c 65 73  20 64 69 72 65 63 74 6f  |Examples directo|
000007e0  72 79 2e 20 20 43 6f 6e  74 61 69 6e 65 64 0a 77  |ry.  Contained.w|
000007f0  69 74 68 69 6e 20 61 72  65 20 61 20 6e 75 6d 62  |ithin are a numb|
00000800  65 72 20 6f 66 20 73 6f  75 72 63 65 73 20 73 70  |er of sources sp|
00000810  65 63 69 66 69 63 61 6c  6c 79 20 64 65 73 69 67  |ecifically desig|
00000820  6e 65 64 20 74 6f 20 64  65 6d 6f 6e 73 74 72 61  |ned to demonstra|
00000830  74 65 0a 74 68 65 20 66  61 63 69 6c 69 74 69 65  |te.the facilitie|
00000840  73 20 70 72 6f 76 69 64  65 64 20 62 79 20 74 68  |s provided by th|
00000850  65 20 69 6e 74 65 72 70  72 65 74 65 72 2e 20 20  |e interpreter.  |
00000860  46 69 72 73 74 20 74 69  6d 65 20 43 20 70 72 6f  |First time C pro|
00000870  67 72 61 6d 6d 65 72 73  0a 6d 61 79 20 66 69 6e  |grammers.may fin|
00000880  64 20 74 68 65 73 65 20  66 69 6c 65 73 20 75 73  |d these files us|
00000890  65 66 75 6c 2c 20 73 69  6e 63 65 20 74 68 65 6f  |eful, since theo|
000008a0  72 65 74 69 63 61 6c 20  43 20 61 6e 64 20 70 72  |retical C and pr|
000008b0  61 63 74 69 63 61 6c 20  43 0a 73 6f 75 72 63 65  |actical C.source|
000008c0  73 20 61 72 65 20 73 6f  6d 65 74 69 6d 65 73 20  |s are sometimes |
000008d0  61 74 20 76 61 72 69 61  6e 63 65 2e 0a 0a 0a 52  |at variance....R|
000008e0  65 73 74 72 69 63 74 69  6f 6e 73 20 6f 66 20 21  |estrictions of !|
000008f0  49 6e 74 65 72 70 72 65  74 0a 2d 2d 2d 2d 2d 2d  |Interpret.------|
00000900  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000910  2d 2d 2d 2d 0a 0a 54 68  65 79 20 73 61 79 20 79  |----..They say y|
00000920  6f 75 20 6e 65 76 65 72  20 67 65 74 20 73 6f 6d  |ou never get som|
00000930  65 74 68 69 6e 67 20 66  6f 72 20 6e 6f 74 68 69  |ething for nothi|
00000940  6e 67 2e 20 20 49 6e 20  74 68 69 73 20 63 61 73  |ng.  In this cas|
00000950  65 20 79 6f 75 20 5f 64  6f 5f 0a 67 65 74 20 71  |e you _do_.get q|
00000960  75 69 74 65 20 61 20 6c  6f 74 20 6f 66 20 43 2c  |uite a lot of C,|
00000970  20 62 75 74 20 63 65 72  74 61 69 6e 6c 79 20 6e  | but certainly n|
00000980  6f 74 20 61 6e 20 65 6e  74 69 72 65 20 69 6d 70  |ot an entire imp|
00000990  6c 65 6d 65 6e 74 61 74  69 6f 6e 2e 0a 53 70 65  |lementation..Spe|
000009a0  63 69 66 69 63 61 6c 6c  79 2c 20 21 49 6e 74 65  |cifically, !Inte|
000009b0  72 70 72 65 74 20 64 6f  65 73 20 6e 6f 74 20 73  |rpret does not s|
000009c0  75 70 70 6f 72 74 3a 0a  0a 20 20 2d 20 53 74 72  |upport:..  - Str|
000009d0  75 63 74 75 72 65 73 20  28 69 65 20 73 74 72 75  |uctures (ie stru|
000009e0  63 74 20 7b 7d 20 74 79  70 65 73 29 0a 20 20 2d  |ct {} types).  -|
000009f0  20 54 79 70 65 64 65 66  73 20 28 75 73 65 72 20  | Typedefs (user |
00000a00  64 65 66 69 6e 61 62 6c  65 20 74 79 70 65 73 29  |definable types)|
00000a10  0a 20 20 2d 20 45 6e 75  6d 65 72 61 74 65 64 20  |.  - Enumerated |
00000a20  76 61 72 69 61 62 6c 65  73 20 28 69 65 20 65 6e  |variables (ie en|
00000a30  75 6d 20 7b 7d 20 74 79  70 65 73 29 0a 20 20 2d  |um {} types).  -|
00000a40  20 46 6c 6f 61 74 69 6e  67 20 70 6f 69 6e 74 20  | Floating point |
00000a50  28 69 65 20 6c 6f 6e 67  2c 20 64 6f 75 62 6c 65  |(ie long, double|
00000a60  20 65 74 63 29 0a 20 20  2d 20 4d 69 73 63 65 6c  | etc).  - Miscel|
00000a70  6c 61 6e 65 6f 75 73 20  63 6f 6e 73 74 72 75 63  |laneous construc|
00000a80  74 73 20 28 6e 6f 74 61  62 6c 79 20 64 6f 20 61  |ts (notably do a|
00000a90  6e 64 20 73 77 69 74 63  68 29 0a 20 20 2d 20 4d  |nd switch).  - M|
00000aa0  75 6c 74 69 70 6c 65 20  73 6f 75 72 63 65 20 66  |ultiple source f|
00000ab0  69 6c 65 73 20 28 69 6e  63 6c 75 64 69 6e 67 20  |iles (including |
00000ac0  23 69 6e 63 6c 75 64 65  20 64 69 72 65 63 74 69  |#include directi|
00000ad0  76 65 73 29 0a 0a 46 75  72 74 68 65 72 6d 6f 72  |ves)..Furthermor|
00000ae0  65 2c 20 21 49 6e 74 65  72 70 72 65 74 20 68 61  |e, !Interpret ha|
00000af0  6e 64 6c 65 73 20 73 6f  6d 65 20 43 20 73 79 6e  |ndles some C syn|
00000b00  74 61 78 20 69 6e 20 61  20 73 6c 69 67 68 74 6c  |tax in a slightl|
00000b10  79 20 64 69 66 66 65 72  65 6e 74 0a 77 61 79 20  |y different.way |
00000b20  74 6f 20 72 65 67 75 6c  61 72 20 43 2e 20 20 54  |to regular C.  T|
00000b30  68 65 73 65 20 64 69 66  66 65 72 65 6e 63 65 73  |hese differences|
00000b40  20 77 69 6c 6c 20 62 65  20 64 69 73 63 75 73 73  | will be discuss|
00000b50  65 64 20 69 6e 20 74 68  65 20 61 70 70 72 6f 70  |ed in the approp|
00000b60  72 69 61 74 65 0a 73 65  63 74 69 6f 6e 73 20 6f  |riate.sections o|
00000b70  66 20 74 68 69 73 20 6d  61 6e 75 61 6c 2e 0a 0a  |f this manual...|
00000b80  41 6c 74 68 6f 75 67 68  20 74 68 65 20 61 62 6f  |Although the abo|
00000b90  76 65 20 6c 69 6d 69 74  61 74 69 6f 6e 73 20 61  |ve limitations a|
00000ba0  72 65 20 72 61 74 68 65  72 20 64 65 70 72 65 73  |re rather depres|
00000bb0  73 69 6e 67 20 6e 65 77  73 20 66 6f 72 20 65 78  |sing news for ex|
00000bc0  70 65 72 69 65 6e 63 65  64 0a 43 20 63 6f 64 65  |perienced.C code|
00000bd0  72 73 2c 20 74 68 65 20  67 72 65 61 74 65 72 20  |rs, the greater |
00000be0  70 61 72 74 20 6f 66 20  74 68 65 20 6c 61 6e 67  |part of the lang|
00000bf0  75 61 67 65 20 64 65 66  69 6e 69 74 69 6f 6e 20  |uage definition |
00000c00  69 73 20 69 6d 70 6c 65  6d 65 6e 74 65 64 20 61  |is implemented a|
00000c10  6e 64 0a 65 78 70 72 65  73 73 69 6f 6e 73 20 61  |nd.expressions a|
00000c20  72 65 20 65 76 61 6c 75  61 74 65 64 20 69 6e 20  |re evaluated in |
00000c30  6a 75 73 74 20 74 68 65  20 73 61 6d 65 20 77 61  |just the same wa|
00000c40  79 20 61 73 20 69 6e 20  72 65 67 75 6c 61 72 20  |y as in regular |
00000c50  43 20 28 77 69 74 68 20  61 0a 72 65 63 75 72 73  |C (with a.recurs|
00000c60  69 76 65 20 64 65 73 63  65 6e 74 20 70 61 72 73  |ive descent pars|
00000c70  65 72 29 2e 0a 0a 0a 52  75 6e 6e 69 6e 67 20 21  |er)....Running !|
00000c80  49 6e 74 65 72 70 72 65  74 0a 2d 2d 2d 2d 2d 2d  |Interpret.------|
00000c90  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 0a 54 68  |------------..Th|
00000ca0  65 72 65 20 61 72 65 20  74 77 6f 20 77 61 79 73  |ere are two ways|
00000cb0  20 74 6f 20 72 75 6e 20  21 49 6e 74 65 72 70 72  | to run !Interpr|
00000cc0  65 74 3a 0a 0a 20 31 2e  20 20 44 6f 75 62 6c 65  |et:.. 1.  Double|
00000cd0  20 63 6c 69 63 6b 20 74  68 65 20 61 70 70 6c 69  | click the appli|
00000ce0  63 61 74 69 6f 6e 2c 20  77 68 65 72 65 75 70 6f  |cation, whereupo|
00000cf0  6e 20 79 6f 75 20 77 69  6c 6c 20 62 65 20 70 72  |n you will be pr|
00000d00  6f 6d 70 74 65 64 20 74  6f 0a 20 20 20 20 20 65  |ompted to.     e|
00000d10  6e 74 65 72 20 74 68 65  20 6e 61 6d 65 20 6f 66  |nter the name of|
00000d20  20 74 68 65 20 73 6f 75  72 63 65 20 66 69 6c 65  | the source file|
00000d30  20 74 6f 20 62 65 20 69  6e 74 65 72 70 72 65 74  | to be interpret|
00000d40  65 64 2e 20 20 49 66 20  74 68 65 20 66 69 6c 65  |ed.  If the file|
00000d50  0a 20 20 20 20 20 69 73  20 6e 6f 74 20 69 6e 20  |.     is not in |
00000d60  74 68 65 20 63 75 72 72  65 6e 74 20 64 69 72 65  |the current dire|
00000d70  63 74 6f 72 79 20 79 6f  75 20 77 69 6c 6c 20 6e  |ctory you will n|
00000d80  65 65 64 20 74 6f 20 73  70 65 63 69 66 79 20 61  |eed to specify a|
00000d90  20 66 75 6c 6c 0a 20 20  20 20 20 66 69 6c 65 20  | full.     file |
00000da0  70 61 74 68 2e 20 20 54  6f 20 61 73 73 69 73 74  |path.  To assist|
00000db0  20 79 6f 75 2c 20 61 6e  20 4f 62 65 79 20 66 69  | you, an Obey fi|
00000dc0  6c 65 20 63 61 6c 6c 65  64 20 21 48 65 72 65 20  |le called !Here |
00000dd0  69 73 20 69 6e 63 6c 75  64 65 64 0a 20 20 20 20  |is included.    |
00000de0  20 69 6e 20 74 68 65 20  45 78 61 6d 70 6c 65 73  | in the Examples|
00000df0  20 64 69 72 65 63 74 6f  72 79 20 74 6f 20 63 68  | directory to ch|
00000e00  61 6e 67 65 20 74 68 65  20 63 75 72 72 65 6e 74  |ange the current|
00000e10  20 64 69 72 65 63 74 6f  72 79 20 74 6f 0a 20 20  | directory to.  |
00000e20  20 20 20 74 68 61 74 20  6c 6f 63 61 74 69 6f 6e  |   that location|
00000e30  2e 0a 0a 20 32 2e 20 20  52 75 6e 20 21 49 6e 74  |... 2.  Run !Int|
00000e40  65 72 70 72 65 74 20 62  79 20 68 61 6e 64 2c 20  |erpret by hand, |
00000e50  66 72 6f 6d 20 74 68 65  20 63 6c 69 20 6f 72 20  |from the cli or |
00000e60  66 72 6f 6d 20 61 6e 20  4f 62 65 79 20 66 69 6c  |from an Obey fil|
00000e70  65 2e 0a 20 20 20 20 20  53 79 6e 74 61 78 3a 20  |e..     Syntax: |
00000e80  21 49 6e 74 65 72 70 72  65 74 20 3c 53 6f 75 72  |!Interpret <Sour|
00000e90  63 65 20 66 69 6c 65 6e  61 6d 65 3e 0a 20 20 20  |ce filename>.   |
00000ea0  20 20 20 20 20 20 45 67  3a 20 21 49 6e 74 65 72  |      Eg: !Inter|
00000eb0  70 72 65 74 20 45 78 61  6d 70 6c 65 73 2e 4d 79  |pret Examples.My|
00000ec0  53 6f 75 72 63 65 0a 0a  4f 6e 63 65 20 61 20 73  |Source..Once a s|
00000ed0  6f 75 72 63 65 20 66 69  6c 65 20 68 61 73 20 62  |ource file has b|
00000ee0  65 65 6e 20 6c 6f 61 64  65 64 2c 20 65 78 65 63  |een loaded, exec|
00000ef0  75 74 69 6f 6e 20 77 69  6c 6c 20 63 6f 6d 6d 65  |ution will comme|
00000f00  6e 63 65 20 69 6d 6d 65  64 69 61 74 65 6c 79 2e  |nce immediately.|
00000f10  0a 54 6f 20 61 62 6f 72  74 20 65 78 65 63 75 74  |.To abort execut|
00000f20  69 6f 6e 2c 20 68 69 74  20 74 68 65 20 45 73 63  |ion, hit the Esc|
00000f30  61 70 65 20 6b 65 79 2e  20 20 49 66 20 61 6e 20  |ape key.  If an |
00000f40  65 72 72 6f 72 20 6f 63  63 75 72 73 2c 20 65 78  |error occurs, ex|
00000f50  65 63 75 74 69 6f 6e 0a  77 69 6c 6c 20 74 65 72  |ecution.will ter|
00000f60  6d 69 6e 61 74 65 20 61  6e 64 20 74 68 65 20 65  |minate and the e|
00000f70  72 72 6f 72 20 77 69 6c  6c 20 62 65 20 72 65 70  |rror will be rep|
00000f80  6f 72 74 65 64 2e 20 20  21 49 6e 74 65 72 70 72  |orted.  !Interpr|
00000f90  65 74 20 68 61 73 20 6e  6f 0a 65 71 75 69 76 61  |et has no.equiva|
00000fa0  6c 65 6e 74 20 6f 66 20  74 68 65 20 42 42 43 20  |lent of the BBC |
00000fb0  42 61 73 69 63 20 69 6e  74 65 72 61 63 74 69 76  |Basic interactiv|
00000fc0  65 20 63 6f 6d 6d 61 6e  64 20 6d 6f 64 65 2e 0a  |e command mode..|
00000fd0  0a 0a 43 6f 6d 6d 65 6e  74 73 0a 2d 2d 2d 2d 2d  |..Comments.-----|
00000fe0  2d 2d 2d 0a 0a 42 6c 6f  63 6b 73 20 6f 66 20 73  |---..Blocks of s|
00000ff0  6f 75 72 63 65 20 63 61  6e 20 62 65 20 6d 61 72  |ource can be mar|
00001000  6b 65 64 20 61 73 20 63  6f 6d 6d 65 6e 74 73 2c  |ked as comments,|
00001010  20 69 6e 20 77 68 69 63  68 20 63 61 73 65 20 74  | in which case t|
00001020  68 65 20 69 6e 74 65 72  70 72 65 74 65 72 0a 63  |he interpreter.c|
00001030  6f 6d 70 6c 65 74 65 6c  79 20 69 67 6e 6f 72 65  |ompletely ignore|
00001040  73 20 74 68 65 6d 2e 20  20 54 68 65 73 65 20 62  |s them.  These b|
00001050  6c 6f 63 6b 73 20 63 61  6e 20 62 65 20 65 6d 62  |locks can be emb|
00001060  65 64 64 65 64 20 61 6e  79 77 68 65 72 65 20 77  |edded anywhere w|
00001070  69 74 68 69 6e 0a 74 68  65 20 73 6f 75 72 63 65  |ithin.the source|
00001080  2e 20 20 54 68 65 20 64  65 6c 69 6d 69 74 65 72  |.  The delimiter|
00001090  73 20 61 72 65 20 40 2a  20 3c 63 6f 6d 6d 65 6e  |s are @* <commen|
000010a0  74 3e 20 2a 40 2e 0a 0a  20 40 2a 20 54 68 69 73  |t> *@... @* This|
000010b0  20 69 73 20 61 20 63 6f  6d 6d 65 6e 74 20 2a 40  | is a comment *@|
000010c0  0a 20 6d 79 5f 66 75 6e  63 28 69 6e 74 20 69 20  |. my_func(int i |
000010d0  40 2a 20 54 68 69 73 20  63 6f 6d 6d 65 6e 74 20  |@* This comment |
000010e0  77 6f 6e 27 74 20 62 65  20 70 61 72 73 65 64 20  |won't be parsed |
000010f0  2a 40 29 0a 20 7b 0a 20  7d 0a 0a 45 78 70 65 72  |*@). {. }..Exper|
00001100  69 65 6e 63 65 64 20 43  20 70 72 6f 67 72 61 6d  |ienced C program|
00001110  6d 65 72 73 20 77 69 6c  6c 20 70 72 6f 62 61 62  |mers will probab|
00001120  6c 79 20 68 61 76 65 20  6e 6f 74 69 63 65 64 20  |ly have noticed |
00001130  74 68 61 74 20 74 68 65  73 65 20 61 72 65 20 6e  |that these are n|
00001140  6f 74 0a 74 68 65 20 74  72 61 64 69 74 69 6f 6e  |ot.the tradition|
00001150  61 6c 20 63 6f 6d 6d 65  6e 74 20 64 65 6c 69 6d  |al comment delim|
00001160  69 74 65 72 73 2e 20 20  55 6e 66 6f 72 74 75 6e  |iters.  Unfortun|
00001170  61 74 65 6c 79 20 74 68  69 73 20 63 68 61 6e 67  |ately this chang|
00001180  65 20 77 61 73 0a 6e 65  63 65 73 73 61 72 79 20  |e was.necessary |
00001190  74 6f 20 61 76 6f 69 64  20 61 20 6d 6f 72 65 20  |to avoid a more |
000011a0  63 6f 6d 70 6c 65 78 20  62 75 67 20 77 69 74 68  |complex bug with|
000011b0  69 6e 20 74 68 65 20 69  6e 74 65 72 70 72 65 74  |in the interpret|
000011c0  65 72 2e 20 20 49 74 20  69 73 0a 61 6e 74 69 63  |er.  It is.antic|
000011d0  69 70 61 74 65 64 20 74  68 61 74 20 74 68 69 73  |ipated that this|
000011e0  20 70 72 6f 62 6c 65 6d  20 77 69 6c 6c 20 62 65  | problem will be|
000011f0  20 66 69 78 65 64 20 66  6f 72 20 74 68 65 20 6e  | fixed for the n|
00001200  65 78 74 20 72 65 6c 65  61 73 65 20 73 6f 0a 74  |ext release so.t|
00001210  68 61 74 20 77 65 20 63  61 6e 20 72 65 74 75 72  |hat we can retur|
00001220  6e 20 74 6f 20 74 68 65  20 6d 75 63 68 20 6c 6f  |n to the much lo|
00001230  76 65 64 20 2f 2a 20 2e  2e 2e 20 2a 2f 20 73 79  |ved /* ... */ sy|
00001240  6e 74 61 78 2e 0a 0a 0a  46 75 6e 63 74 69 6f 6e  |ntax....Function|
00001250  73 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 45 61 63  |s.---------..Eac|
00001260  68 20 73 6f 75 72 63 65  20 66 69 6c 65 20 6d 75  |h source file mu|
00001270  73 74 20 68 61 76 65 20  61 74 20 6c 65 61 73 74  |st have at least|
00001280  20 6f 6e 65 20 66 75 6e  63 74 69 6f 6e 20 2d 20  | one function - |
00001290  74 68 65 20 61 70 70 72  6f 78 69 6d 61 74 65 0a  |the approximate.|
000012a0  65 71 75 69 76 61 6c 65  6e 74 20 6f 66 20 42 42  |equivalent of BB|
000012b0  43 20 42 61 73 69 63 20  70 72 6f 63 65 64 75 72  |C Basic procedur|
000012c0  65 73 20 61 6e 64 20 66  75 6e 63 74 69 6f 6e 73  |es and functions|
000012d0  2e 20 20 41 20 66 75 6e  63 74 69 6f 6e 20 69 73  |.  A function is|
000012e0  0a 64 65 63 6c 61 72 65  64 20 62 79 20 73 70 65  |.declared by spe|
000012f0  63 69 66 79 69 6e 67 20  69 74 27 73 20 6e 61 6d  |cifying it's nam|
00001300  65 20 61 6e 64 20 61 20  70 61 72 61 6d 65 74 65  |e and a paramete|
00001310  72 20 6c 69 73 74 2e 0a  0a 20 72 75 6e 5f 70 72  |r list... run_pr|
00001320  69 6e 74 28 63 68 61 72  20 2a 6e 61 6d 65 2c 20  |int(char *name, |
00001330  69 6e 74 20 72 65 63 6f  72 64 29 0a 20 7b 0a 20  |int record). {. |
00001340  7d 0a 0a 54 68 69 73 20  73 79 6e 74 61 78 20 64  |}..This syntax d|
00001350  69 66 66 65 72 73 20 66  72 6f 6d 20 72 65 67 75  |iffers from regu|
00001360  6c 61 72 20 43 20 69 6e  20 74 68 65 20 66 6f 6c  |lar C in the fol|
00001370  6c 6f 77 69 6e 67 20 77  61 79 73 3a 0a 0a 20 20  |lowing ways:..  |
00001380  20 69 20 59 6f 75 20 6d  75 73 74 20 6e 6f 74 20  | i You must not |
00001390  64 65 63 6c 61 72 65 20  74 68 65 20 66 75 6e 63  |declare the func|
000013a0  74 69 6f 6e 20 74 79 70  65 0a 20 20 69 69 20 46  |tion type.  ii F|
000013b0  75 6e 63 74 69 6f 6e 73  20 6e 65 65 64 20 6e 6f  |unctions need no|
000013c0  74 20 62 65 20 70 72 65  64 65 63 6c 61 72 65 64  |t be predeclared|
000013d0  0a 0a 49 74 65 6d 20 28  69 29 20 63 6f 6d 65 73  |..Item (i) comes|
000013e0  20 61 62 6f 75 74 20 62  65 63 61 75 73 65 20 61  | about because a|
000013f0  6e 20 69 6e 74 65 72 70  72 65 74 65 64 20 6c 61  |n interpreted la|
00001400  6e 67 75 61 67 65 20 6e  65 65 64 20 6e 6f 74 20  |nguage need not |
00001410  6b 6e 6f 77 0a 69 6e 20  61 64 76 61 6e 63 65 20  |know.in advance |
00001420  74 68 65 20 74 79 70 65  20 6f 66 20 64 61 74 61  |the type of data|
00001430  20 74 6f 20 62 65 20 70  61 73 73 65 64 20 62 65  | to be passed be|
00001440  74 77 65 65 6e 20 66 75  6e 63 74 69 6f 6e 73 2e  |tween functions.|
00001450  20 20 49 66 20 79 6f 75  0a 61 74 74 65 6d 70 74  |  If you.attempt|
00001460  20 74 6f 20 64 65 63 6c  61 72 65 20 74 68 65 20  | to declare the |
00001470  66 75 6e 63 74 69 6f 6e  20 74 79 70 65 20 74 68  |function type th|
00001480  65 20 69 6e 74 65 72 70  72 65 74 65 72 20 77 69  |e interpreter wi|
00001490  6c 6c 20 61 73 73 75 6d  65 0a 74 68 61 74 20 79  |ll assume.that y|
000014a0  6f 75 27 72 65 20 64 65  63 6c 61 72 69 6e 67 20  |ou're declaring |
000014b0  61 20 76 61 72 69 61 62  6c 65 2c 20 61 6e 64 20  |a variable, and |
000014c0  77 69 6c 6c 20 6e 6f 74  20 72 75 6e 20 79 6f 75  |will not run you|
000014d0  72 20 63 6f 64 65 2e 0a  0a 49 74 65 6d 20 28 69  |r code...Item (i|
000014e0  69 29 20 69 73 20 62 72  6f 75 67 68 74 20 61 62  |i) is brought ab|
000014f0  6f 75 74 20 66 6f 72 20  73 69 6d 69 6c 61 72 20  |out for similar |
00001500  72 65 61 73 6f 6e 73 2c  20 74 68 65 20 63 6f 6e  |reasons, the con|
00001510  73 65 71 75 65 6e 63 65  20 62 65 69 6e 67 0a 74  |sequence being.t|
00001520  68 61 74 20 79 6f 75 20  63 61 6e 20 66 6f 72 77  |hat you can forw|
00001530  61 72 64 2d 72 65 66 65  72 65 6e 63 65 20 66 75  |ard-reference fu|
00001540  6e 63 74 69 6f 6e 73 20  77 69 74 68 6f 75 74 20  |nctions without |
00001550  68 61 76 69 6e 67 20 74  6f 20 70 72 65 64 65 63  |having to predec|
00001560  6c 61 72 65 0a 70 72 6f  74 6f 74 79 70 65 73 2e  |lare.prototypes.|
00001570  0a 0a 56 61 6c 75 65 73  20 61 72 65 20 72 65 74  |..Values are ret|
00001580  75 72 6e 65 64 20 62 79  20 66 75 6e 63 74 69 6f  |urned by functio|
00001590  6e 73 20 69 6e 20 74 68  65 20 73 61 6d 65 20 77  |ns in the same w|
000015a0  61 73 20 61 73 20 77 69  74 68 20 72 65 67 75 6c  |as as with regul|
000015b0  61 72 20 43 2e 0a 0a 20  72 75 6e 5f 70 72 69 6e  |ar C... run_prin|
000015c0  74 28 63 68 61 72 20 2a  6e 61 6d 65 2c 20 69 6e  |t(char *name, in|
000015d0  74 20 72 65 63 6f 72 64  29 0a 20 7b 0a 20 72 65  |t record). {. re|
000015e0  63 6f 72 64 2b 2b 3b 0a  20 72 65 74 75 72 6e 20  |cord++;. return |
000015f0  72 65 63 6f 72 64 3b 0a  20 7d 0a 0a 0a 47 6c 6f  |record;. }...Glo|
00001600  62 61 6c 20 26 20 4c 6f  63 61 6c 20 56 61 72 69  |bal & Local Vari|
00001610  61 62 6c 65 73 0a 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ables.----------|
00001620  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 0a  |--------------..|
00001630  56 61 72 69 61 62 6c 65  73 20 61 72 65 20 64 65  |Variables are de|
00001640  63 6c 61 72 65 64 20 69  6e 20 74 68 65 20 73 61  |clared in the sa|
00001650  6d 65 20 77 61 79 20 61  73 20 77 69 74 68 20 72  |me way as with r|
00001660  65 67 75 6c 61 72 20 43  2c 20 65 69 74 68 65 72  |egular C, either|
00001670  20 6e 65 61 72 0a 74 68  65 20 74 6f 70 20 6f 66  | near.the top of|
00001680  20 74 68 65 20 73 6f 75  72 63 65 20 28 62 65 66  | the source (bef|
00001690  6f 72 65 20 61 6e 79 20  66 75 6e 63 74 69 6f 6e  |ore any function|
000016a0  73 29 20 66 6f 72 20 67  6c 6f 62 61 6c 73 20 6f  |s) for globals o|
000016b0  72 20 61 74 20 74 68 65  20 74 6f 70 0a 6f 66 20  |r at the top.of |
000016c0  61 20 66 75 6e 63 74 69  6f 6e 20 28 62 65 66 6f  |a function (befo|
000016d0  72 65 20 61 6e 79 20 65  78 70 72 65 73 73 69 6f  |re any expressio|
000016e0  6e 73 29 20 66 6f 72 20  6c 6f 63 61 6c 73 2e 20  |ns) for locals. |
000016f0  20 54 68 65 20 66 6f 6c  6c 6f 77 69 6e 67 0a 74  | The following.t|
00001700  79 70 65 73 20 6f 66 20  76 61 72 69 61 62 6c 65  |ypes of variable|
00001710  20 61 72 65 20 73 75 70  70 6f 72 74 65 64 3a 0a  | are supported:.|
00001720  0a 20 20 2d 20 69 6e 74  20 20 20 20 20 33 32 2d  |.  - int     32-|
00001730  62 69 74 20 73 69 67 6e  65 64 20 69 6e 74 65 67  |bit signed integ|
00001740  65 72 0a 20 20 2d 20 69  6e 74 5b 6e 5d 20 20 41  |er.  - int[n]  A|
00001750  72 72 61 79 20 6f 66 20  69 6e 74 2c 20 77 69 74  |rray of int, wit|
00001760  68 20 6e 20 65 6c 65 6d  65 6e 74 73 0a 20 20 2d  |h n elements.  -|
00001770  20 69 6e 74 20 2a 20 20  20 50 6f 69 6e 74 65 72  | int *   Pointer|
00001780  20 74 6f 20 69 6e 74 0a  20 20 2d 20 63 68 61 72  | to int.  - char|
00001790  20 20 20 20 38 2d 62 69  74 20 73 69 67 6e 65 64  |    8-bit signed|
000017a0  20 62 79 74 65 20 28 41  53 43 49 49 20 63 6f 6e  | byte (ASCII con|
000017b0  76 65 72 73 69 6f 6e 20  73 75 70 70 6f 72 74 65  |version supporte|
000017c0  64 20 77 69 74 68 20 27  78 27 29 0a 20 20 2d 20  |d with 'x').  - |
000017d0  63 68 61 72 5b 6e 5d 20  41 72 72 61 79 20 6f 66  |char[n] Array of|
000017e0  20 63 68 61 72 2c 20 77  69 74 68 20 6e 20 65 6c  | char, with n el|
000017f0  65 6d 65 6e 74 73 20 28  63 6f 6d 6d 6f 6e 6c 79  |ements (commonly|
00001800  20 75 73 65 64 20 66 6f  72 20 73 74 72 69 6e 67  | used for string|
00001810  73 29 0a 20 20 2d 20 63  68 61 72 20 2a 20 20 50  |s).  - char *  P|
00001820  6f 69 6e 74 65 72 20 74  6f 20 63 68 61 72 0a 0a  |ointer to char..|
00001830  50 6f 69 6e 74 65 72 73  20 74 6f 20 76 61 72 69  |Pointers to vari|
00001840  61 62 6c 65 73 20 61 72  65 20 70 72 6f 63 65 73  |ables are proces|
00001850  73 65 64 20 69 6e 20 74  68 65 20 73 61 6d 65 20  |sed in the same |
00001860  77 61 79 20 61 73 20 77  69 74 68 20 72 65 67 75  |way as with regu|
00001870  6c 61 72 20 43 2e 0a 54  6f 20 69 6e 64 69 72 65  |lar C..To indire|
00001880  63 74 20 61 6e 20 65 78  70 72 65 73 73 69 6f 6e  |ct an expression|
00001890  2c 20 74 68 65 20 2a 20  6f 70 65 72 61 74 6f 72  |, the * operator|
000018a0  20 69 73 20 75 73 65 64  3a 0a 0a 20 63 68 61 72  | is used:.. char|
000018b0  20 73 74 72 69 6e 67 5b  33 32 5d 3b 0a 20 63 68  | string[32];. ch|
000018c0  61 72 20 63 3b 0a 0a 20  2a 73 74 72 69 6e 67 20  |ar c;.. *string |
000018d0  3d 20 30 3b 20 20 20 20  20 40 2a 20 53 65 74 73  |= 0;     @* Sets|
000018e0  20 66 69 72 73 74 20 62  79 74 65 20 6f 66 20 74  | first byte of t|
000018f0  68 65 20 63 68 61 72 20  61 72 72 61 79 20 74 6f  |he char array to|
00001900  20 4e 55 4c 4c 20 2a 40  0a 0a 20 63 20 3d 20 2a  | NULL *@.. c = *|
00001910  28 73 74 72 69 6e 67 2b  32 29 3b 20 40 2a 20 54  |(string+2); @* T|
00001920  68 65 73 65 20 61 72 65  20 2a 40 0a 20 63 20 3d  |hese are *@. c =|
00001930  20 73 74 72 69 6e 67 5b  32 5d 3b 20 20 20 40 2a  | string[2];   @*|
00001940  20 61 6e 61 6c 6f 67 6f  75 73 20 2a 40 0a 0a 54  | analogous *@..T|
00001950  6f 20 73 70 65 63 69 66  79 20 74 68 65 20 61 64  |o specify the ad|
00001960  64 72 65 73 73 20 6f 66  20 61 6e 20 65 78 70 72  |dress of an expr|
00001970  65 73 73 69 6f 6e 2c 20  74 68 65 20 26 20 6f 70  |ession, the & op|
00001980  65 72 61 74 6f 72 20 69  73 20 75 73 65 64 3a 0a  |erator is used:.|
00001990  0a 20 69 6e 74 20 69 3b  0a 0a 20 73 63 61 6e 66  |. int i;.. scanf|
000019a0  28 22 25 64 22 2c 26 69  29 3b 20 20 40 2a 20 53  |("%d",&i);  @* S|
000019b0  74 6f 72 65 20 74 68 65  20 76 61 6c 75 65 20 61  |tore the value a|
000019c0  74 20 74 68 65 20 69 6e  74 20 70 6f 69 6e 74 65  |t the int pointe|
000019d0  64 20 74 6f 20 62 79 20  26 69 20 2a 40 0a 0a 21  |d to by &i *@..!|
000019e0  49 6e 74 65 72 70 72 65  74 20 69 73 20 6e 6f 74  |Interpret is not|
000019f0  20 61 73 20 66 75 73 73  79 20 61 73 20 72 65 67  | as fussy as reg|
00001a00  75 6c 61 72 20 43 20 77  69 74 68 20 72 65 67 61  |ular C with rega|
00001a10  72 64 20 74 79 70 65 20  63 61 73 74 69 6e 67 2e  |rd type casting.|
00001a20  20 20 49 6e 0a 67 65 6e  65 72 61 6c 20 74 68 65  |  In.general the|
00001a30  20 69 6e 74 20 74 79 70  65 20 63 61 6e 20 62 65  | int type can be|
00001a40  20 75 73 65 64 20 74 6f  20 72 65 70 72 65 73 65  | used to represe|
00001a50  6e 74 20 61 6e 79 20 33  32 20 62 69 74 20 71 75  |nt any 32 bit qu|
00001a60  61 6e 74 69 74 79 20 61  6e 64 0a 74 68 65 20 63  |antity and.the c|
00001a70  68 61 72 20 74 79 70 65  2c 20 61 6e 79 20 38 20  |har type, any 8 |
00001a80  62 69 74 20 71 75 61 6e  74 69 74 79 2e 20 20 54  |bit quantity.  T|
00001a90  68 69 73 20 69 73 20 70  61 72 74 69 63 75 6c 61  |his is particula|
00001aa0  72 6c 79 20 74 72 75 65  20 69 6e 20 74 68 65 0a  |rly true in the.|
00001ab0  63 6f 6e 74 65 78 74 20  6f 66 20 6c 69 62 72 61  |context of libra|
00001ac0  72 79 20 66 75 6e 63 74  69 6f 6e 20 63 61 6c 6c  |ry function call|
00001ad0  73 2c 20 61 73 20 65 78  70 6c 61 69 6e 65 64 20  |s, as explained |
00001ae0  6c 61 74 65 72 2e 0a 0a  0a 45 78 70 72 65 73 73  |later....Express|
00001af0  69 6f 6e 73 0a 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ions.-----------|
00001b00  0a 0a 21 49 6e 74 65 72  70 72 65 74 20 70 61 72  |..!Interpret par|
00001b10  73 65 73 20 65 78 70 72  65 73 73 69 6f 6e 73 20  |ses expressions |
00001b20  69 6e 20 74 68 65 20 73  61 6d 65 20 77 61 73 20  |in the same was |
00001b30  61 73 20 43 2e 20 20 41  73 20 77 69 74 68 20 63  |as C.  As with c|
00001b40  6f 6d 70 69 6c 65 64 20  43 2c 0a 66 75 6e 63 74  |ompiled C,.funct|
00001b50  69 6f 6e 20 65 6c 65 6d  65 6e 74 73 20 77 69 74  |ion elements wit|
00001b60  68 69 6e 20 61 6e 20 65  78 70 72 65 73 73 69 6f  |hin an expressio|
00001b70  6e 20 6d 61 79 20 62 65  20 65 76 61 6c 75 61 74  |n may be evaluat|
00001b80  65 64 20 69 6e 20 61 6e  79 20 6f 72 64 65 72 0a  |ed in any order.|
00001b90  61 6e 64 20 6d 61 79 20  62 65 20 6e 65 73 74 65  |and may be neste|
00001ba0  64 20 74 6f 20 61 6e 79  20 70 72 61 63 74 69 63  |d to any practic|
00001bb0  61 6c 20 64 65 70 74 68  2e 20 20 54 68 65 20 66  |al depth.  The f|
00001bc0  6f 6c 6c 6f 77 69 6e 67  20 6e 75 6d 65 72 69 63  |ollowing numeric|
00001bd0  61 6c 0a 6f 70 65 72 61  74 6f 72 73 20 61 72 65  |al.operators are|
00001be0  20 76 61 6c 69 64 20 77  69 74 68 69 6e 20 61 6e  | valid within an|
00001bf0  20 65 78 70 72 65 73 73  69 6f 6e 3a 0a 0a 20 20  | expression:..  |
00001c00  2b 2b 20 20 20 41 75 74  6f 20 69 6e 63 72 65 6d  |++   Auto increm|
00001c10  65 6e 74 20 28 70 6f 73  74 20 6f 72 20 70 72 65  |ent (post or pre|
00001c20  20 69 6e 64 65 78 65 64  29 0a 20 20 2d 2d 20 20  | indexed).  --  |
00001c30  20 41 75 74 6f 20 64 65  63 72 65 6d 65 6e 74 20  | Auto decrement |
00001c40  28 70 6f 73 74 20 6f 72  20 70 72 65 20 69 6e 64  |(post or pre ind|
00001c50  65 78 65 64 29 0a 20 20  20 2b 20 20 20 41 64 64  |exed).   +   Add|
00001c60  0a 20 20 20 2d 20 20 20  53 75 62 0a 20 20 20 2a  |.   -   Sub.   *|
00001c70  20 20 20 4d 75 6c 74 69  70 6c 79 0a 20 20 20 2f  |   Multiply.   /|
00001c80  20 20 20 44 69 76 69 64  65 0a 20 20 20 25 20 20  |   Divide.   %  |
00001c90  20 4d 6f 64 75 6c 6f 0a  0a 54 68 65 20 66 6f 6c  | Modulo..The fol|
00001ca0  6c 6f 77 69 6e 67 20 6c  6f 67 69 63 61 6c 20 6f  |lowing logical o|
00001cb0  70 65 72 61 74 6f 72 73  20 61 72 65 20 76 61 6c  |perators are val|
00001cc0  69 64 20 77 69 74 68 69  6e 20 61 6e 20 65 78 70  |id within an exp|
00001cd0  72 65 73 73 69 6f 6e 3a  0a 0a 20 20 3d 3d 20 20  |ression:..  ==  |
00001ce0  20 45 71 75 61 6c 69 74  79 0a 20 20 21 3d 20 20  | Equality.  !=  |
00001cf0  20 4e 6f 6e 20 65 71 75  61 6c 69 74 79 0a 20 20  | Non equality.  |
00001d00  20 3c 20 20 20 4c 65 73  73 20 74 68 61 6e 0a 20  | <   Less than. |
00001d10  20 20 3e 20 20 20 47 72  65 61 74 65 72 20 74 68  |  >   Greater th|
00001d20  61 6e 0a 20 20 3e 3d 20  20 20 47 72 65 61 74 65  |an.  >=   Greate|
00001d30  72 20 74 68 61 6e 20 6f  72 20 65 71 75 61 6c 20  |r than or equal |
00001d40  74 6f 0a 20 20 3c 3d 20  20 20 4c 65 73 73 20 74  |to.  <=   Less t|
00001d50  68 61 6e 20 6f 72 20 65  71 75 61 6c 20 74 6f 0a  |han or equal to.|
00001d60  20 20 26 26 20 20 20 4c  6f 67 69 63 61 6c 20 41  |  &&   Logical A|
00001d70  4e 44 0a 20 20 7c 7c 20  20 20 4c 6f 67 69 63 61  |ND.  ||   Logica|
00001d80  6c 20 4f 52 0a 20 20 20  21 20 20 20 4c 6f 67 69  |l OR.   !   Logi|
00001d90  63 61 6c 20 4e 4f 54 0a  0a 45 78 70 72 65 73 73  |cal NOT..Express|
00001da0  69 6f 6e 73 20 63 61 6e  20 62 65 20 65 6e 63 6c  |ions can be encl|
00001db0  6f 73 65 64 20 77 69 74  68 69 6e 20 70 61 72 65  |osed within pare|
00001dc0  6e 74 68 65 73 69 73 20  74 6f 20 64 65 66 69 6e  |nthesis to defin|
00001dd0  65 20 74 68 65 20 6f 72  64 65 72 20 6f 66 0a 63  |e the order of.c|
00001de0  61 6c 63 75 6c 61 74 69  6f 6e 2e 20 20 46 6f 72  |alculation.  For|
00001df0  20 65 78 61 6d 70 6c 65  2c 20 74 68 65 20 66 6f  | example, the fo|
00001e00  6c 6c 6f 77 69 6e 67 20  65 78 70 72 65 73 73 69  |llowing expressi|
00001e10  6f 6e 20 69 73 20 76 61  6c 69 64 3a 0a 0a 20 70  |on is valid:.. p|
00001e20  72 69 6e 74 66 28 22 54  68 65 20 72 65 73 75 6c  |rintf("The resul|
00001e30  74 20 69 73 3a 20 25 64  22 2c 28 69 3d 67 65 74  |t is: %d",(i=get|
00001e40  5f 69 6e 74 28 2b 2b 6e  75 6d 5f 74 6f 5f 67 65  |_int(++num_to_ge|
00001e50  74 25 32 29 29 29 3b 0a  0a 0a 43 6f 6e 73 74 72  |t%2)));...Constr|
00001e60  75 63 74 20 53 79 6e 74  61 78 0a 2d 2d 2d 2d 2d  |uct Syntax.-----|
00001e70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 21 49 6e  |-----------..!In|
00001e80  74 65 72 70 72 65 74 20  69 6d 70 6c 65 6d 65 6e  |terpret implemen|
00001e90  74 73 20 74 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |ts the following|
00001ea0  20 72 65 67 75 6c 61 72  20 43 20 63 6f 6e 73 74  | regular C const|
00001eb0  72 75 63 74 73 3a 0a 0a  20 20 2d 20 69 66 28 29  |ructs:..  - if()|
00001ec0  20 7b 7d 20 65 6c 73 65  20 7b 7d 0a 20 20 2d 20  | {} else {}.  - |
00001ed0  66 6f 72 28 20 3b 20 3b  20 29 20 7b 7d 0a 20 20  |for( ; ; ) {}.  |
00001ee0  2d 20 77 68 69 6c 65 28  29 20 7b 7d 0a 0a 54 68  |- while() {}..Th|
00001ef0  65 20 69 66 28 29 20 63  6f 6e 73 74 72 75 63 74  |e if() construct|
00001f00  20 68 61 73 20 74 68 65  20 66 6f 6c 6c 6f 77 69  | has the followi|
00001f10  6e 67 20 66 6f 72 6d 61  74 3a 0a 0a 20 69 66 28  |ng format:.. if(|
00001f20  63 6f 6e 64 69 74 69 6f  6e 29 0a 20 20 20 7b 0a  |condition).   {.|
00001f30  20 20 20 2e 2e 2e 0a 20  20 20 7d 0a 20 65 6c 73  |   ....   }. els|
00001f40  65 0a 20 20 20 7b 0a 20  20 20 2e 2e 2e 0a 20 20  |e.   {.   ....  |
00001f50  20 7d 0a 0a 20 49 66 20  63 6f 6e 64 69 74 69 6f  | }.. If conditio|
00001f60  6e 20 69 73 20 74 72 75  65 20 74 68 65 20 66 69  |n is true the fi|
00001f70  72 73 74 20 70 72 6f 67  72 61 6d 20 62 6c 6f 63  |rst program bloc|
00001f80  6b 20 77 69 6c 6c 20 65  78 65 63 75 74 65 2c 20  |k will execute, |
00001f90  6f 74 68 65 72 77 69 73  65 20 74 68 65 0a 20 73  |otherwise the. s|
00001fa0  65 63 6f 6e 64 20 62 6c  6f 63 6b 20 77 69 6c 6c  |econd block will|
00001fb0  20 72 75 6e 2e 0a 0a 54  68 65 20 66 6f 72 28 3b  | run...The for(;|
00001fc0  3b 29 20 63 6f 6e 73 74  72 75 63 74 20 68 61 73  |;) construct has|
00001fd0  20 74 68 65 20 66 6f 6c  6c 6f 77 69 6e 67 20 66  | the following f|
00001fe0  6f 72 6d 61 74 3a 0a 0a  20 66 6f 72 28 69 6e 69  |ormat:.. for(ini|
00001ff0  74 5f 63 6f 6d 6d 61 6e  64 3b 20 63 6f 6e 64 69  |t_command; condi|
00002000  74 69 6f 6e 3b 20 6c 6f  6f 70 5f 63 6f 6d 6d 61  |tion; loop_comma|
00002010  6e 64 29 0a 20 20 20 7b  0a 20 20 20 2e 2e 2e 0a  |nd).   {.   ....|
00002020  20 20 20 7d 0a 0a 20 54  68 65 20 69 6e 69 74 5f  |   }.. The init_|
00002030  63 6f 6d 6d 61 6e 64 20  69 73 20 65 78 65 63 75  |command is execu|
00002040  74 65 64 20 6f 6e 63 65  2c 20 74 68 65 6e 20 6c  |ted once, then l|
00002050  6f 6f 70 5f 63 6f 6d 6d  61 6e 64 20 61 6e 64 20  |oop_command and |
00002060  74 68 65 20 70 72 6f 67  72 61 6d 0a 20 62 6c 6f  |the program. blo|
00002070  63 6b 20 61 72 65 20 65  78 65 63 75 74 65 64 20  |ck are executed |
00002080  72 65 70 65 61 74 65 64  6c 79 20 75 6e 74 69 6c  |repeatedly until|
00002090  20 63 6f 6e 64 69 74 69  6f 6e 20 69 73 20 74 72  | condition is tr|
000020a0  75 65 2e 0a 0a 54 68 65  20 77 68 69 6c 65 28 29  |ue...The while()|
000020b0  20 63 6f 6e 73 74 72 75  63 74 20 68 61 73 20 74  | construct has t|
000020c0  68 65 20 66 6f 6c 6c 6f  77 69 6e 67 20 66 6f 72  |he following for|
000020d0  6d 61 74 3a 0a 0a 20 77  68 69 6c 65 28 63 6f 6e  |mat:.. while(con|
000020e0  64 69 74 69 6f 6e 29 0a  20 20 20 7b 0a 20 20 20  |dition).   {.   |
000020f0  2e 2e 2e 0a 20 20 20 7d  0a 0a 20 54 68 65 20 70  |....   }.. The p|
00002100  72 6f 67 72 61 6d 20 62  6c 6f 63 6b 20 77 69 6c  |rogram block wil|
00002110  6c 20 65 78 65 63 75 74  65 20 72 65 70 65 61 74  |l execute repeat|
00002120  65 64 6c 79 20 75 6e 74  69 6c 20 63 6f 6e 64 69  |edly until condi|
00002130  74 69 6f 6e 20 62 65 63  6f 6d 65 73 20 66 61 6c  |tion becomes fal|
00002140  73 65 2e 0a 0a 49 66 20  74 68 65 20 62 72 65 61  |se...If the brea|
00002150  6b 20 63 6f 6d 6d 61 6e  64 20 69 73 20 65 78 65  |k command is exe|
00002160  63 75 74 65 64 20 77 69  74 68 69 6e 20 61 6e 79  |cuted within any|
00002170  20 6f 66 20 74 68 65 20  70 72 6f 67 72 61 6d 20  | of the program |
00002180  62 6c 6f 63 6b 73 20 66  6f 72 0a 74 68 65 20 61  |blocks for.the a|
00002190  62 6f 76 65 20 63 6f 6e  73 74 72 75 63 74 73 2c  |bove constructs,|
000021a0  20 65 78 65 63 75 74 69  6f 6e 20 77 69 6c 6c 20  | execution will |
000021b0  6a 75 6d 70 20 70 61 73  74 20 74 68 65 20 63 6f  |jump past the co|
000021c0  6e 73 74 72 75 63 74 20  74 6f 20 74 68 65 0a 6e  |nstruct to the.n|
000021d0  65 78 74 20 70 69 65 63  65 20 6f 66 20 63 6f 64  |ext piece of cod|
000021e0  65 2e 20 20 46 6f 72 20  65 78 61 6d 70 6c 65 3a  |e.  For example:|
000021f0  0a 0a 20 77 68 69 6c 65  28 21 71 75 69 74 29 0a  |.. while(!quit).|
00002200  20 20 20 7b 0a 20 20 20  70 75 74 73 28 22 52 75  |   {.   puts("Ru|
00002210  6e 20 75 6e 74 69 6c 20  71 75 69 74 2e 2e 22 29  |n until quit..")|
00002220  3b 0a 20 20 20 69 66 28  65 73 63 61 70 65 5f 70  |;.   if(escape_p|
00002230  72 65 73 73 65 64 28 29  29 0a 20 20 20 20 20 62  |ressed()).     b|
00002240  72 65 61 6b 3b 0a 20 20  20 7d 0a 20 70 75 74 73  |reak;.   }. puts|
00002250  28 22 2e 2e 6f 72 20 75  6e 74 69 6c 20 65 73 63  |("..or until esc|
00002260  61 70 65 20 69 73 20 70  72 65 73 73 65 64 21 22  |ape is pressed!"|
00002270  29 3b 0a 0a 49 66 20 74  68 65 20 72 65 74 75 72  |);..If the retur|
00002280  6e 20 63 6f 6d 6d 61 6e  64 20 69 73 20 65 78 65  |n command is exe|
00002290  63 75 74 65 64 20 77 69  74 68 69 6e 20 61 6e 79  |cuted within any|
000022a0  20 6f 66 20 74 68 65 20  70 72 6f 67 72 61 6d 20  | of the program |
000022b0  62 6c 6f 63 6b 73 20 66  6f 72 0a 74 68 65 20 61  |blocks for.the a|
000022c0  62 6f 76 65 20 63 6f 6e  73 74 72 75 63 74 73 2c  |bove constructs,|
000022d0  20 61 6e 79 20 6e 65 73  74 65 64 20 73 74 72 75  | any nested stru|
000022e0  63 74 75 72 65 73 20 77  69 6c 6c 20 62 65 20 75  |ctures will be u|
000022f0  6e 77 6f 75 6e 64 20 63  6f 72 72 65 63 74 6c 79  |nwound correctly|
00002300  0a 61 6e 64 20 65 78 65  63 75 74 69 6f 6e 20 77  |.and execution w|
00002310  69 6c 6c 20 72 65 74 75  72 6e 20 74 6f 20 74 68  |ill return to th|
00002320  65 20 63 61 6c 6c 69 6e  67 20 66 75 6e 63 74 69  |e calling functi|
00002330  6f 6e 2e 20 20 46 6f 72  20 65 78 61 6d 70 6c 65  |on.  For example|
00002340  3a 0a 0a 20 6d 61 69 6e  28 29 0a 20 7b 0a 20 77  |:.. main(). {. w|
00002350  61 69 74 5f 66 6f 72 5f  6b 65 79 28 29 3b 0a 20  |ait_for_key();. |
00002360  7d 0a 0a 20 77 61 69 74  5f 66 6f 72 5f 6b 65 79  |}.. wait_for_key|
00002370  28 29 0a 20 7b 0a 20 77  68 69 6c 65 28 21 74 69  |(). {. while(!ti|
00002380  6d 65 5f 6f 75 74 28 29  29 0a 20 20 20 7b 0a 20  |me_out()).   {. |
00002390  20 20 69 66 28 6b 65 79  5f 70 72 65 73 73 65 64  |  if(key_pressed|
000023a0  28 29 29 0a 20 20 20 20  20 72 65 74 75 72 6e 3b  |()).     return;|
000023b0  0a 20 20 20 7d 0a 20 7d  0a 0a 0a 4c 69 62 72 61  |.   }. }...Libra|
000023c0  72 79 20 46 75 6e 63 74  69 6f 6e 73 0a 2d 2d 2d  |ry Functions.---|
000023d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 0a  |--------------..|
000023e0  41 20 6e 75 6d 62 65 72  20 6f 66 20 75 73 65 66  |A number of usef|
000023f0  75 6c 20 66 75 6e 63 74  69 6f 6e 73 20 61 72 65  |ul functions are|
00002400  20 62 75 69 6c 74 20 69  6e 74 6f 20 21 49 6e 74  | built into !Int|
00002410  65 72 70 72 65 74 2e 20  20 59 6f 75 20 63 61 6e  |erpret.  You can|
00002420  20 63 61 6c 6c 0a 74 68  65 73 65 20 6c 69 6b 65  | call.these like|
00002430  20 61 6e 79 20 6f 74 68  65 72 20 66 75 6e 63 74  | any other funct|
00002440  69 6f 6e 20 61 6e 64 2c  20 77 68 65 72 65 20 76  |ion and, where v|
00002450  61 6c 69 64 2c 20 74 68  65 79 20 77 69 6c 6c 20  |alid, they will |
00002460  72 65 74 75 72 6e 20 76  61 6c 75 65 73 0a 6c 69  |return values.li|
00002470  6b 65 20 61 6e 79 20 6f  74 68 65 72 20 66 75 6e  |ke any other fun|
00002480  63 74 69 6f 6e 2e 20 20  57 68 65 72 65 20 6e 65  |ction.  Where ne|
00002490  63 65 73 73 61 72 79 2c  20 74 68 65 20 69 6e 74  |cessary, the int|
000024a0  65 72 70 72 65 74 65 72  20 70 65 72 66 6f 72 6d  |erpreter perform|
000024b0  73 0a 74 79 70 65 20 63  61 73 74 69 6e 67 20 6f  |s.type casting o|
000024c0  6e 20 79 6f 75 72 20 62  65 68 61 6c 66 2e 0a 0a  |n your behalf...|
000024d0  49 74 20 69 73 20 62 65  79 6f 6e 64 20 74 68 65  |It is beyond the|
000024e0  20 73 63 6f 70 65 20 6f  66 20 74 68 69 73 20 6d  | scope of this m|
000024f0  61 6e 75 61 6c 20 74 6f  20 66 75 6c 6c 79 20 64  |anual to fully d|
00002500  6f 63 75 6d 65 6e 74 20  74 68 65 20 6c 69 62 72  |ocument the libr|
00002510  61 72 79 2c 0a 68 6f 77  65 76 65 72 20 61 20 62  |ary,.however a b|
00002520  72 69 65 66 20 73 75 6d  6d 61 72 79 20 6f 66 20  |rief summary of |
00002530  65 61 63 68 20 66 75 6e  63 74 69 6f 6e 20 69 73  |each function is|
00002540  20 70 72 6f 76 69 64 65  64 20 62 65 6c 6f 77 2e  | provided below.|
00002550  0a 0a 46 75 6e 63 74 69  6f 6e 20 20 20 20 20 20  |..Function      |
00002560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002580  20 20 20 20 20 20 20 20  20 52 65 74 75 72 6e 73  |         Returns|
00002590  0a 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
000025a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000025c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
000025d0  62 62 63 5f 76 64 75 28  69 6e 74 20 63 68 61 72  |bbc_vdu(int char|
000025e0  61 63 74 65 72 29 20 20  20 20 20 20 20 20 20 20  |acter)          |
000025f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002600  20 20 20 20 20 20 20 6e  6f 6e 65 0a 62 62 63 5f  |       none.bbc_|
00002610  76 64 75 77 28 69 6e 74  20 77 6f 72 64 29 20 20  |vduw(int word)  |
00002620  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002640  20 20 20 6e 6f 6e 65 0a  62 62 63 5f 73 74 72 69  |   none.bbc_stri|
00002650  6e 67 70 72 69 6e 74 28  63 68 61 72 20 2a 73 74  |ngprint(char *st|
00002660  72 69 6e 67 5f 74 6f 5f  70 72 69 6e 74 29 20 20  |ring_to_print)  |
00002670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6e  |               n|
00002680  6f 6e 65 0a 62 62 63 5f  63 6c 73 28 29 20 20 20  |one.bbc_cls()   |
00002690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000026b0  20 20 20 20 20 20 20 20  20 20 20 6e 6f 6e 65 0a  |           none.|
000026c0  62 62 63 5f 63 6f 6c 6f  75 72 28 69 6e 74 20 74  |bbc_colour(int t|
000026d0  65 78 74 5f 63 6f 6c 6f  75 72 29 20 20 20 20 20  |ext_colour)     |
000026e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000026f0  20 20 20 20 20 20 20 6e  6f 6e 65 0a 62 62 63 5f  |       none.bbc_|
00002700  74 61 62 28 69 6e 74 20  78 2c 20 69 6e 74 20 79  |tab(int x, int y|
00002710  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00002720  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002730  20 20 20 6e 6f 6e 65 0a  62 62 63 5f 70 6c 6f 74  |   none.bbc_plot|
00002740  28 69 6e 74 20 70 6c 6f  74 63 6f 64 65 2c 20 69  |(int plotcode, i|
00002750  6e 74 20 78 2c 20 69 6e  74 20 79 29 20 20 20 20  |nt x, int y)    |
00002760  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6e  |               n|
00002770  6f 6e 65 0a 62 62 63 5f  6d 6f 64 65 28 69 6e 74  |one.bbc_mode(int|
00002780  20 6d 6f 64 65 29 20 20  20 20 20 20 20 20 20 20  | mode)          |
00002790  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000027a0  20 20 20 20 20 20 20 20  20 20 20 6e 6f 6e 65 0a  |           none.|
000027b0  62 62 63 5f 6d 6f 76 65  28 69 6e 74 20 78 2c 20  |bbc_move(int x, |
000027c0  69 6e 74 20 79 29 20 20  20 20 20 20 20 20 20 20  |int y)          |
000027d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000027e0  20 20 20 20 20 20 20 6e  6f 6e 65 0a 62 62 63 5f  |       none.bbc_|
000027f0  6d 6f 76 65 62 79 28 69  6e 74 20 78 2c 20 69 6e  |moveby(int x, in|
00002800  74 20 79 29 20 20 20 20  20 20 20 20 20 20 20 20  |t y)            |
00002810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002820  20 20 20 6e 6f 6e 65 0a  62 62 63 5f 64 72 61 77  |   none.bbc_draw|
00002830  28 69 6e 74 20 78 2c 20  69 6e 74 20 79 29 20 20  |(int x, int y)  |
00002840  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002850  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6e  |               n|
00002860  6f 6e 65 0a 62 62 63 5f  64 72 61 77 62 79 28 69  |one.bbc_drawby(i|
00002870  6e 74 20 78 2c 20 69 6e  74 20 79 29 20 20 20 20  |nt x, int y)    |
00002880  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002890  20 20 20 20 20 20 20 20  20 20 20 6e 6f 6e 65 0a  |           none.|
000028a0  62 62 63 5f 72 65 63 74  61 6e 67 6c 65 28 69 6e  |bbc_rectangle(in|
000028b0  74 20 78 2c 20 69 6e 74  20 79 2c 20 69 6e 74 20  |t x, int y, int |
000028c0  68 2c 20 69 6e 74 20 77  29 20 20 20 20 20 20 20  |h, int w)       |
000028d0  20 20 20 20 20 20 20 6e  6f 6e 65 0a 62 62 63 5f  |       none.bbc_|
000028e0  72 65 63 74 61 6e 67 6c  65 66 69 6c 6c 28 69 6e  |rectanglefill(in|
000028f0  74 20 78 2c 20 69 6e 74  20 79 2c 20 69 6e 74 20  |t x, int y, int |
00002900  68 2c 20 69 6e 74 20 77  29 20 20 20 20 20 20 20  |h, int w)       |
00002910  20 20 20 6e 6f 6e 65 0a  62 62 63 5f 63 69 72 63  |   none.bbc_circ|
00002920  6c 65 28 69 6e 74 20 78  2c 20 69 6e 74 20 79 2c  |le(int x, int y,|
00002930  20 69 6e 74 20 72 29 20  20 20 20 20 20 20 20 20  | int r)         |
00002940  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6e  |               n|
00002950  6f 6e 65 0a 62 62 63 5f  63 69 72 63 6c 65 66 69  |one.bbc_circlefi|
00002960  6c 6c 28 69 6e 74 20 78  2c 20 69 6e 74 20 79 2c  |ll(int x, int y,|
00002970  20 69 6e 74 20 72 29 20  20 20 20 20 20 20 20 20  | int r)         |
00002980  20 20 20 20 20 20 20 20  20 20 20 6e 6f 6e 65 0a  |           none.|
00002990  62 62 63 5f 6f 72 69 67  69 6e 28 69 6e 74 20 78  |bbc_origin(int x|
000029a0  2c 20 69 6e 74 20 79 29  20 20 20 20 20 20 20 20  |, int y)        |
000029b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000029c0  20 20 20 20 20 20 20 6e  6f 6e 65 0a 62 62 63 5f  |       none.bbc_|
000029d0  67 77 69 6e 64 6f 77 28  69 6e 74 20 78 30 2c 20  |gwindow(int x0, |
000029e0  79 30 2c 20 78 31 2c 20  79 31 29 20 20 20 20 20  |y0, x1, y1)     |
000029f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002a00  20 20 20 6e 6f 6e 65 0a  62 62 63 5f 63 6c 67 28  |   none.bbc_clg(|
00002a10  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00002a20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6e  |               n|
00002a40  6f 6e 65 0a 62 62 63 5f  66 69 6c 6c 28 69 6e 74  |one.bbc_fill(int|
00002a50  20 78 2c 20 69 6e 74 20  79 29 20 20 20 20 20 20  | x, int y)      |
00002a60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002a70  20 20 20 20 20 20 20 20  20 20 20 6e 6f 6e 65 0a  |           none.|
00002a80  62 62 63 5f 67 63 6f 6c  28 69 6e 74 20 70 6c 6f  |bbc_gcol(int plo|
00002a90  74 74 79 70 65 2c 20 69  6e 74 20 63 6f 6c 29 20  |ttype, int col) |
00002aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002ab0  20 20 20 20 20 20 20 6e  6f 6e 65 0a 62 62 63 5f  |       none.bbc_|
00002ac0  74 69 6e 74 28 69 6e 74  20 63 6f 6c 2c 20 69 6e  |tint(int col, in|
00002ad0  74 20 74 69 6e 74 29 20  20 20 20 20 20 20 20 20  |t tint)         |
00002ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002af0  20 20 20 6e 6f 6e 65 0a  62 62 63 5f 70 61 6c 65  |   none.bbc_pale|
00002b00  74 74 65 28 69 6e 74 20  6c 6f 67 2c 20 69 6e 74  |tte(int log, int|
00002b10  20 70 68 79 73 2c 20 69  6e 74 20 72 2c 20 69 6e  | phys, int r, in|
00002b20  74 20 67 2c 20 69 6e 74  20 62 29 20 20 20 20 6e  |t g, int b)    n|
00002b30  6f 6e 65 0a 62 62 63 5f  70 6f 69 6e 74 28 69 6e  |one.bbc_point(in|
00002b40  74 20 78 2c 20 69 6e 74  20 79 29 20 20 20 20 20  |t x, int y)     |
00002b50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002b60  20 20 20 20 20 20 20 20  20 20 20 69 6e 74 20 63  |           int c|
00002b70  6f 6c 6f 75 72 0a 62 62  63 5f 76 64 75 76 61 72  |olour.bbc_vduvar|
00002b80  73 28 69 6e 74 20 2a 69  6e 2c 20 69 6e 74 20 2a  |s(int *in, int *|
00002b90  6f 75 74 29 20 20 20 20  20 20 20 20 20 20 20 20  |out)            |
00002ba0  20 20 20 20 20 20 20 20  20 20 20 20 20 6e 6f 6e  |             non|
00002bb0  65 0a 62 62 63 5f 6d 6f  64 65 76 61 72 28 69 6e  |e.bbc_modevar(in|
00002bc0  74 20 6d 6f 64 65 2c 20  69 6e 74 20 76 61 72 6e  |t mode, int varn|
00002bd0  6f 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |o)              |
00002be0  20 20 20 20 20 20 20 20  20 69 6e 74 20 6d 6f 64  |         int mod|
00002bf0  65 76 61 72 0a 62 62 63  5f 67 65 74 28 29 20 20  |evar.bbc_get()  |
00002c00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002c20  20 20 20 20 20 20 20 20  20 20 20 20 69 6e 74 20  |            int |
00002c30  6b 65 79 0a 62 62 63 5f  63 75 72 73 6f 72 28 69  |key.bbc_cursor(i|
00002c40  6e 74 20 63 75 72 73 5f  74 79 70 65 29 20 20 20  |nt curs_type)   |
00002c50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002c60  20 20 20 20 20 20 20 20  20 20 20 6e 6f 6e 65 0a  |           none.|
00002c70  62 62 63 5f 61 64 76 61  6c 28 69 6e 74 20 62 75  |bbc_adval(int bu|
00002c80  66 66 6e 75 6d 29 20 20  20 20 20 20 20 20 20 20  |ffnum)          |
00002c90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002ca0  20 20 20 20 20 20 20 69  6e 74 20 76 61 6c 0a 62  |       int val.b|
00002cb0  62 63 5f 67 65 74 62 65  61 74 28 29 20 20 20 20  |bc_getbeat()    |
00002cc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002ce0  20 20 20 20 20 20 69 6e  74 20 62 65 61 74 5f 76  |      int beat_v|
00002cf0  61 6c 0a 62 62 63 5f 67  65 74 62 65 61 74 73 28  |al.bbc_getbeats(|
00002d00  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00002d10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002d20  20 20 20 20 20 20 20 20  20 20 69 6e 74 20 63 79  |          int cy|
00002d30  63 6c 5f 6c 65 6e 0a 62  62 63 5f 67 65 74 74 65  |cl_len.bbc_gette|
00002d40  6d 70 6f 28 29 20 20 20  20 20 20 20 20 20 20 20  |mpo()           |
00002d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002d60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 69 6e  |              in|
00002d70  74 20 62 65 61 74 5f 72  61 74 65 0a 62 62 63 5f  |t beat_rate.bbc_|
00002d80  69 6e 6b 65 79 28 69 6e  74 20 74 69 6d 65 5f 6e  |inkey(int time_n|
00002d90  75 6d 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |um)             |
00002da0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002db0  20 20 20 69 6e 74 20 6b  65 79 0a 62 62 63 5f 73  |   int key.bbc_s|
00002dc0  65 74 62 65 61 74 73 28  69 6e 74 20 63 79 63 6c  |etbeats(int cycl|
00002dd0  5f 6c 65 6e 29 20 20 20  20 20 20 20 20 20 20 20  |_len)           |
00002de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002df0  20 20 6e 6f 6e 65 0a 62  62 63 5f 73 65 74 74 65  |  none.bbc_sette|
00002e00  6d 70 6f 28 69 6e 74 20  62 65 61 74 5f 72 61 74  |mpo(int beat_rat|
00002e10  65 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e)              |
00002e20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 6e 6f  |              no|
00002e30  6e 65 0a 62 62 63 5f 73  6f 75 6e 64 28 69 6e 74  |ne.bbc_sound(int|
00002e40  20 63 68 61 6e 2c 20 69  6e 74 20 61 6d 70 2c 20  | chan, int amp, |
00002e50  69 6e 74 20 70 69 74 63  68 2c 20 69 6e 74 20 64  |int pitch, int d|
00002e60  75 72 29 20 20 20 20 20  20 20 6e 6f 6e 65 0a 62  |ur)       none.b|
00002e70  62 63 5f 73 6f 75 6e 64  6f 66 66 28 29 20 20 20  |bc_soundoff()   |
00002e80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002ea0  20 20 20 20 20 20 6e 6f  6e 65 0a 62 62 63 5f 73  |      none.bbc_s|
00002eb0  6f 75 6e 64 6f 6e 28 29  20 20 20 20 20 20 20 20  |oundon()        |
00002ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002ee0  20 20 6e 6f 6e 65 0a 62  62 63 5f 73 74 65 72 65  |  none.bbc_stere|
00002ef0  6f 28 69 6e 74 20 63 68  61 6e 2c 20 69 6e 74 20  |o(int chan, int |
00002f00  70 6f 73 29 20 20 20 20  20 20 20 20 20 20 20 20  |pos)            |
00002f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 6e 6f  |              no|
00002f20  6e 65 0a 62 62 63 5f 76  6f 69 63 65 73 28 69 6e  |ne.bbc_voices(in|
00002f30  74 20 6e 75 6d 5f 63 68  61 6e 29 20 20 20 20 20  |t num_chan)     |
00002f40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002f50  20 20 20 20 20 20 20 20  20 20 6e 6f 6e 65 0a 0a  |          none..|
00002f60  69 73 61 6c 6e 75 6d 28  63 68 61 72 20 63 68 61  |isalnum(char cha|
00002f70  72 61 63 74 65 72 29 20  20 20 20 20 20 20 20 20  |racter)         |
00002f80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002f90  20 20 20 20 20 20 20 69  6e 74 20 74 72 75 65 5f  |       int true_|
00002fa0  6f 72 5f 66 61 6c 73 65  0a 69 73 61 6c 70 68 61  |or_false.isalpha|
00002fb0  28 63 68 61 72 20 63 68  61 72 61 63 74 65 72 29  |(char character)|
00002fc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002fe0  69 6e 74 20 74 72 75 65  5f 6f 72 5f 66 61 6c 73  |int true_or_fals|
00002ff0  65 0a 69 73 63 6e 74 72  6c 28 63 68 61 72 20 63  |e.iscntrl(char c|
00003000  68 61 72 61 63 74 65 72  29 20 20 20 20 20 20 20  |haracter)       |
00003010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003020  20 20 20 20 20 20 20 20  20 69 6e 74 20 74 72 75  |         int tru|
00003030  65 5f 6f 72 5f 66 61 6c  73 65 0a 69 73 64 69 67  |e_or_false.isdig|
00003040  69 74 28 63 68 61 72 20  63 68 61 72 61 63 74 65  |it(char characte|
00003050  72 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r)              |
00003060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003070  20 20 69 6e 74 20 74 72  75 65 5f 6f 72 5f 66 61  |  int true_or_fa|
00003080  6c 73 65 0a 69 73 67 72  61 70 68 28 63 68 61 72  |lse.isgraph(char|
00003090  20 63 68 61 72 61 63 74  65 72 29 20 20 20 20 20  | character)     |
000030a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000030b0  20 20 20 20 20 20 20 20  20 20 20 69 6e 74 20 74  |           int t|
000030c0  72 75 65 5f 6f 72 5f 66  61 6c 73 65 0a 69 73 6c  |rue_or_false.isl|
000030d0  6f 77 65 72 28 63 68 61  72 20 63 68 61 72 61 63  |ower(char charac|
000030e0  74 65 72 29 20 20 20 20  20 20 20 20 20 20 20 20  |ter)            |
000030f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003100  20 20 20 20 69 6e 74 20  74 72 75 65 5f 6f 72 5f  |    int true_or_|
00003110  66 61 6c 73 65 0a 69 73  70 72 69 6e 74 28 63 68  |false.isprint(ch|
00003120  61 72 20 63 68 61 72 61  63 74 65 72 29 20 20 20  |ar character)   |
00003130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003140  20 20 20 20 20 20 20 20  20 20 20 20 20 69 6e 74  |             int|
00003150  20 74 72 75 65 5f 6f 72  5f 66 61 6c 73 65 0a 69  | true_or_false.i|
00003160  73 70 75 6e 63 74 28 63  68 61 72 20 63 68 61 72  |spunct(char char|
00003170  61 63 74 65 72 29 20 20  20 20 20 20 20 20 20 20  |acter)          |
00003180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003190  20 20 20 20 20 20 69 6e  74 20 74 72 75 65 5f 6f  |      int true_o|
000031a0  72 5f 66 61 6c 73 65 0a  69 73 73 70 61 63 65 28  |r_false.isspace(|
000031b0  63 68 61 72 20 63 68 61  72 61 63 74 65 72 29 20  |char character) |
000031c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000031d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 69  |               i|
000031e0  6e 74 20 74 72 75 65 5f  6f 72 5f 66 61 6c 73 65  |nt true_or_false|
000031f0  0a 69 73 75 70 70 65 72  28 63 68 61 72 20 63 68  |.isupper(char ch|
00003200  61 72 61 63 74 65 72 29  20 20 20 20 20 20 20 20  |aracter)        |
00003210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003220  20 20 20 20 20 20 20 20  69 6e 74 20 74 72 75 65  |        int true|
00003230  5f 6f 72 5f 66 61 6c 73  65 0a 69 73 78 64 69 67  |_or_false.isxdig|
00003240  69 74 28 63 68 61 72 20  63 68 61 72 61 63 74 65  |it(char characte|
00003250  72 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r)              |
00003260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003270  20 69 6e 74 20 74 72 75  65 5f 6f 72 5f 66 61 6c  | int true_or_fal|
00003280  73 65 0a 74 6f 6c 6f 77  65 72 28 63 68 61 72 20  |se.tolower(char |
00003290  63 68 61 72 61 63 74 65  72 29 20 20 20 20 20 20  |character)      |
000032a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000032b0  20 20 20 20 20 20 20 20  20 20 63 68 61 72 20 63  |          char c|
000032c0  68 61 72 61 63 74 65 72  0a 74 6f 75 70 70 65 72  |haracter.toupper|
000032d0  28 63 68 61 72 20 63 68  61 72 61 63 74 65 72 29  |(char character)|
000032e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003300  63 68 61 72 20 63 68 61  72 61 63 74 65 72 0a 0a  |char character..|
00003310  72 65 6d 6f 76 65 28 63  68 61 72 20 2a 66 6e 61  |remove(char *fna|
00003320  6d 65 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |me)             |
00003330  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003340  20 20 20 20 20 20 20 69  6e 74 20 73 75 63 63 65  |       int succe|
00003350  73 73 5f 66 6c 61 67 0a  72 65 6e 61 6d 65 28 63  |ss_flag.rename(c|
00003360  68 61 72 20 2a 6f 6c 64  2c 20 63 68 61 72 20 2a  |har *old, char *|
00003370  6e 65 77 29 20 20 20 20  20 20 20 20 20 20 20 20  |new)            |
00003380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 69  |               i|
00003390  6e 74 20 73 75 63 63 65  73 73 5f 66 6c 61 67 0a  |nt success_flag.|
000033a0  74 6d 70 66 69 6c 65 28  29 20 20 20 20 20 20 20  |tmpfile()       |
000033b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000033d0  20 20 20 20 20 20 20 69  6e 74 20 66 69 6c 65 5f  |       int file_|
000033e0  68 61 6e 64 6c 65 0a 74  6d 70 6e 61 6d 65 28 63  |handle.tmpname(c|
000033f0  68 61 72 20 2a 72 65 73  75 6c 74 29 20 20 20 20  |har *result)    |
00003400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003410  20 20 20 20 20 20 20 20  20 20 20 20 20 20 63 68  |              ch|
00003420  61 72 20 66 6e 61 6d 65  0a 66 63 6c 6f 73 65 28  |ar fname.fclose(|
00003430  69 6e 74 20 66 69 6c 65  5f 68 61 6e 64 6c 65 29  |int file_handle)|
00003440  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003460  69 6e 74 20 73 75 63 63  65 73 73 5f 66 6c 61 67  |int success_flag|
00003470  0a 66 66 6c 75 73 68 28  69 6e 74 20 66 69 6c 65  |.fflush(int file|
00003480  5f 68 61 6e 64 6c 65 29  20 20 20 20 20 20 20 20  |_handle)        |
00003490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000034a0  20 20 20 20 20 20 20 20  69 6e 74 20 45 4f 46 5f  |        int EOF_|
000034b0  66 6c 61 67 0a 66 6f 70  65 6e 28 63 68 61 72 20  |flag.fopen(char |
000034c0  2a 66 6e 61 6d 65 2c 20  63 68 61 72 20 2a 6d 6f  |*fname, char *mo|
000034d0  64 65 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |de)             |
000034e0  20 20 20 20 20 20 20 20  20 20 20 20 69 6e 74 20  |            int |
000034f0  66 69 6c 65 5f 68 61 6e  64 6c 65 0a 66 72 65 6f  |file_handle.freo|
00003500  70 65 6e 28 63 68 61 72  20 2a 66 6e 61 6d 65 2c  |pen(char *fname,|
00003510  20 63 68 61 72 20 2a 6d  6f 64 65 2c 20 69 6e 74  | char *mode, int|
00003520  20 66 69 6c 65 5f 68 61  6e 64 6c 65 29 20 20 20  | file_handle)   |
00003530  20 20 20 69 6e 74 20 66  69 6c 65 5f 68 61 6e 64  |   int file_hand|
00003540  6c 65 0a 73 65 74 62 75  66 28 69 6e 74 20 66 69  |le.setbuf(int fi|
00003550  6c 65 5f 68 61 6e 64 6c  65 2c 20 63 68 61 72 20  |le_handle, char |
00003560  2a 62 75 66 29 20 20 20  20 20 20 20 20 20 20 20  |*buf)           |
00003570  20 20 20 20 20 20 20 20  20 20 6e 6f 6e 65 0a 73  |          none.s|
00003580  65 74 76 62 75 66 28 69  6e 74 20 66 69 6c 65 5f  |etvbuf(int file_|
00003590  68 61 6e 64 6c 65 2c 63  68 61 72 20 2a 62 75 66  |handle,char *buf|
000035a0  2c 20 69 6e 74 20 6d 6f  64 65 2c 69 6e 74 20 73  |, int mode,int s|
000035b0  69 7a 65 29 20 20 69 6e  74 20 73 75 63 63 65 73  |ize)  int succes|
000035c0  73 5f 66 6c 61 67 0a 66  70 72 69 6e 74 66 28 69  |s_flag.fprintf(i|
000035d0  6e 74 20 66 69 6c 65 5f  68 61 6e 64 6c 65 2c 20  |nt file_handle, |
000035e0  63 68 61 72 20 2a 66 6f  72 6d 61 74 2c 20 2e 2e  |char *format, ..|
000035f0  2e 29 20 20 20 20 20 20  20 20 20 20 20 20 69 6e  |.)            in|
00003600  74 20 6e 75 6d 5f 63 68  61 72 73 0a 70 72 69 6e  |t num_chars.prin|
00003610  74 66 28 63 68 61 72 20  2a 66 6f 72 6d 61 74 2c  |tf(char *format,|
00003620  20 2e 2e 2e 29 20 20 20  20 20 20 20 20 20 20 20  | ...)           |
00003630  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003640  20 20 20 69 6e 74 20 6e  75 6d 5f 63 68 61 72 73  |   int num_chars|
00003650  0a 73 70 72 69 6e 74 66  28 63 68 61 72 20 2a 73  |.sprintf(char *s|
00003660  74 72 69 6e 67 2c 20 63  68 61 72 20 2a 66 6f 72  |tring, char *for|
00003670  6d 61 74 2c 20 2e 2e 2e  29 20 20 20 20 20 20 20  |mat, ...)       |
00003680  20 20 20 20 20 20 20 20  69 6e 74 20 6e 75 6d 5f  |        int num_|
00003690  63 68 61 72 73 0a 66 73  63 61 6e 66 28 69 6e 74  |chars.fscanf(int|
000036a0  20 66 69 6c 65 5f 68 61  6e 64 6c 65 2c 20 63 68  | file_handle, ch|
000036b0  61 72 20 2a 66 6f 72 6d  61 74 2c 20 2e 2e 2e 29  |ar *format, ...)|
000036c0  20 20 20 20 20 20 20 20  20 20 20 20 20 69 6e 74  |             int|
000036d0  20 6e 75 6d 5f 69 74 65  6d 73 0a 73 63 61 6e 66  | num_items.scanf|
000036e0  28 63 68 61 72 20 2a 66  6f 72 6d 61 74 2c 20 2e  |(char *format, .|
000036f0  2e 2e 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |..)             |
00003700  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003710  20 20 69 6e 74 20 6e 75  6d 5f 69 74 65 6d 73 0a  |  int num_items.|
00003720  73 73 63 61 6e 66 28 63  68 61 72 20 2a 73 74 72  |sscanf(char *str|
00003730  69 6e 67 2c 20 63 68 61  72 20 2a 66 6f 72 6d 61  |ing, char *forma|
00003740  74 2c 20 2e 2e 2e 29 20  20 20 20 20 20 20 20 20  |t, ...)         |
00003750  20 20 20 20 20 20 20 69  6e 74 20 6e 75 6d 5f 69  |       int num_i|
00003760  74 65 6d 73 0a 66 67 65  74 63 28 69 6e 74 20 66  |tems.fgetc(int f|
00003770  69 6c 65 5f 68 61 6e 64  6c 65 29 20 20 20 20 20  |ile_handle)     |
00003780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003790  20 20 20 20 20 20 20 20  20 20 20 20 63 68 61 72  |            char|
000037a0  20 63 68 61 72 61 63 74  65 72 0a 66 67 65 74 73  | character.fgets|
000037b0  28 63 68 61 72 20 2a 62  75 66 2c 20 69 6e 74 20  |(char *buf, int |
000037c0  62 75 66 5f 73 69 7a 65  2c 20 69 6e 74 20 66 69  |buf_size, int fi|
000037d0  6c 65 5f 68 61 6e 64 6c  65 29 20 20 20 20 20 20  |le_handle)      |
000037e0  20 20 63 68 61 72 20 2a  73 74 72 69 6e 67 0a 66  |  char *string.f|
000037f0  70 75 74 63 28 63 68 61  72 20 63 68 61 72 61 63  |putc(char charac|
00003800  74 65 72 2c 20 69 6e 74  20 66 69 6c 65 5f 68 61  |ter, int file_ha|
00003810  6e 64 6c 65 29 20 20 20  20 20 20 20 20 20 20 20  |ndle)           |
00003820  20 20 20 20 20 20 69 6e  74 20 45 4f 46 5f 66 6c  |      int EOF_fl|
00003830  61 67 0a 66 70 75 74 73  28 63 68 61 72 20 2a 73  |ag.fputs(char *s|
00003840  74 72 69 6e 67 2c 20 69  6e 74 20 66 69 6c 65 5f  |tring, int file_|
00003850  68 61 6e 64 6c 65 29 20  20 20 20 20 20 20 20 20  |handle)         |
00003860  20 20 20 20 20 20 20 20  20 20 69 6e 74 20 45 4f  |          int EO|
00003870  46 5f 66 6c 61 67 0a 67  65 74 63 28 69 6e 74 20  |F_flag.getc(int |
00003880  66 69 6c 65 5f 68 61 6e  64 6c 65 29 20 20 20 20  |file_handle)    |
00003890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000038a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 63 68  |              ch|
000038b0  61 72 20 63 68 61 72 61  63 74 65 72 0a 67 65 74  |ar character.get|
000038c0  63 68 61 72 28 29 20 20  20 20 20 20 20 20 20 20  |char()          |
000038d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000038f0  20 20 20 20 63 68 61 72  20 63 68 61 72 61 63 74  |    char charact|
00003900  65 72 0a 67 65 74 73 28  63 68 61 72 20 2a 62 75  |er.gets(char *bu|
00003910  66 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |f)              |
00003920  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003930  20 20 20 20 20 20 20 20  20 20 63 68 61 72 20 2a  |          char *|
00003940  73 74 72 69 6e 67 0a 70  75 74 63 28 63 68 61 72  |string.putc(char|
00003950  20 63 68 61 72 61 63 74  65 72 2c 20 69 6e 74 20  | character, int |
00003960  66 69 6c 65 5f 68 61 6e  64 6c 65 29 20 20 20 20  |file_handle)    |
00003970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 69 6e  |              in|
00003980  74 20 45 4f 46 5f 66 6c  61 67 0a 70 75 74 63 68  |t EOF_flag.putch|
00003990  61 72 28 63 68 61 72 20  63 68 61 72 61 63 74 65  |ar(char characte|
000039a0  72 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r)              |
000039b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000039c0  20 20 69 6e 74 20 45 4f  46 5f 66 6c 61 67 0a 70  |  int EOF_flag.p|
000039d0  75 74 73 28 63 68 61 72  20 2a 73 74 72 69 6e 67  |uts(char *string|
000039e0  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
000039f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003a00  20 20 20 20 20 20 69 6e  74 20 45 4f 46 5f 66 6c  |      int EOF_fl|
00003a10  61 67 0a 75 6e 67 65 74  63 28 63 68 61 72 20 63  |ag.ungetc(char c|
00003a20  68 61 72 61 63 74 65 72  2c 20 69 6e 74 20 66 69  |haracter, int fi|
00003a30  6c 65 5f 68 61 6e 64 6c  65 29 20 20 20 20 20 20  |le_handle)      |
00003a40  20 20 20 20 20 20 20 20  20 20 69 6e 74 20 45 4f  |          int EO|
00003a50  46 5f 66 6c 61 67 0a 66  72 65 61 64 28 69 6e 74  |F_flag.fread(int|
00003a60  20 2a 70 74 72 2c 20 69  6e 74 20 73 69 7a 65 2c  | *ptr, int size,|
00003a70  20 69 6e 74 20 6e 75 6d  2c 20 69 6e 74 20 66 69  | int num, int fi|
00003a80  6c 65 5f 68 61 6e 64 6c  65 29 20 20 20 20 69 6e  |le_handle)    in|
00003a90  74 20 6e 75 6d 5f 72 65  61 64 0a 66 77 72 69 74  |t num_read.fwrit|
00003aa0  65 28 69 6e 74 20 2a 70  74 72 2c 20 69 6e 74 20  |e(int *ptr, int |
00003ab0  73 69 7a 65 2c 20 69 6e  74 20 6e 75 6d 2c 20 69  |size, int num, i|
00003ac0  6e 74 20 66 69 6c 65 5f  68 61 6e 64 6c 65 29 20  |nt file_handle) |
00003ad0  20 20 69 6e 74 20 6e 75  6d 5f 77 72 69 74 65 0a  |  int num_write.|
00003ae0  66 67 65 74 70 6f 73 28  69 6e 74 20 66 69 6c 65  |fgetpos(int file|
00003af0  5f 68 61 6e 64 6c 65 2c  20 69 6e 74 20 2a 70 6f  |_handle, int *po|
00003b00  73 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s)              |
00003b10  20 20 20 20 20 20 20 69  6e 74 20 73 75 63 63 65  |       int succe|
00003b20  73 73 5f 66 6c 61 67 0a  66 73 65 65 6b 28 69 6e  |ss_flag.fseek(in|
00003b30  74 20 66 69 6c 65 5f 68  61 6e 64 6c 65 2c 20 69  |t file_handle, i|
00003b40  6e 74 20 6f 66 66 73 65  74 2c 20 69 6e 74 20 77  |nt offset, int w|
00003b50  68 65 6e 63 65 29 20 20  20 20 20 20 20 20 20 69  |hence)         i|
00003b60  6e 74 20 73 75 63 63 65  73 73 5f 66 6c 61 67 0a  |nt success_flag.|
00003b70  66 73 65 74 70 6f 73 28  69 6e 74 20 66 69 6c 65  |fsetpos(int file|
00003b80  5f 68 61 6e 64 6c 65 2c  20 69 6e 74 20 2a 70 6f  |_handle, int *po|
00003b90  73 29 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s)              |
00003ba0  20 20 20 20 20 20 20 69  6e 74 20 73 75 63 63 65  |       int succe|
00003bb0  73 73 5f 66 6c 61 67 0a  66 74 65 6c 6c 28 69 6e  |ss_flag.ftell(in|
00003bc0  74 20 66 69 6c 65 5f 68  61 6e 64 6c 65 29 20 20  |t file_handle)  |
00003bd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003be0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 69  |               i|
00003bf0  6e 74 20 66 69 6c 65 5f  70 6f 73 0a 72 65 77 69  |nt file_pos.rewi|
00003c00  6e 64 28 69 6e 74 20 66  69 6c 65 5f 68 61 6e 64  |nd(int file_hand|
00003c10  6c 65 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |le)             |
00003c20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003c30  20 20 20 6e 6f 6e 65 0a  63 6c 65 61 72 65 72 72  |   none.clearerr|
00003c40  28 69 6e 74 20 66 69 6c  65 5f 68 61 6e 64 6c 65  |(int file_handle|
00003c50  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00003c60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6e  |               n|
00003c70  6f 6e 65 0a 66 65 6f 66  28 69 6e 74 20 66 69 6c  |one.feof(int fil|
00003c80  65 5f 68 61 6e 64 6c 65  29 20 20 20 20 20 20 20  |e_handle)       |
00003c90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ca0  20 20 20 20 20 20 20 20  20 20 20 69 6e 74 20 45  |           int E|
00003cb0  4f 46 5f 66 6c 61 67 0a  66 65 72 72 6f 72 28 69  |OF_flag.ferror(i|
00003cc0  6e 74 20 66 69 6c 65 5f  68 61 6e 64 6c 65 29 20  |nt file_handle) |
00003cd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ce0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 69  |               i|
00003cf0  6e 74 20 65 72 72 5f 66  6c 61 67 3b 0a 70 65 72  |nt err_flag;.per|
00003d00  72 6f 72 28 63 68 61 72  20 2a 73 74 72 69 6e 67  |ror(char *string|
00003d10  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00003d20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003d30  20 20 20 20 6e 6f 6e 65  0a 0a 61 74 6f 69 28 63  |    none..atoi(c|
00003d40  68 61 72 20 2a 73 74 72  69 6e 67 29 20 20 20 20  |har *string)    |
00003d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003d70  20 69 6e 74 20 69 6e 74  5f 76 61 6c 75 65 0a 61  | int int_value.a|
00003d80  74 6f 6c 28 63 68 61 72  20 2a 73 74 72 69 6e 67  |tol(char *string|
00003d90  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00003da0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003db0  20 20 20 20 20 20 69 6e  74 20 69 6e 74 5f 76 61  |      int int_va|
00003dc0  6c 75 65 0a 72 61 6e 64  28 29 20 20 20 20 20 20  |lue.rand()      |
00003dd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003df0  20 20 20 20 20 20 20 20  20 20 20 69 6e 74 20 72  |           int r|
00003e00  61 6e 64 5f 76 61 6c 75  65 0a 73 72 61 6e 64 28  |and_value.srand(|
00003e10  69 6e 74 20 73 65 65 64  29 20 20 20 20 20 20 20  |int seed)       |
00003e20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003e40  20 6e 6f 6e 65 0a 6d 61  6c 6c 6f 63 28 69 6e 74  | none.malloc(int|
00003e50  20 73 69 7a 65 29 20 20  20 20 20 20 20 20 20 20  | size)          |
00003e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003e70  20 20 20 20 20 20 20 20  20 20 20 20 20 69 6e 74  |             int|
00003e80  20 2a 70 74 72 0a 63 61  6c 6c 6f 63 28 69 6e 74  | *ptr.calloc(int|
00003e90  20 6e 75 6d 2c 20 69 6e  74 20 73 69 7a 65 29 20  | num, int size) |
00003ea0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 69 6e 74  |             int|
00003ec0  20 2a 70 74 72 0a 72 65  61 6c 6c 6f 63 28 69 6e  | *ptr.realloc(in|
00003ed0  74 20 2a 70 74 72 2c 20  69 6e 74 20 73 69 7a 65  |t *ptr, int size|
00003ee0  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00003ef0  20 20 20 20 20 20 20 20  20 20 20 20 20 69 6e 74  |             int|
00003f00  20 2a 70 74 72 0a 66 72  65 65 28 69 6e 74 20 2a  | *ptr.free(int *|
00003f10  70 74 72 29 20 20 20 20  20 20 20 20 20 20 20 20  |ptr)            |
00003f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003f30  20 20 20 20 20 20 20 20  20 20 20 20 20 6e 6f 6e  |             non|
00003f40  65 0a 73 79 73 74 65 6d  28 63 68 61 72 20 2a 63  |e.system(char *c|
00003f50  6f 6d 6d 61 6e 64 29 20  20 20 20 20 20 20 20 20  |ommand)         |
00003f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003f70  20 20 20 20 20 20 20 20  20 69 6e 74 20 73 75 63  |         int suc|
00003f80  63 65 73 73 5f 76 61 6c  75 65 0a 67 65 74 65 6e  |cess_value.geten|
00003f90  76 28 63 68 61 72 20 2a  6e 61 6d 65 29 20 20 20  |v(char *name)   |
00003fa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003fc0  20 20 63 68 61 72 20 2a  72 65 73 75 6c 74 0a 61  |  char *result.a|
00003fd0  62 73 28 69 6e 74 20 6e  75 6d 29 20 20 20 20 20  |bs(int num)     |
00003fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004000  20 20 20 20 20 20 69 6e  74 20 72 65 73 75 6c 74  |      int result|
00004010  0a 63 6c 6f 63 6b 28 29  20 20 20 20 20 20 20 20  |.clock()        |
00004020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004040  20 20 20 20 20 20 20 20  69 6e 74 20 74 69 6d 65  |        int time|
00004050  0a 0a 6d 65 6d 73 65 74  28 69 6e 74 20 2a 70 74  |..memset(int *pt|
00004060  72 2c 20 63 68 61 72 20  63 68 61 72 61 63 74 65  |r, char characte|
00004070  72 2c 20 69 6e 74 20 73  69 7a 65 29 20 20 20 20  |r, int size)    |
00004080  20 20 20 20 20 20 20 20  20 6e 6f 6e 65 0a 6d 65  |         none.me|
00004090  6d 63 68 72 28 63 68 61  72 20 2a 73 74 72 69 6e  |mchr(char *strin|
000040a0  67 2c 20 63 68 61 72 20  63 68 61 72 61 63 74 65  |g, char characte|
000040b0  72 2c 20 69 6e 74 20 73  69 7a 65 29 20 20 20 20  |r, int size)    |
000040c0  20 20 20 20 20 69 6e 74  20 2a 70 74 72 0a 6d 65  |     int *ptr.me|
000040d0  6d 63 6d 70 28 69 6e 74  20 2a 70 74 72 31 2c 20  |mcmp(int *ptr1, |
000040e0  69 6e 74 20 2a 70 74 72  32 2c 20 69 6e 74 20 73  |int *ptr2, int s|
000040f0  69 7a 65 29 20 20 20 20  20 20 20 20 20 20 20 20  |ize)            |
00004100  20 20 20 20 20 69 6e 74  20 73 61 6d 65 5f 66 6c  |     int same_fl|
00004110  61 67 0a 6d 65 6d 6d 6f  76 65 28 69 6e 74 20 2a  |ag.memmove(int *|
00004120  70 74 72 31 2c 20 69 6e  74 20 2a 70 74 72 32 2c  |ptr1, int *ptr2,|
00004130  20 69 6e 74 20 73 69 7a  65 29 20 20 20 20 20 20  | int size)      |
00004140  20 20 20 20 20 20 20 20  20 20 69 6e 74 20 2a 70  |          int *p|
00004150  74 72 31 0a 6d 65 6d 63  70 79 28 69 6e 74 20 2a  |tr1.memcpy(int *|
00004160  70 74 72 31 2c 20 69 6e  74 20 2a 70 74 72 32 2c  |ptr1, int *ptr2,|
00004170  20 69 6e 74 20 73 69 7a  65 29 20 20 20 20 20 20  | int size)      |
00004180  20 20 20 20 20 20 20 20  20 20 20 69 6e 74 20 2a  |           int *|
00004190  70 74 72 31 0a 73 74 72  74 6f 6b 28 63 68 61 72  |ptr1.strtok(char|
000041a0  20 2a 73 74 72 69 6e 67  31 2c 20 63 68 61 72 20  | *string1, char |
000041b0  2a 73 74 72 69 6e 67 32  29 20 20 20 20 20 20 20  |*string2)       |
000041c0  20 20 20 20 20 20 20 20  20 20 20 20 63 68 61 72  |            char|
000041d0  20 2a 72 65 73 75 6c 74  0a 73 74 72 73 74 72 28  | *result.strstr(|
000041e0  63 68 61 72 20 2a 73 74  72 69 6e 67 31 2c 20 63  |char *string1, c|
000041f0  68 61 72 20 2a 73 74 72  69 6e 67 32 29 20 20 20  |har *string2)   |
00004200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004210  63 68 61 72 20 2a 72 65  73 75 6c 74 0a 73 74 72  |char *result.str|
00004220  73 70 6e 28 63 68 61 72  20 2a 73 74 72 69 6e 67  |spn(char *string|
00004230  31 2c 20 63 68 61 72 20  2a 73 74 72 69 6e 67 32  |1, char *string2|
00004240  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00004250  20 20 20 20 69 6e 74 20  73 69 7a 65 0a 73 74 72  |    int size.str|
00004260  63 68 72 28 63 68 61 72  20 2a 73 74 72 69 6e 67  |chr(char *string|
00004270  2c 20 63 68 61 72 20 63  68 61 72 61 63 74 65 72  |, char character|
00004280  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00004290  20 20 20 20 63 68 61 72  20 2a 72 65 73 75 6c 74  |    char *result|
000042a0  0a 73 74 72 70 62 72 6b  28 63 68 61 72 20 2a 73  |.strpbrk(char *s|
000042b0  74 72 69 6e 67 31 2c 20  63 68 61 72 20 2a 73 74  |tring1, char *st|
000042c0  72 69 6e 67 32 29 20 20  20 20 20 20 20 20 20 20  |ring2)          |
000042d0  20 20 20 20 20 20 20 20  63 68 61 72 20 2a 72 65  |        char *re|
000042e0  73 75 6c 74 0a 73 74 72  63 73 70 6e 28 63 68 61  |sult.strcspn(cha|
000042f0  72 20 2a 73 74 72 69 6e  67 31 2c 20 63 68 61 72  |r *string1, char|
00004300  20 2a 73 74 72 69 6e 67  32 29 20 20 20 20 20 20  | *string2)      |
00004310  20 20 20 20 20 20 20 20  20 20 20 20 69 6e 74 20  |            int |
00004320  73 69 7a 65 0a 73 74 72  72 63 68 72 28 63 68 61  |size.strrchr(cha|
00004330  72 20 2a 73 74 72 69 6e  67 2c 20 63 68 61 72 20  |r *string, char |
00004340  63 68 61 72 61 63 74 65  72 29 20 20 20 20 20 20  |character)      |
00004350  20 20 20 20 20 20 20 20  20 20 20 20 63 68 61 72  |            char|
00004360  20 2a 72 65 73 75 6c 74  0a 73 74 72 63 66 72 6d  | *result.strcfrm|
00004370  28 63 68 61 72 20 2a 73  74 72 69 6e 67 31 2c 20  |(char *string1, |
00004380  63 68 61 72 20 2a 73 74  72 69 6e 67 32 2c 20 69  |char *string2, i|
00004390  6e 74 20 6e 75 6d 29 20  20 20 20 20 20 20 20 20  |nt num)         |
000043a0  69 6e 74 20 73 69 7a 65  0a 73 74 72 63 6f 6c 6c  |int size.strcoll|
000043b0  28 63 68 61 72 20 2a 73  74 72 69 6e 67 31 2c 20  |(char *string1, |
000043c0  63 68 61 72 20 2a 73 74  72 69 6e 67 32 29 20 20  |char *string2)  |
000043d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000043e0  69 6e 74 20 72 65 73 75  6c 74 0a 73 74 72 6e 63  |int result.strnc|
000043f0  6d 70 28 63 68 61 72 20  2a 73 74 72 69 6e 67 31  |mp(char *string1|
00004400  2c 20 63 68 61 72 20 2a  73 74 72 69 6e 67 32 2c  |, char *string2,|
00004410  20 69 6e 74 20 6e 75 6d  29 20 20 20 20 20 20 20  | int num)       |
00004420  20 20 69 6e 74 20 72 65  73 75 6c 74 0a 73 74 72  |  int result.str|
00004430  63 6d 70 28 63 68 61 72  20 2a 73 74 72 69 6e 67  |cmp(char *string|
00004440  31 2c 20 63 68 61 72 20  2a 73 74 72 69 6e 67 32  |1, char *string2|
00004450  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
00004460  20 20 20 20 69 6e 74 20  72 65 73 75 6c 74 0a 73  |    int result.s|
00004470  74 72 6e 63 61 74 28 63  68 61 72 20 2a 73 74 72  |trncat(char *str|
00004480  69 6e 67 31 2c 20 63 68  61 72 20 2a 73 74 72 69  |ing1, char *stri|
00004490  6e 67 32 2c 20 69 6e 74  20 6e 75 6d 29 20 20 20  |ng2, int num)   |
000044a0  20 20 20 20 20 20 63 68  61 72 20 2a 72 65 73 75  |      char *resu|
000044b0  6c 74 0a 73 74 72 63 61  74 28 63 68 61 72 20 2a  |lt.strcat(char *|
000044c0  73 74 72 69 6e 67 31 2c  20 63 68 61 72 20 2a 73  |string1, char *s|
000044d0  74 72 69 6e 67 32 29 20  20 20 20 20 20 20 20 20  |tring2)         |
000044e0  20 20 20 20 20 20 20 20  20 20 63 68 61 72 20 2a  |          char *|
000044f0  72 65 73 75 6c 74 0a 73  74 72 6e 63 70 79 28 63  |result.strncpy(c|
00004500  68 61 72 20 2a 73 74 72  69 6e 67 31 2c 20 63 68  |har *string1, ch|
00004510  61 72 20 2a 73 74 72 69  6e 67 32 2c 20 69 6e 74  |ar *string2, int|
00004520  20 6e 75 6d 29 20 20 20  20 20 20 20 20 20 63 68  | num)         ch|
00004530  61 72 20 2a 72 65 73 75  6c 74 0a 73 74 72 63 70  |ar *result.strcp|
00004540  79 28 63 68 61 72 20 2a  73 74 72 69 6e 67 31 2c  |y(char *string1,|
00004550  20 63 68 61 72 20 2a 73  74 72 69 6e 67 32 29 20  | char *string2) |
00004560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004570  20 20 63 68 61 72 20 2a  72 65 73 75 6c 74 0a 0a  |  char *result..|
00004580  6f 73 5f 73 77 69 28 69  6e 74 20 2a 72 65 67 73  |os_swi(int *regs|
00004590  5b 5d 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |[])             |
000045a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000045b0  20 20 20 20 20 20 20 6e  6f 6e 65 0a 0a 46 6f 72  |       none..For|
000045c0  20 64 65 74 61 69 6c 65  64 20 64 65 73 63 72 69  | detailed descri|
000045d0  70 74 69 6f 6e 73 20 6f  66 20 74 68 65 73 65 20  |ptions of these |
000045e0  66 75 6e 63 74 69 6f 6e  73 20 72 65 66 65 72 20  |functions refer |
000045f0  74 6f 20 74 68 65 20 42  42 43 20 42 61 73 69 63  |to the BBC Basic|
00004600  0a 47 75 69 64 65 20 61  6e 64 20 61 6e 79 20 62  |.Guide and any b|
00004610  61 73 69 63 20 43 20 74  75 74 6f 72 69 61 6c 20  |asic C tutorial |
00004620  67 75 69 64 65 2e 0a 0a  0a 54 65 63 68 6e 69 63  |guide....Technic|
00004630  61 6c 20 53 75 70 70 6f  72 74 0a 2d 2d 2d 2d 2d  |al Support.-----|
00004640  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 0a 54 68  |------------..Th|
00004650  65 20 53 65 72 69 61 6c  20 50 6f 72 74 20 72 65  |e Serial Port re|
00004660  67 72 65 74 20 74 68 61  74 20 74 68 65 79 20 63  |gret that they c|
00004670  61 6e 6e 6f 74 20 70 72  6f 76 69 64 65 20 74 65  |annot provide te|
00004680  63 68 6e 69 63 61 6c 20  73 75 70 70 6f 72 74 20  |chnical support |
00004690  66 6f 72 0a 74 68 69 73  20 66 72 65 65 77 61 72  |for.this freewar|
000046a0  65 20 70 72 6f 67 72 61  6d 2e 20 20 54 68 65 20  |e program.  The |
000046b0  61 75 74 68 6f 72 73 20  77 69 6c 6c 20 62 65 20  |authors will be |
000046c0  70 6c 65 61 73 65 64 20  74 6f 20 72 65 63 65 69  |pleased to recei|
000046d0  76 65 20 61 6e 79 0a 62  75 67 20 72 65 70 6f 72  |ve any.bug repor|
000046e0  74 73 20 6f 72 20 63 6f  6d 6d 65 6e 74 73 20 76  |ts or comments v|
000046f0  69 61 20 65 6d 61 69 6c  2c 20 68 6f 77 65 76 65  |ia email, howeve|
00004700  72 2c 20 61 74 20 74 68  65 20 66 6f 6c 6c 6f 77  |r, at the follow|
00004710  69 6e 67 20 61 64 64 72  65 73 73 3a 0a 0a 20 20  |ing address:..  |
00004720  20 20 62 6f 62 40 63 72  79 74 6f 6e 2e 64 65 6d  |  bob@cryton.dem|
00004730  6f 6e 2e 63 6f 2e 75 6b  0a 6f 72 20 20 42 6f 62  |on.co.uk.or  Bob|
00004740  20 56 6f 69 73 65 79 20  28 23 39 29 20 6f 6e 20  | Voisey (#9) on |
00004750  54 68 65 20 57 6f 72 6c  64 20 6f 66 20 43 72 79  |The World of Cry|
00004760  74 6f 6e 20 42 42 53 20  28 32 3a 32 35 32 2f 31  |ton BBS (2:252/1|
00004770  30 32 29 0a                                       |02).|
00004774