[comp.sys.mac.programmer] Tech note finder was Re: Inside Mac VI

mxmora@unix.SRI.COM (Matt Mora) (10/04/90)

In article <1539@howtek.UUCP> cory@howtek.UUCP (Cory Kempf) writes:

>Apple has a new feature in MPW currently called "411".  It gives access
>from within MPW to Inside Mac I-VI, Technotes, & MacApp Docs.  You can
>do keyword searches, or it will show you what is defined for a particular
>header file.  It will also insert the form of a function call into your
>code for you.
>
>The only problem is that it needs about 13 MB of disk space.  Other than 
>that, very nicely done.

I wrote a program called "Technical Note Finder" that gives you online
technical notes. (Well at least for multi-finder users) It originaly started
out as a Fkey but I couldn't make it stable enough. And once I got enought
memory  to run multi-finder, the fkey approach wasn't needed. It was pretty
slick with a menubar in the tech note display window. I converted it to an
application in hopes to make in to a DA. You can use the application with
or without the actual tech notes being online. (since they take up 2.4 megs
of disk space) 

The tech notes (if you want them) reside in a folder. The tech notes
themselves are just plain text files. Which makes updating them real easy. 
There is also an index file which is also a text file that you put in your 
system folder ( or the same directory as the program). I also wrote
a stack that will extract the tech notes and create an index from the 
technical notes stack on the developer cd. 

When you start the program a small window comes up. You type the the find field
what you want to look for. It finds your query in the index and  adds it to the
list. If you then select a line from the scrolling list, the program checks to
see if that tech note is on line. If it is, it will hilite the "Show Note".
I used this approach because if you want to leave out some tech notes (like
outdated ones ) you wont have to edit a big file to extract the ones you don't
want. But I degress... If the note is available either double clicking the line
or clicking the button will bring up a window with that tech note.

The version I have now is .9 beta. It has some limitations now which will be
fixed when it is final. If you would like to try it out send me email and I 
send you a copy. I also have all the tech notes (including #31) already 
formated. Please let me know if you want me to include the tech notes also. 

The package includes:
 Tech note finder app
 Tech note extractor stack
 Tech Note Index file
 and on request tech notes 1 - 279

I would really like to get some feed back on how to make it better.

I plan on incuding some kind of compress/decompress to make the
disk space useage shrink. I have some code but it expects to be called
from C. Does anybody know how to call C code from pascal?

Or better yet does anybody have any text compress/decompress engine
that can be called from pascal that they can share?

>It is available only via the ETO disk (via APDA)
>+C


-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

mxmora@unix.SRI.COM (Matt Mora) (10/10/90)

In article <1990Oct6.041726.15688@eng.umd.edu> russotto@eng.umd.edu (Matthew T. Russotto) writes:
>In article <16861@unix.SRI.COM> mxmora@unix.UUCP (Matt Mora) writes:
>>I would really like to get some feed back on how to make it better.
>>
>>I plan on incuding some kind of compress/decompress to make the
>>disk space useage shrink. I have some code but it expects to be called
>>from C. Does anybody know how to call C code from pascal?
>Yes-- if your C code is declared
>int foobarbaz(params),
>change it to
>pascal int foobarbaz(params)
>
>Then, in your pascal program, call it as you would any external routine.
>
>BTW, make sure your program can still read the technotes as apple distributes
>them, if possible, to accomodate CD users.

Yes I will. The code will check the file if its text, then fine and dandy else
decompress it and the display it. It will also have the ability to compress any
new technotes.


I don't think your exaple will help me. The original code is written in ASM.
below is the instructions on how to call the code from C. If anyone
knows how to call the code from pascal that would be a real help.

	export	(compinit, compwrite, compclose):code
	export	(uncompinit, uncompread, uncompclose):code

; This is a library for use with MPW C programs.  It implements compression
; and uncompression compatible with the unix compress/uncompress programs.
; (But note that the unix programs create files with a 3 byte header which
; is NOT handled by this library.  It's up to the caller to take care of
; any headers).
;
;The compress module consists of three functions:
;(1) long compinit (maxbits, block_compress, outputfn, param)
;   int maxbits, block_compress;
;   int (*outputfn)();
;   long param;
;This function allocates and initializes a compress stream and returns a
;'stream handle', or 0 if it can't allocate enough memory for its data
;structures (in which case MemErr contains the error code).
;maxbits must be an integer between 9 and 16.  Larger values result in
;  better compression but require more memory.
;block_compress should be non-zero to do 'block compression'.  This is
; almost always a win, so use it.  It requires no extra memory.
;outputfn should be the function to do actual I/O.  It must be a function
; of 3 arguments:
;    int outputfn(param, size, buffer)
;       long param;
;       int size;
;       char *buffer;
;  param will be the same param argument that was passed to compinit.
;  The function should output the size bytes in buffer, and return a
;  non-negative value if successful, or a negative value if an error
;  occured.  The outputfn will not be called again after it returns
;  an error.
;(2) int compwrite (cstream, size, buffer)
;      long cstream;
;      int size;
;      char *buffer;
; This function adds the size bytes in buffer to the compress stream.  cstream
; is the stream handle returned by compinit.  compwrite returns a non-negative
; value if successful or a negative value if an error occured.  The value is
; actually the same as the value of last call to outputfn.  Note that compwrite
; does buffering and so the calls to compwrite and outputfn are not precisely
; synchronized - a given call to compwrite might call outputfn several times or
; it might not call it at all.  Once outputfn returns an error, compwrite will
; continue to return that error and never call outputfn again.
;(3) int compclose (cstream)
;      long cstream;
; This function writes out any remaining characters in the stream buffer and
; frees its data structures.  It returns an error code like compwrite.

;The uncompress module consists of three functions:
;(1) long uncompinit (maxbits, block_compress, inputfn, param)
;   int maxbits, block_compress;
;   int (*inputfn)();
;   long param;
;This function allocates and initializes an uncompress stream and returns a
;'stream handle', or 0 if it can't allocate enough memory for its data
;structures (in which case MemErr contains the error code).
;maxbits and block_compress must be the values which were used by compress.
;inputfn should be the function to do actual I/O.  It must be a function
; of 3 arguments:
;    int inputfn(param, size, buffer)
;       long param;
;       int size;
;       char *buffer;
;  param will be the same param argument that was passed to compinit.
;  The function should try to read size bytes into buffer, and return
;  the number of bytes actually read.  A negative value means an error
;  occured, zero means end of file (no more bytes to be read).  The inputfn
;  will not be called again after it returns a non-positive value.
;(2) int uncompread (cstream, size, buffer)
;      long cstream;
;      int size;
;      char *buffer;
; This function stores (at most) size bytes into buffer.  cstream is the
; stream handle returned by uncompinit.  uncompread returns the number of
; bytes read, or a non-positive value if there are no more bytes (in which case
; the value is actually the value returned by the last call to the inputfn).
; Note that uncompread does buffering and so the calls to uncompread and
; inputfn are not precisely synchronized - a given call to uncompread might
; call inputfn several times or it might not call it at all.  Once inputfn
; returns a non-positive value, uncompread will continue to return that value
; and never call inputfn again.
;(3) int uncompclose (cstream)
;      long cstream;
; This function frees the data structures used by the stream.  It currently
; always returns 0 (no errors are possible).

Thanks



>--
>Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
>      .sig under construction, like the rest of this campus.


-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________