[comp.sys.amiga.tech] ARRGGGHHHHHHHHHHHH!!!! BCPL!!!!!!

ddave@pnet02.cts.com (David Donley) (03/14/89)

HELP!  I am trying to write a mountlist writing program.  Could somebody
please tell me

1. How can you tell if a BSTR or BPTR is NULL?
2. What has changed in the FileSysStartupMsg, DeviceNode, and fssm_Environ
since 1.2?

Thanks!
                              Call my BBS at (213) 372-4494
               Disclaimer: If it doesn't work, you did something wrong.
        ddave@pnet02.CTS.COM ddave@pnet.gryphon.COM killer!gryphon!pnet02!ddave

daveh@cbmvax.UUCP (Dave Haynie) (03/15/89)

in article <13291@gryphon.COM>, ddave@pnet02.cts.com (David Donley) says:

> HELP!  I am trying to write a mountlist writing program.  Could somebody
> please tell me

> 1. How can you tell if a BSTR or BPTR is NULL?

Well, start with the BPTR.  Based on the definition:

	BPTR = CPTR >> 2;

One would expect a BPTR NULL to be 0>>2, which magically turns out to be
the same as the CPTR NULL.  Imagine that.

A BCPL string (once de-referenced, of course) is empty is the first byte
is 0.  You may also note that again, in this one case, that's the same
way you tell if a C string is empty.  Of course, before de-referencing a
BCPL string pointer, you'll have to check that it's non-NULL, and probably 
shift it's pointer into a CPTR, as most BCPL strings are pointed to by
BPTRs.

> 2. What has changed in the FileSysStartupMsg, DeviceNode, and fssm_Environ
> since 1.2?

The only thing I know of is that the environment is longer.  The first longword
of the environment tells you it's length.  Under 1.2, DE_MEMBUFTYPE is the
last word of the environment.  Under 1.3, you can also have the following
environment vector members (in order):

	ULONG DE_MAXTRANSFER	The maximum number of bytes to transfer
				at a time.
	ULONG DE_MASK		Address mask used to block out certain
				areas of memory.
	 LONG DE_BOOTPRI	Autoboot priority.
	ULONG DE_DOSTYPE	Indicates the file system, SFS = 'DOS\0',
				FFS = 'DOS\1'

>         ddave@pnet02.CTS.COM ddave@pnet.gryphon.COM killer!gryphon!pnet02!ddave
-- 
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
              Amiga -- It's not just a job, it's an obsession

ddave@pnet02.cts.com (David Donley) (03/16/89)

daveh@cbmvax.UUCP (Dave Haynie) writes:
>in article <13291@gryphon.COM>, ddave@pnet02.cts.com (David Donley) says:
>
>> HELP!  I am trying to write a mountlist writing program.  Could somebody
>> please tell me
>
>> 1. How can you tell if a BSTR or BPTR is NULL?
>
>Well, start with the BPTR.  Based on the definition:
>
>	BPTR = CPTR >> 2;
>
>One would expect a BPTR NULL to be 0>>2, which magically turns out to be
>the same as the CPTR NULL.  Imagine that.
>
>A BCPL string (once de-referenced, of course) is empty is the first byte
>is 0.  You may also note that again, in this one case, that's the same
>way you tell if a C string is empty.  Of course, before de-referencing a
>BCPL string pointer, you'll have to check that it's non-NULL, and probably 
>shift it's pointer into a CPTR, as most BCPL strings are pointed to by
>BPTRs.
>
>> 2. What has changed in the FileSysStartupMsg, DeviceNode, and fssm_Environ
>> since 1.2?
>
>The only thing I know of is that the environment is longer.  The first longword
>of the environment tells you it's length.  Under 1.2, DE_MEMBUFTYPE is the
>last word of the environment.  Under 1.3, you can also have the following
>environment vector members (in order):
>
>	ULONG DE_MAXTRANSFER	The maximum number of bytes to transfer
>				at a time.
>	ULONG DE_MASK		Address mask used to block out certain
>				areas of memory.
>	 LONG DE_BOOTPRI	Autoboot priority.
>	ULONG DE_DOSTYPE	Indicates the file system, SFS = 'DOS\0',
>				FFS = 'DOS\1'
>
>>         ddave@pnet02.CTS.COM ddave@pnet.gryphon.COM killer!gryphon!pnet02!ddave
>-- 
>Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
>   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
>              Amiga -- It's not just a job, it's an obsession


Thanks for the help, I just had some probabems with dn_Handler asd several
other things (like dn_GlobVec) being set to 0xFFFFFFFF when they weren't being
used.  Is this true, or am I realy screwed up here?
                              Call my BBS at (213) 372-4494
               Disclaimer: If it doesn't work, you did something wrong.
        ddave@pnet02.CTS.COM ddave@pnet.gryphon.COM killer!gryphon!pnet02!ddave

daveh@cbmvax.UUCP (Dave Haynie) (03/17/89)

in article <13361@gryphon.COM>, ddave@pnet02.cts.com (David Donley) says:
> Thanks for the help, I just had some probabems with dn_Handler asd several
> other things (like dn_GlobVec) being set to 0xFFFFFFFF when they weren't being
> used.  Is this true, or am I realy screwed up here?

It's certainly true.  I'm not sure about dn_GlobVec, but there are two specific
"nothing there" values possible for some BCPL-ish things.  Often a NULL pointer
in a field somewhere is taken to mean "I don't have my own THING, use the
default", whereas the 0xFFFFFFFF == -1L value is saying "don't use THING at
all".  

>                               Call my BBS at (213) 372-4494
-- 
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
              Amiga -- It's not just a job, it's an obsession