[comp.sys.mac.programmer] Passing params from HyperCard

milikich@iccgcc.decnet.ab.com (Mike Milikich, Allen-Bradley Company) (09/27/90)

I have a question about passing parameters to C programs on the Mac. What I
would like to do is mimic the standard main (int argc, char *argv[]) interface,
or write some mechanism which allows parameters to be passed to a standalone
application from HyperCard.
The situation is this : in a HyperCard stack interface to a database, a bunch
of parameters get accumulated which are meant for a query application. Right
now, even though HyperCard knows all of the parameters the report generator
application needs, there isn't a way to pass the data to it. So the program
runs through a series of dialogs, asking the user for information that has
either already been entered (in HyperCard) or is known internally to HyperCard
and really shouldn't need to be re-entered. The application is > 32K (I think),
so converting it to an XCMD/XFCN is out (or is it?). The idea of temporary
files of any sort seems kludgy to me. Any suggestions?

--------------------------------------------------------------------------------
| milikich%iccgcc.decnet@consrt.rok.com |"...and the men who hold high places  |
| allen-bradley company                 | must be the ones to start..."        |
| 747 alpha drive                       |--------------------------------------|
| highland heights, ohio  44143         | I don't speak for A-B,               |
| (216) 646-3494  FAX : (216) 646-4343  | and I know they don't speak for me.  |
--------------------------------------------------------------------------------

jason@ux1.cso.uiuc.edu (char *myName) (09/29/90)

milikich@iccgcc.decnet.ab.com (Mike Milikich, Allen-Bradley Company) writes:

>I have a question about passing parameters to C programs on the Mac. What I
>would like to do is mimic the standard main (int argc, char *argv[]) interface,
>or write some mechanism which allows parameters to be passed to a standalone
>application from HyperCard.
>The situation is this : in a HyperCard stack interface to a database, a bunch
>of parameters get accumulated which are meant for a query application. Right
>now, even though HyperCard knows all of the parameters the report generator
>application needs, there isn't a way to pass the data to it. So the program
>runs through a series of dialogs, asking the user for information that has
>either already been entered (in HyperCard) or is known internally to HyperCard
>and really shouldn't need to be re-entered. The application is > 32K (I think),
>so converting it to an XCMD/XFCN is out (or is it?). The idea of temporary
>files of any sort seems kludgy to me. Any suggestions?

     Could you use an XCMD/XFCN to write the parameters to the applications
data fork or resource fork?

     Does your application correctly handle finder information as documented
in the Segment Loader chapter of IM II?  If so, you could pass it a fake
finder information structure, setting the fType field to indicate that the
application is being launched from HC, and using the remainder of the structure
for the desired parameters.  If this works at all, I'm sure it's strictly
verboten, but it might be worth a try.
-- 

                       |  |    |====================|
                       |  |    | Jason Watts        |
                     \ |\ |\ \ | (jazzin@uiuc.edu)  |