[comp.sys.apple] GS/OS calls--how?

hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) (10/13/89)

I'm attempting to learn how to use GS/OS calls, and have come up with  
some questions.  Things don't seem to be working the same way as they did
with the ProDOS 16 calls.

For example, to get file info on a file, I did something like


GSString255 s = {13, "/hd/test.file"};
FileInfoRecGS filerec;

filerec.pathname = &s;
filerec.pCount = (word) 2;
GetFileInfoGS(&filerec);


At first I didn't assign anything to the pCount variable and kept
getting errors, so after a little experimentation, I found that 2 seems
to work.  But what is the pCount field of most of the GS/OS records for?

When I did the above, I just seemed to get garbage values for the fileType,
access, auxType, createDateTime, modDateTime, etc., fields.  What am I doing
wrong?  Do any other fields besides pathname and pCount have to be pre-set 
before I call GetFileInfoGS()?

Thanks very much for any help.


Jeff Hartkopf

Internet:
hartkopf@tramp.Colorado.EDU

farrier@Apple.COM (Cary Farrier) (10/13/89)

In article <12696@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) writes:
>
>I'm attempting to learn how to use GS/OS calls, and have come up with  
>some questions.  Things don't seem to be working the same way as they did
>with the ProDOS 16 calls.
>
>For example, to get file info on a file, I did something like
> [...example deleted...]
>
>At first I didn't assign anything to the pCount variable and kept
>getting errors, so after a little experimentation, I found that 2 seems
>to work.  But what is the pCount field of most of the GS/OS records for?
>
>When I did the above, I just seemed to get garbage values for the fileType,
>access, auxType, createDateTime, modDateTime, etc., fields.  What am I doing
>wrong?  Do any other fields besides pathname and pCount have to be pre-set 
>before I call GetFileInfoGS()?


	The pcount field in the Class 1 GS/OS system calls tells the
	system how many parameters are in your pblock.  The format
	for the class 1 GET_FILE_INFO call is:

		$00-$01		pcount
		$02-$05		input pointer to a class 1 input string
				containing the pathname
		$06-$07		access
		$08-$09		file_type
		$0A-$0D		aux_type
		... [and so on...]

	When you specify a pcount of 2, you are telling the system
	that you only want to give it the pathname and to receive
	the file_type. A pcount of 3 will include the aux_type, and
	so on.  Since you only specify a pcount of 2, the FST will
	not fill in any parameters other than the first two.  Note
	that the pcount does not include pcount itself.

Cary Farrier


-- 
+--------------+-------------------------+
| Cary Farrier | farrier@apple.com       |
+--------------+-------------------------+

dlyons@Apple.COM (David Lyons) (10/14/89)

>In article <12696@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) writes:
>>I'm attempting to learn how to use GS/OS calls, and have come up with  
>>some questions.  Things don't seem to be working the same way as they did
>>with the ProDOS 16 calls.

The main reason for this is that the GS/OS (class 1) calls are *not* the
same as the ProDOS 16 (class 0) calls. :-)    (If they were they same,
we wouldn't need two kinds of calls, eh?)

>>At first I didn't assign anything to the pCount variable and kept
>>getting errors, so after a little experimentation, I found that 2 seems
>>to work.  But what is the pCount field of most of the GS/OS records for?

For GetFileInfoGS, use pCount=12 to get back all the information that the
current version of GS/OS can return for that call.

BTW, it will probably help a bunch if you buy the GS/OS reference from
APDA.


Cary Farrier writes:
>	The pcount field in the Class 1 GS/OS system calls tells the
>	system how many parameters are in your pblock.  The format
>	for the class 1 GET_FILE_INFO call is:
>
>		$00-$01		pcount
>		$02-$05		input pointer to a class 1 input string
>				containing the pathname
>		$06-$07		access
>		$08-$09		file_type
>		$0A-$0D		aux_type
>		... [and so on...]
>
>	When you specify a pcount of 2, you are telling the system
>	that you only want to give it the pathname and to receive
>	the file_type. A pcount of 3 will include the aux_type, and
>	so on.  Since you only specify a pcount of 2, the FST will
>	not fill in any parameters other than the first two.  Note
>	that the pcount does not include pcount itself.
>
Looks like 2 will get you only the Access parameter back (the input
pathname counts as the first parameter), so 3 will get you the Access
and Filetype.
-- 

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   America Online: Dave Lyons                |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.