home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / amigae / stderr.lha / StdErr.DOC < prev    next >
Encoding:
Text File  |  1994-09-06  |  6.9 KB  |  178 lines

  1. StdErr.m
  2. A Standard Error Port for Amiga E by Trey Van Riper (Cheese
  3. Olfactory Workshop).
  4.  
  5. 0. DESCRIPTION
  6.  
  7. StdErr.m provides Amiga E users with an easy-to-use standard
  8. error port for their Amiga E programs.  The module is fairly
  9. intelligent, handling things with a kind of grace and ease
  10. anyone could hope for.  You almost cannot foul the use of
  11. this program module up (almost).
  12.  
  13. 1. HOW TO USE
  14.  
  15. Firstly, you need Amiga E v3.0 or greater (since this IS a
  16. module).  Then, of course, you need an Amiga, and an idea
  17. for a program you want to write.
  18.  
  19. At the end of your PROC main(), make sure you call
  20. 'err_Dispose()' so you'll free up anything that StdErr might
  21. have opened up (files, for example).  It's at this time that
  22. Workbench progs will also get their little prompt saying to
  23. press RETURN to close the error window (if appropriate).
  24.  
  25. Then, whenever your program seems to have found an error,
  26. call 'err_WriteF()' (more details coming up).  There is one
  27. minor caveat, though... there are three kinds of errors
  28. StdErr might come up with on its own... "OPEN", "FILE", and
  29. "MEM".  These errors come up as exceptions, so I would
  30. advise against using StdErr in EXCEPT handling, unless you
  31. know what you're doing.
  32.  
  33. Of course, I wasn't satisfied to have StdErr work TOO
  34. simply.. so I gave it so many bells and whistles that you
  35. won't WANT to use anything else.  This module should be
  36. included in every program you write, it's so simple to use.
  37.  
  38. Here's some details:
  39.  
  40. 1.1. PROC err_New(filename=NIL)
  41.  
  42. This PROC allows you to direct errors to a particular file.
  43. If 'filename' is 0, the stderr port is used (CONSOLE:, for
  44. the curious).  If 'filename' := stdout, further error
  45. reports are put to stdout.  If 'filename' is a pointer to
  46. text, the file of that name will be created (if there's an
  47. error), and text will be appended to it.
  48.  
  49. If no arguments are passed to err_New(), 'filename' will be
  50. assumed to be 0.
  51.  
  52. 1.2. PROC err_Name(program_name)
  53.  
  54. This PROC lets you change which name StdErr calls your
  55. program by.  This is used for stderr output to a file, and
  56. for Fault routines (if IoErr() is non-zero, StdErr
  57. automagically prints the associated text for the error).
  58.  
  59. If 'program_name' is omitted, 'StdErr' is assumed.
  60.  
  61. 1.3. PROC err_Dispose()
  62.  
  63. You must use this PROC at the end of your program.. if you
  64. don't, funky ugly things will happen.  I wish I could have
  65. automated this, but I cannot.. you'll have to remember to do
  66. this yourself.  This procedure only needs to be called at
  67. the end of the program, unless you're doing something really
  68. peculiar.  It'll tell WB users how to close the window, and
  69. it will close down open filehandles.
  70.  
  71. 1.4. PROC err_WriteF(format,items)
  72.  
  73. The main PROC... this is the biggie.  You may use this PROC
  74. anytime before err_Dispose().  The 'format' is the same as
  75. any WriteF statement, but 'items' needs to be enclosed in
  76. '[]'s or the statement won't work correctly (eg.
  77. err_WriteF('Big Time Screwup in \s\n',[procname]).  If
  78. IoErr() is set prior to invoking this function, a nice
  79. Fault() will be printed to StdErr automatically.
  80.  
  81. Note that 'items' can be left out (eg,
  82. "err_WriteF(format)"), as can 'format' (eg. err_WriteF()).
  83. Calling err_WriteF() without arguments will essentially make
  84. StdErr test IoErr() for a value, and Fault() the results to
  85. the user... kinda slick, really.
  86.  
  87. 2. REGISTRATION/DISTRIBUTION INFORMATION
  88.  
  89. This code is given freely to the E programming community
  90. (even if, somehow, you manage to find a way to make use of
  91. it on other platforms.. I don't care).  All I ask is that
  92. I'm credited with the routines.. nothing more, nothing less.
  93. I didn't spend a TREMENDOUS amount of time on it, but I DID
  94. spend some time, and concerning some of the meticulous care
  95. I placed in this project, I feel I have at least earned
  96. credit for its creation.
  97.  
  98. So.. I don't care if you're selling your product
  99. commercially, shareware, or just making a freeware project,
  100. feel free to use this as long as I'm credited.
  101.  
  102. I WILL limit distribution of this in one way: it may not be
  103. altered.  Feel free to spread this module literally all over
  104. the world, but do NOT alter the documentation or the
  105. routines themselves as you pass them on.  If you want to
  106. create your own stderr module, feel free to take credit for
  107. it, but I only want to take credit for my own work.  If your
  108. work is based strongly on my own, feel free to credit me,
  109. but clearly indicate where you've made alterations, and
  110. spread a separate version (claiming responsibility for your
  111. alterations).
  112.  
  113. 3. WORD TO THE UNWISE
  114.  
  115. If you decide to use these routines, have a care to the user
  116. you're about to assault.  Some folks want to be able to
  117. redirect information to a file or something.. they don't
  118. take very well to someone writing a program that writes to a
  119. stderr port for such frivilous reasons as 'Well, I had this
  120. really k00l ANSI file I wanted to dump on the screen, and I
  121. didn't want anyone to redirect it.'
  122.  
  123. Standard error ports are intended to be just that.. 'error'
  124. ports.  You're trying to give information regarding an
  125. error.. something most people want to be able to see in
  126. something like a separate filehandle on the console.
  127. Fortunately, most Amiga E programmers I've seen seem to
  128. really respect that, so I don't mind providing something
  129. like this for them.  But when Amiga E finally starts to hit
  130. it big, I really don't want folks to use StdErr to do stupid
  131. pranks.  Be kind.  Be gentle.  Be a pal.  Be a PROGRAMMER!
  132.  
  133. 4. ACKNOWLEDGEMENTS
  134.  
  135. I'd like to thank Barry Wills for providing EE (a very nice
  136. editor, especially the folding.. I look forward to being
  137. able to use it more reliably on my poor ol' 68000), and for
  138. complementing me on this small project.
  139.  
  140. I'd also like to thank Wouter van [Insert Long Name Here]
  141. for writing Amiga E.  Now that E is Object Oriented, I feel
  142. much happier about using this new Object Oriented Standard
  143. Error port (basically, it frees up yet another variable name
  144. I can use to my own demented ends).  This man has done a
  145. FINE job on an excellent programming language I can only
  146. begin to tap.
  147.  
  148. 5. COMMENTS/HOSTILITY/LETTERS OF ADORATION/TERMS OF ENDEARMENT
  149.  
  150. Currently, I'm available at the following E-mail address, in
  151. order of preferance/reliability:
  152.  
  153. jvanriper@uncavx.unca.edu
  154. vanriper@cs.unca.edu
  155. jvanripe@nox.cs.du.edu
  156.  
  157. I can also be written to via snail-mail:
  158.  
  159. Trey Van Riper
  160. 19-A Dortch Ave.
  161. Asheville, NC 28801
  162. USA
  163.  
  164. You may correspond in English (my best language), French,
  165. American Sign Language, Esperanto, and Latin (note, any
  166. language other than English may get unpredictable
  167. results/responses from me, as my vocabulary is rather weak
  168. in everything except English.. also, if you somehow manage
  169. to communicate to me in ASL, I'll be rather surprised..
  170. especially if it's via mail).  Sorry other languages aren't
  171. supported, but I can only learn so many at a time.
  172.  
  173. The above information should be good until around the summer
  174. of 1995, at which time things may become rather
  175. unpredictable for me (I'll have earned my degree in music,
  176. and may have moved on to find work somewhere).
  177.  
  178.