home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1996 / ARCHIVE_96.iso / discs / mag_discs / volume_6 / issue_06 / cfrombasic / ReadMe
Text File  |  1993-01-23  |  3KB  |  91 lines

  1.                         C Example by Thomas Down
  2.                       ============================
  3.                       
  4.     This is an example of how to write a (very) simple RISC-OS WIMP
  5. application in C. To use it, simply double click on its icon. Notice that
  6. there is an icon bar menu with info and quit options. When you click on its
  7. icon, a small dialog box opens containing three icons. Try clicking and
  8. typing to see what they do.
  9.  
  10.     To find out how it works, load the c.cexample file into a text editor.
  11. Most commands are explained by comments in the text file, but remember the
  12. following
  13.  
  14. 1. /* ... */ is equivalent to Basic's REM ...
  15.   
  16. 2. C uses a form of block structuring. {and } are used to group
  17.   instructions together. For example, the IF command can be used with one
  18.   conditional instruction:
  19.   
  20.      if(var==1)
  21.        instruction 1
  22.        
  23.   or several:
  24.     
  25.      if (var==1) {1 ;
  26.        ...
  27.        instruction n;
  28.      }
  29.      
  30. 3. C uses semicolons (;) as line terminators after most instructions. The
  31.   exceptions are instructions which are followed by one or more other
  32.   instructions to make a statement e.g. for(), if(), while().
  33.   
  34. 4. In C, the equality condition is '==' instead of Basic's '='. '=' is
  35.   still used for assignment. 
  36.   
  37. -----------------------------------------------------------------------------
  38.  
  39. IF YOU WANT TO RECOMPILE THE PROGRAM
  40.  
  41. ANSI C v4
  42.  
  43. I do not recommend using ANSI C from floppies unless absolutely necessary
  44.  
  45.   Open the 'c' and '!C Example' directory viewers. Now load !CC. To compile
  46. and link, drag the cexample file from the 'c' directory to the !CC icon.
  47. The default options are generally correct so simply click Run. A text
  48. window will open showing progress. Ignore the warning from 'link' about a
  49. memory shortage. When compilation is complete, a save box will appear.
  50. Delete the default name and type in '!RunImage' then drag the icon to the
  51. !C Example directory. This sounds a bit complicated, but very quickly
  52. becomes intuitive.
  53.  
  54. BEEBUG C (v 1.50)
  55.                   
  56. If you are using floppy discs, copy the cexample directory onto your work
  57. disc 
  58.  
  59. 1. Load the editor
  60.  
  61. 2. Check the options are correct. You will need to link with:
  62.          
  63.   Window library
  64.   Event library
  65.   Menu library
  66.   Dialog box library
  67.   Icon library
  68.   Utilities library
  69.   (if in doubt about these, use Complete WIMP)
  70.                   
  71.   OS library
  72.   Sprite library 
  73.   Shared C Library
  74.   
  75.   This is NOT the default configuration, so you MUST change it unless you
  76. have already reconfigured the package.
  77.  
  78. 3. Load c.cexample into the editor
  79.  
  80. 4. Click on the Compile menu option
  81.  
  82. 5. If the compilation is successful, click on the Link menu option
  83.  
  84. 6. In the directory ABOVE the 'c' directory, there should now be an APP
  85. file called cexample. Rename this !RunImage
  86.  
  87. 7. Copy the new !RunImage into the !C Example application directory
  88.  
  89.  
  90.                  
  91.