[Coco] Expert C programmer wanted

KnudsenMJ at aol.com KnudsenMJ at aol.com
Fri Feb 11 16:01:55 EST 2005


 
In a message dated 2/11/05 12:09:04 AM Eastern Standard Time,  
elderpav at juno.com writes:

The  Shell command would allow me to pass parameters to the called module,
but  not back to the parent program. Values can only be passed in one
direction  using that method. I need to pass in both  directions.



Is Pascal like Basic09, in that functions can't return values?  If  not, then 
you should be able to return a single value (a success/error code for  
example).
 
Otherwise, can you use the Basic09 trick (also handy in C), where you pass  
the function the address of a structure ("type" in Basic09), an let the  
assembler OS9 routine fill in the slots/fields of the structure/type with  multiple 
return values?
 
Or maybe pass the address of one or more Pascal variables, into which the  
OS9 assembler routine can store values?
 
Now, ISTR that Pascal didn't allow pointers or addresses (thus guaranteeing  
that C would play the part of Mammals to Pascal's Dinosaurs).  But I'm  pretty 
sure Pascal has structures (user-defined types as in Basic09), and when  one 
is passed to a routine, it *probably* is passed by reference (address, or  
pointer (shhhh)), so if the routine changes any fields/members of the structure,  
those changes will be seen afterwards in the calling program.
 
It's possible that Pascal calls even structure types "by value", making a  
temporary copy of the structure to pass to the function.  If so, and none  of my 
other suggestions are legal either, then it's obvious why Pascal never  made 
it past Intro to Programming 101 at Skunk Hollow State Teachers College  :-)  
So, somehow, I suspect that Pascal can do what you want.
--Mike K.
 



More information about the Coco mailing list