home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Programming / ObiWan 5.2 / Documentation next >
Encoding:
Text File  |  1997-08-07  |  16.6 KB  |  300 lines  |  [TEXT/ttxt]

  1. ObiWan v5.2
  2. © Peter N Lewis and Stairways Software, 1992-97
  3. This program is $10 Shareware.
  4.  
  5. ObiWan is dedicated to beta testers and freeware and shareware authors.
  6.  
  7. “ObiWan is a must-have”
  8.    - Australian&New Zealand MacUser, Pg 88, Nov 1993.
  9.  
  10.  
  11. What ObiWan Does
  12.  
  13. ObiWan is a general help system.  ObiWan gives you access to a database through a floating window which you can pop up at any time in any application.  Portions of the information can then be sent to the front window as if you had typed it.
  14.  
  15. Although you can create your own databases, the main use of ObiWan is to access the provided databases, which include:
  16. Force: Procedures, traps, global variables, errors and most of the System 7.6 API.
  17. Java: A guide to the Java class libraries.
  18. Perl: Perl commands.
  19. Words: A word list, useful for checking your spelling.
  20. HTML: A  memory guide for HTML (v3.2), which lists valid attributes, whether a close tag is required, and other tags that a tag may contain.
  21. Translation Databases: A variety of English translation dictionaries, described in more detail below.
  22.  
  23. It is hard to overemphasise the convenience and speed of ObiWan.  Index searching is instantaneous, the text output is universal, ObiWan is always available and (new in v5.1) the Web Lookup feature adds to ObiWan’s power.
  24.  
  25.  
  26. Features
  27.  
  28. • BBEdit 4.5 supports ObiWan as a Reference Engine
  29. • The Force file includes all the System 7 information, including Universal Interfaces.
  30. • The Force database is quite up to date, including lots of the new managers.
  31. • The Force database includes page numbers for Inside Macintosh and New Inside Macintosh.
  32. • Any number of databases may exist, only one of which is active at any time.
  33. • First word searches are instantaneous, general searches are very quick.
  34. • Searches may be redirected to the web to get more information.
  35. • Databases are plain text files and can be edited at any time they are not active.
  36. • Databases are reindexed automatically when the file size changes.
  37. • Database file size is unlimited.
  38. • Databases can have any number of entries.
  39. • Uses Internet Config settings.
  40. • English to French, German, Italian, Latin, Portuguese and Spanish dictionaries
  41.  
  42. Caveats:
  43. Clicks occasionally get lost.  This can be fixed by installing Matt Slot's TSM Fix extension.
  44.  
  45. Delete keys typed in to ObiWan also go into a DA window if a DA is front-most.
  46.  
  47. The Finder doesn't like having keys dumped at it for some reason.
  48.  
  49.  
  50. Using ObiWan
  51.  
  52. Make an alias to ObiWan and drop it in the Startup Items folder in your System folder.  Launch it.
  53.  
  54. ObiWan silently waits in the background for you to press cmd-` at which time it will pop up a window and let you find entries in the database.  Type cmd-` (hold down the cloverleaf key and press the back-quote key (`)).  Read the help there, or type "a" and a return to redisplay the help text.  Click on the arrows to move through the database.  Double-click on words to find their entry.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. The buttons and their respective keys are, from left to right:
  64.  
  65. Lookup <return>
  66. Search Anywhere <shift-return>
  67. Web Search <option-shift-enter>
  68. Previous Entry <cmd-,>
  69. Next Entry <cmd-.>
  70. Jump Back <cmd-[>
  71. Type Word <cmd-enter>
  72. Type Line <cmd-option-enter>
  73. Type Procedure <cmd-shift-enter>
  74. Type Entire Entry <cmd-option-shift-enter>
  75. Play sound at launch (toggles the preference) (not displayed above)
  76. Play sound at invocation (toggles the preference) (not displayed above)
  77. About
  78. Change Database or Parse Procedure <option-return>
  79.  
  80. NOTE: The startup and invocation sounds have been removed to avoid any copyright problems.
  81.  
  82. Some of these commands need a little explanation:
  83. Lookup - Uses the Index to do very fast searches.
  84. Search Anywhere - Scans the entire database.  Still quick, but not instant like the Lookup command.
  85. Web Search - Dispatches a search URL to your Web Browser (as defined in Internet Config) which does a search on the current entry.  The URL varies depending on the Database.
  86.  
  87.  
  88. About the Force database
  89.  
  90. The Force database is partially produced by parsing the files which I have licensed from Apple.  Thanks to Rick Fleischman, Barbara Napier, and Apple Computer, Inc. for waiving the fee to allow the Force file to be distributed.  The Force file contains all the System 6 and 7 procedures, constants, errors, and global variables.  You can find these by opening ObiWan (cmd-`), typing in the start of the name (eg HOpen) and pressing return.  You can then insert the routine into THINK Pascal or C or MPW by clicking the third insert button (the one that looks like a procedure) (or by typing cmd-shift-enter).  Note that there is a Pascal bias in this database because I am biased towards Pascal, but there is no reason some bright spark couldn’t produce a C equivalent database.  You can also look up traps, errors, globals by searching for:
  91. trapA000 - four digit hex number, starting with A
  92. err-108 - decimal number, starting with a minus for OSErrs
  93. err25 - decimal number, positive for system errors.
  94. global910 - three digit hex number for global variables. (QuickDraw globals are not included)
  95.  
  96. C vs Pascal Procedure formats in the Force
  97. You can change to the C Parse Procedure by typing “C<option-return>” or use the Pascal Parse Procedure by typing “pascal<option-return>”.  This means, for instance, when you hit the Type Procedure button using the Pascal Parse Procedure you will get output of the form:
  98. CMError:=CWCheckColors(cw_CMWorldRef,VAR_myColors_CMColor,count_longint,VAR_result_longint);
  99.  
  100. Using C, the output is:
  101. CMError=CWCheckColors(cw_CMWorldRef,&myColors_CMColor,count_longint,&result_longint);
  102.  
  103. The Force database is not special in any way (except that it contains the programming information for System 7).  You can create other databases and switch between them by typing the name <name> and clicking the change button (furthest to the right) (or typing <option-return>).
  104.  
  105.  
  106. International Keyboards
  107.  
  108. Some keyboards don't have the ` character, which makes it difficult to activate ObiWan.  To change the activation key, open up ObiWan in ResEdit, open the OBKY resource and edit the third entry. Hot keys for all the other buttons in ObiWan can be edited in this resource too.
  109.  
  110.  
  111. International Dictionaries
  112.  
  113. ObiWan includes International English translation dictionaries, for translating from English to:
  114. French
  115. German
  116. Italian
  117. Latin
  118. Portuguese
  119. Spanish
  120.  
  121. These dictionaries come from the Internet Dictionary Project, which is project aimed at providing public domain dictionaries.  Cool!  (If you find an error or omission please consider correcting it at the IDP Update page: <http://www.june29.com/IDP/IDPupdate.html>.)
  122.  
  123.  
  124. ObiWan DCMD - Using ObiWan in MacsBug
  125.  
  126. The ObiWan distribution comes with a DCMD which lets you use ObiWan in MacsBug.  Just put the the file ‘ObiWan DCMD’ MacsBug Preferences folder in the Preferences folder and reboot.
  127.  
  128. In MacsBug, you can now type "obiwan StandardGetFile" and it will show you the StandardGetFile information and let you page through it.  For example:
  129.  
  130. obiwan StandardGetFile
  131.  
  132. gives you:
  133.  
  134.  ObiWan find “StandardGetFile”...
  135.   
  136.   StandardGetFile(fileFilter:FileFilterUPP;numTypes:integer;typeList:
  137.   ConstSFTypeListPtr;VAR reply:StandardFileReply); ƒStandardFile Δ {A9EA:
  138.   $0006} FL.1-42…43  FL.3-4…5  FL.3-14  FL.3-50  QD.7-14
  139.  
  140.  
  141. Using Master Yoda
  142.  
  143. Launch Master Yoda.  
  144.  
  145. Click the Select button to select a database, then you can get Stats on the database, sort it, add another (sorted!) database, index the database (but that is done automatically for you anyway), or change the word set characters for the database.
  146.  
  147.  
  148. Database Format
  149.  
  150. An ObiWan database is just a TEXT file with a strict format, plus some resources in the resource fork, including the index (which is recalculated if the file size changes) the word character set.  The format of the text file is (by example):
  151.  
  152. =|
  153. indexword data
  154. general stuff, up to 10 lines, each up to 80 characters, ending with a|
  155. nextindexword more data
  156. more stuff|
  157. verynextindexedword more and more data
  158. finally ending with|
  159. =|
  160.  
  161. The file should be sorted by the indexword (Master Yoda’s sort sorts by the entire entry so if you want related parts to stay in the same order when the database is sorted, they must be ordered in that way).  The sort order is straight ASCII, case insensitive.  Yes, I can hear you screaming “No, no, use the language independent sort order that the system defines”, (and yes, I do think that comma should go outside the quote mark irrespective of what the English teachers would have you believe :-) but I wish to be able to distribute a database file that works on all machines without having to be resorted.
  162.  
  163. Let’s see if I can define a BNF for the database format:
  164.  
  165. database ::= "=|" <cr> multiple_entries <cr> "=|" <cr>
  166.  
  167. multiple_entries ::= entry "|" <cr>
  168. multiple_entries ::= entry "|" <cr> multiple_entries
  169.  
  170. entry ::= line
  171. entry ::= line <cr> entry
  172.  
  173. line ::= character
  174. line ::= character | line
  175.  
  176. character ::= chr(9) | chr(32)..chr(126) | chr(128)..chr(255)
  177.  
  178. lines MUST be at most 80 characters, and should fit into the window in Geneva 9.
  179. entries MUST be at most 10 lines.
  180. There is no limit to the file size or number of entries (well, ok, the file size is limited by the file system, but that is not my fault, and the number of entries is obviously limited by the size of the file...)
  181.  
  182. Note:  The file absolutely must start and end with =|<cr>.  No trailing blank lines.
  183.  
  184. Setting the Font in a Database
  185.  
  186. If you wish to use a different font and font size in a in ObiWan, it is possible to set the Font and Font size for a database using ResEdit.  Drop the database on ResEdit and add a STR# resource with ID 1984.  The first string is the font name, the second is the size.  If the STR# resource doesn’t exist, it defaults to Geneva 9 (as specified in STR# 128 in ObiWan).
  187.  
  188.  
  189. How It Works
  190.  
  191. ObiWan uses the Text Services manager to display the floating window (and thus requires System 7.1), and patches into the jGNEFilter list to receive events.
  192.  
  193. Later on, it watches key presses and if a match for the popup key appears it opens the display window and accepts key strokes.  When you hit return it takes the first eight letters of the word (padding with zeros), and scans through an index to find where in the database that word comes, then it positions itself in the database and scans the entries until it finds a matching one and displays that.  The “anywhere” search is done using Boyer-Moore search routine - this is one of the most elegant and simple routines I’ve ever seen, if you ever do any searching code, check this out, it is hardly any more complicated than a brute force search, but takes time *inversely* proportional to the length of the search string!
  194.  
  195. Entering characters into the front application is done by simply returning key down events (with key codes) in response to null events.  Word still gets confused (because it only calls WNE if there is an event waiting), but that is to be expected.
  196.  
  197.  
  198. Limitations
  199.  
  200. ObiWan & Master Yoda require System 7.1 or later.
  201.  
  202. There is a problem with clicks in ObiWan’s display area sometimes being ignored.  This happens because the click is sometimes stolen before it gets to the jGNEFilter. You can fix this by installing Matt Slot's TSM Fix (included).  
  203.  
  204. There is also a problem that key presses go into DA windows instead of ObiWan.  I don’t really think this is a major problem, but perhaps others disagree.
  205.  
  206. If you quit ObiWan (using ProcessWatcher for example), the icon remains greyed out in the Finder.  This is a bug in the Finder.  This problem has been rectified in MacOS 8.
  207.  
  208.  
  209. Registering
  210.  
  211. This program is Shareware, which means if you use it, you must pay for it.  A single user license costs US$10.  ObiWan 5.2 is a free upgrade from ObiWan 5.1.
  212.  
  213. You can pay in one of two ways: on-line registration using a web browser, or off-line registration using the Register program.
  214.  
  215. On-Line Registration
  216.  
  217. Our online registration can be found at:
  218.  
  219. <http://kagi.direct.net/cgi-bin/register1.cgi?PL>
  220.  
  221. Off-Line Registration
  222.  
  223. Or, using the Register program, you need to:
  224.  
  225. 1. Get hold of a copy of the Register program:  Register comes with the ObiWan distribution.  You can also get Register from the following sites:
  226.  
  227. <ftp://ftp.stairways.com/>
  228. <ftp://mirrors.aol.com/pub/peterlewis/>
  229. <ftp://ftp.amug.org/pub/peterlewis/>
  230.  
  231. ..or there are download links on the following Web page:
  232.  
  233. <http://www.stairways.com/register/topay.html>
  234.  
  235. 2. Run the Register program and fill out the form: You need to enter your name, email, postal address, and the shareware you wish to pay for. The form accepts many different payment  methods such as: US Check, Money Order, Cash (in many different currencies), Visa, Mastercard, American Express, First Virtual, and Invoice (to be given to your accounts payable department).
  236.  
  237. 3. Send it to Kagi Shareware: Then either email the data generated by the registration program or print it and send it via postal mail or fax. Credit card information is encoded by the Register program.
  238.  
  239. The address to send the completed form is output by Register when you Print or Copy the completed form.  The addresses are:
  240.  
  241. Email: shareware@kagi.com
  242.  
  243. FAX: +1 510 652 6589
  244.  
  245. Snail-mail:
  246. Kagi Shareware
  247. 1442-A Walnut Street #392-PL
  248. Berkeley, California, 94709-1405
  249. USA
  250.  
  251. You may distribute this program any way you wish as long as you don’t charge for it (reasonable download costs such as Compu$erve are ok (although who would call Compu$erve’s download costs reasonable?)).  You must distribute the package in its entirety.  We don’t guarantee any support, but we always answer my Email.  If we don’t answer Email it is because your message didn’t get to us, or our reply bounced, so please try again and include a valid Internet address if you can.
  252.  
  253. You MAY NOT DISTRIBUTE this program on any disk or CD without our explicit permission.
  254.  
  255. Australians may pay in Australian dollars direct to us if they prefer.
  256.  
  257.  
  258. Site Licensing
  259.  
  260. World-wide license: US$2000
  261. Universities or companies site license: US$500
  262. Curtin University and the University of Western Australia are exempt.
  263.  
  264. A site license covers usage of ObiWan on an unlimited number of machines within 100 miles of some arbitrary central point which are owned by the licensed organization.  (A site license will not be useful unless you intend to run more than 50 copies of ObiWan.)
  265.  
  266. World Wide licenses remove the 100 mile radius restriction.
  267.  
  268.  
  269. Warranty
  270.  
  271. This program should do what is described in this document.  If it doesn’t, you can simply stop using it.  If you payed for the product, and within a year find that it doesn’t do what has been described here, then you can notify Stairways Shareware and your money will be refunded and your license cancelled.
  272.  
  273.  
  274. Fine Print
  275.  
  276. Peter Lewis hereby disclaims all warranties relating to this software, whether express or implied, including without limitation any implied warranties of merchantability or fitness for a particular purpose.  Peter Lewis will not be liable for any special, incidental, consequential, indirect or similar damages due to loss of data or any other reason, even if Peter Lewis or an agent of his has been advised of the possibility of such damages.  In no event shall Peter Lewis be liable for any damages, regardless of the form of the claim.  The person using the software bears all risk as to the quality and performance of the software.
  277.  
  278.  
  279. US Government
  280.         Government End Users:  If you are acquiring the Software and fonts
  281. on behalf of any unit or agency of the United States Government, the
  282. following provisions apply.  The Government agrees:
  283.         (i) if the Software and fonts are supplied to the Department of
  284. Defence (DoD), the Software and fonts are classified as "Commercial
  285. Computer Software" and the Government is acquiring only "restricted rights"
  286. in the Software, its documentation and fonts as that term is defined in
  287. Clause 252.227-7013(c)(1) of the DFARS; and
  288.         (ii) if the Software and fonts are supplied to any unit or agency
  289. of the United States Government other than DoD, the Government's rights in
  290. the Software, its documentation and fonts will be as defined in Clause
  291. 52.227-19(c)(2) of the FAR or, in the case of NASA, in Clause
  292. 18-52.227-86(d) of the NASA Supplement to the FAR.
  293.  
  294.  
  295. Acknowledgements
  296.  
  297. This program, like many of my others, would never have gotten here without the help of my friends.  Thanks!
  298.  
  299. Thanks to Jager, Quinn, and Rhys for their ideas and suggestions for ObiWan in the initial design phase.  Thanks you J&Q for the initial parsing of the PInterfacesHelp file and the colour icons.  Thanks also to the UCC, Curtin, Todd (have fun at AlphaWest!), Steve, c.s.m.p, plaza, ftp.apple.com, Stephen, and anyone who uses ObiWan!  Thanks to Greg and the guys at Metrowerks for including ObiWan and giving me a license to their wonderful compiler.  ObiWan is written in Metrowerks Pascal.  Special thanks go to those brave souls who risked life and Mac beta testing an unknown program.  Thanks to Matt Slot for the TSM Fix extension.
  300.