home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Pascal / HISOFTPASCAL2,0-2.DMS / in.adf / ReadMe < prev    next >
Encoding:
Text File  |  1992-05-26  |  11.7 KB  |  308 lines

  1.  
  2.     HighSpeed Pascal 1.10
  3.     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  4.     Amiga Units
  5.     ¯¯¯¯¯¯¯¯¯¯¯
  6.  
  7. HighSpeed Pascal now includes units which give access to
  8. all of the structures and library calls introduced in
  9. Release 2 of the operating system.  These units, supplied
  10. on a fourth disk, include a number of new files and form a
  11. complete replacement for the 1.3 set.
  12.  
  13. In addition to this, changes in the units themselves and
  14. disk organisation are documented below.
  15.  
  16.  
  17.     Installation
  18.     ¯¯¯¯¯¯¯¯¯¯¯¯
  19. As shipped, both Program Disks are set up to use the
  20. Workbench 1.3 units.  Due to the increased size of the 2.0
  21. units, a minimum 1.5MB of RAM is recommended for their use.
  22. By following some of the suggestions on page 13 of the User
  23. Manual, 1MB users can also make use of these units.
  24.  
  25. We strongly recommend that those with sufficient RAM switch
  26. to using the up to date Release 2 units, even if running
  27. 1.3.  This avoids you having to change programs later on
  28. should you choose to switch over or add Workbench 2
  29. features.
  30.  
  31. To configure HSPascal to use the new units from floppy
  32. disk, simply use Workbench to drag the HSPascal.prefs and
  33. Pascal.cfg icons from Units Disk 2 into your HSPascal
  34. drawer, replacing the existing ones.
  35.  
  36. To install HighSpeed Pascal on hard disk with the Workbench
  37. 2 units, follow page 10 of the User Manual except that
  38. instead of dragging ALL icons from the Units Disk into your
  39. HSPascal drawer, drag all the icons EXCEPT Pascal.lib and
  40. the Units drawer.  Then drag all of the Units Disk 2 icons
  41. across (replacing the old preferences files and installing
  42. the units) and continue with the installation procedure.
  43.  
  44.  
  45.     The Units Disks
  46.     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  47. The disks now have a slightly differently layout.  Instead
  48. of 'interface' files, complete source for each Amiga unit
  49. is located in the Units drawer so you can now compile them
  50. as required.  The default Pascal.lib contains each unit
  51. plus the Turbo Pascal compatible ones in a compiled form
  52. (also supplied).
  53.  
  54. WARNING: Altering unit source files is not recommended as
  55. they will most certainly change in future versions!
  56.  
  57. There are a number of new functions and procedures in the
  58. Amiga unit although some are for use with Workbench 2 only.
  59. Please refer to the source and ROM Kernel Manuals for
  60. details.
  61.  
  62. The Graphics and Intuition units automatically include
  63. Graphics_2 and Intuition_2 so your program should never
  64. 'use' these extra units directly.  For 2.0 they contain the
  65. unit procedures (and some Intuition compatibility
  66. definitions) whilst the 1.3 versions are empty.  To compile
  67. them you must Make or Build All a program which 'uses'
  68. Graphics or Intuition since these units cannot be compiled
  69. separately.
  70.  
  71. The Extras drawer on the Units Disk contains ARP and
  72. ReqTools library units and the new FileRequest example.
  73. These and the 2.0 IFFParse (originally supplied with 1.00)
  74. and Rexx units are for use with both Workbench 1.3 and 2.0
  75. although some require other 2.0 units.  We suggest that you
  76. use the Extras drawer for any additional third-party units.
  77.  
  78.  
  79.     Conventions
  80.     ¯¯¯¯¯¯¯¯¯¯¯
  81. The conventions used by the Amiga units have changed
  82. slightly to bring them even closer to the standard
  83. Commodore definitions.  Unless you already have programs
  84. using the units, these changes will make little difference
  85. to you although you should be aware of issues such as sign
  86. extension of numbers and C string usage.
  87.  
  88.     Types
  89.  
  90. Unsigned types - the unsigned Byte and Word types are used
  91. instead of ShortInt and Integer where appropriate.  This
  92. can cause subtle problems in existing code where a signed
  93. variable is used to hold what is now an unsigned value.
  94. Always check that you are using the correct type of
  95. variable in such cases, e.g. the im_Code field of an
  96. IntuiMessage is a Word, not an Integer.
  97.  
  98. Unsigned Long type - although the compiler does not support
  99. a true 32-bit unsigned integer type at present, the Exec
  100. type 'Long' is used to indicate these.  This is mainly used
  101. for bit flags which are not affected by signed/unsigned
  102. distinctions but you should be careful when comparing Long
  103. values.
  104.  
  105. New type names - a number of extra Commodore type names
  106. have been added.  The most common ones are BPTR in the
  107. AmigaDOS unit (used for file handles etc.), STRPTR in Exec
  108. for C strings (see below) and PLANEPTR in Graphics.
  109.  
  110. Pointer types - the system units now define 'p' pointer
  111. types for all 't' types, not only the ones which they
  112. themselves use (page 142, Technical Reference Manual).  It
  113. is no longer necessary to place these in your own programs.
  114.  
  115.     Miscellaneous
  116.  
  117. Variant record field names - some names have been changed
  118. to match the preferred C definitions.
  119.  
  120. Strings - contrary to page 143 of the User Manual, the only
  121. operating system functions which take ordinary Pascal
  122. strings are OpenLibrary, OpenDevice and OpenResource.  All
  123. other functions which require a string now expect a STRPTR
  124. which is a pointer to a null-terminated string.  A
  125. discussion on strings can be found at the end of this file.
  126.  
  127. Delay procedure - Delay in the AmigaDOS unit now has a
  128. trailing underscore in its name to avoid confusion with the
  129. built in System unit procedure.  System.Delay works in
  130. 1/1000ths of seconds whilst AmigaDOS.Delay_ uses 1/50ths.
  131.  
  132. CIA unit - all functions and procedures in this unit now
  133. take a pointer to an open CIA resource as their first
  134. parameter.  This is identical to the C behaviour and
  135. replaces the now obsolete CiaBase variable.
  136.  
  137.  
  138.     2.0 Units
  139.     ¯¯¯¯¯¯¯¯¯
  140. With Release 2 of the operating system, most libraries,
  141. devices and resources have undergone major changes.  There
  142. are new functions, procedures and types in the 2.0 units
  143. for things like object oriented gadgets, public screens,
  144. graphics overscan support, AmigaDOS pattern matching, file
  145. notification, record locking, argument parsing, Workbench
  146. AppMessages and more.
  147.  
  148. Some 1.3 procedures (including AmigaDOS Close and
  149. CloseScreen in Intuition) are now functions which return
  150. values.  To compile existing Pascal programs which use
  151. these, you should add dummy variable assignments such as
  152. junk := Close(file).  'Junk' should be Boolean in this
  153. case.  Take care to use the correct type of variable
  154. otherwise a range check error may occur.
  155.  
  156. The supplied demos and units use the WORKBENCH_2
  157. conditional to determine which version of the units is
  158. being used so that they can be compiled with both.
  159.  
  160. Listed below are the additional units supplied as part of
  161. the 2.0 set.  Note that the Workbench and Keymap units,
  162. which contain only type definitions in the 1.3 version, are
  163. now libraries.
  164.  
  165.     New Units
  166.  
  167. ASL - the Application Support Library which provides
  168. standard 2.0 file and font requesters as used by the 2.0
  169. HSPascal editor.  An example of its use can be found in the
  170. FileRequest example in the Extras drawer.
  171.  
  172. BattClock - a resource which provides access to the Amiga's
  173. battery backed clock.
  174.  
  175. BattMem - not intended for general use, the BattMem unit is
  176. used to read and write the small amount of battery backed
  177. RAM present on some machines.
  178.  
  179. Commodities - this is the library which enables
  180. 'commodities' programs such as screen blankers, hotkeys
  181. etc. to be written.  These change system behaviour by
  182. intercepting or translating certain input events.  In
  183. addition to the library routines, the Commodities unit
  184. contains a number of support functions.
  185.  
  186. GadTools - the 2.0 gadget toolkit library allows you to
  187. create and manipulate all the 'new look' 3D gadget types
  188. used by the Prefs editors and HSPascal.  Menu creation and
  189. layout functions are also provided.  GadTools is the
  190. easiest way to give a 2.0 look and feel to your programs.
  191.  
  192. RamDrive - the device which handles recoverable RAM disks.
  193.  
  194. Rexx - also usable from 1.3, this unit provides a Pascal
  195. interface to ARexx, the standard Amiga macro language for
  196. InterProcess Communication.  The rexxsyslib.library
  197. provides most of the ARexx support functions, others form
  198. part of the unit.
  199.  
  200. Utility - contains a collection of useful library functions
  201. including 'tag' and 'hook' manipulation (used by many 2.0
  202. libraries for attribute/value lists and program callbacks),
  203. and various string and arithmetic functions.  The
  204. FileRequest example shows how to use tags in Pascal.
  205.  
  206.  
  207.     C Strings
  208.     ¯¯¯¯¯¯¯¯¯
  209. Many system libraries and structures use null-terminated
  210. strings (called C strings from now on).  Although mentioned
  211. briefly in the manual (page 143, User Manual), this section
  212. is intended to assist you in working with C strings from
  213. Pascal programs.
  214.  
  215. C strings are usually referenced as a pointer to the first
  216. character in the string (although a pointer to any string
  217. character also yields a valid string).  With the exception
  218. of OpenLibrary, OpenDevice and OpenResource which use
  219. regular Pascal strings, all system functions which take
  220. strings use the Exec STRPTR type, although record types
  221. generally use pByte.
  222.  
  223. The CString and pCString types (page 143, Technical
  224. Reference Manual) are no longer present.  It is much easier
  225. and more flexible to instead use the Pascal String type for
  226. both string formats.
  227.  
  228.  
  229. The Pascal units retain the Amiga's use of C strings for
  230. maximum efficiency, to avoid limiting strings to 255
  231. characters, and to make it easy to use strings directly
  232. from system structures.  However, this does mean that
  233. string conversions are often required when mixing Pascal
  234. and operating system functions.
  235.  
  236. One notable exception to this is the Text_ procedure in
  237. Graphics which takes both a pointer and a length.
  238. Text_(@s[1], Ord[s[0]]) is the most efficient method of
  239. passing a Pascal string to this procedure.
  240.  
  241. There are a many different approaches to this problem, the
  242. one you select will depend upon your requirements and what
  243. you feel comfortable with.  Some techniques which we have
  244. found useful are adding #0 to strings, conversion by
  245. copying, single string conversion, 'dual format' strings
  246. and use of C string functions.  More detailed explanations
  247. of these methods follow.  Don't be put off if some seem
  248. rather complicated; they are all doing much the same thing
  249. so you could use any method.
  250.  
  251.  
  252.     Adding #0 To Strings
  253.  
  254. By far the simplest way of creating a C string is to simply
  255. add a zero byte to the end of a Pascal string.  The address
  256. of element 1 can then be used as a STRPTR.  Two examples of
  257. this are:
  258.  
  259.     s := 'tempfile'#0;
  260.     if DeleteFile(@s[1]) then...
  261.  
  262.     win_name := win_name + #0;
  263.     nw.Title := @win_name[1];
  264.  
  265.     Conversion By Copying
  266.  
  267. The Exec unit PasToC and CToPas procedures take a Pascal
  268. String and a C string variable (or vice-versa for CToPas)
  269. and copy the contents of first into the second.  Note that
  270. these C strings are VAR parameters, not pointers.  PtrToPas
  271. in the Amiga unit is a version of CToPas which takes a
  272. STRPTR, ideal for copying strings from system structures.
  273.  
  274.     PasToC('Hello', cstr);    {cstr is a CString var}
  275.     PasToC(s, cstr);    {s is a String variable}
  276.     CToPas(node^.ln_Name^, s);    {note the second ^}
  277.     s := PtrToPas(node^.ln_Name);    {different syntax}
  278.  
  279.     Single String Conversion
  280.  
  281. A slight variation on the above which requires only one
  282. String variable, changing its representation from Pascal to
  283. C format.  This saves you having an extra variable although
  284. you do lose the original Pascal representation.  StringToC
  285. in the Amiga unit works in this way, returning a STRPTR to
  286. the first character for convenience.  Example:
  287.  
  288.     s  := 'tempfile';
  289.     l  := Lock(StringToC(s), ACCESS_READ);
  290.     fh := Open(@s, MODE_OLDFILE);  {can be re-used}
  291.  
  292.     Dual Format Strings
  293.  
  294. Possibly the neatest and most efficient method, this uses
  295. some tricks to make a String variable suitable for BOTH
  296. formats.  NullTerm and MakeString in FileRequest.pas show
  297. how this is done.  The only pitfall is that you must use
  298. these functions each time the string is changed.
  299.  
  300.     C String Functions
  301.  
  302. It is sometimes easier to avoid converting C strings at all
  303. and instead work with them in their existing form.  If you
  304. already know C or assembly language, you may like to try
  305. implementing some of the basic C string manipulation
  306. functions yourself.  An example of strncpy() can be found
  307. in FileRequest.pas.
  308.