[comp.sys.amiga] BPTRs extinct in 1990?

kkaempf@rmi.UUCP (Klaus Kaempf) (08/10/88)

The following Ideas are from Ralph Babel who still has no direct
access to the News.
Feel free to send comments to me.

Klaus

--------------

How to get rid of all the BCPL-stuff inside Kickstart and
AmigaDOS, giving developers time to update their software,
without breaking too many programs at the same time.

1 - Internal BCPL data structures unchanged in Kickstart
    1.4, i. e. still BPTRs, BSTRs, and BPTRs to BSTRs.

2 - Four functions to be added to the DOS-Library in 1.4:

    APTR BPTRtoAPTR(BPTR);
    BPTR APTRtoBPTR(APTR);
    char *BSTRtoCSTR(APTR, char *);
    APTR CSTRtoBSTR(char *, APTR);

    Usually having a BPTR to a BSTR, you will have to call
    two functions to convert the BSTR to a CSTR.

3 - Starting with Kickstart 1.4 ALL REFERENCES to BCPL data
    structures MUST BE MADE using these four functions to be
    compatible! You may no longer access the data directly,
    just the output of the functions above. The only
    exceptions I can think of are KS/WB (of course) and data
    on external media, like the filenames and comments on
    AmigaDOS disks. The functions above CANNOT be used to
    convert these data structures (see below).

    #define BADDR(x) BPTRtoAPTR(x)

4 - ALL internal BCPL data structures entirely changed to
    usual C-conventions in Kickstart 1.5 (maybe it's worth
    calling it 2.0?)

5 - The four BCPL interface functions merely become ...

    pointer conversion: RTS
    string conversion: strcpy()

    New software not expected to run under earlier versions
    of Kickstart can simply IGNORE these four functions from
    now on.

6 - "Open()" will return a "struct FileHandle *",
    "Lock()" will return a "struct FileLock *",
    FileInfoBlock need not be longword aligned, etc. etc.

7 - Now all programs that have been using these functions
    automatically pick up the OS change! No crashes. :-)

I agree this will be very inconvenient for those of us
writing handlers and filesystems etc., but ... no more BPTRs
after KS1.4! I think it's worth it!

Doesn't ...

for(dn = DOSBase->dl_Root->rn_Info->di_DevInfo; dn != NULL; dn = dn->dn_Next)

... look much nicer than ...

for(dn = (struct DeviceNode *)BADDR((struct DosInfo *)
 BADDR(((struct RootNode *)DOSBase->dl_Root)->rn_Info)->di_DevInfo);
 dn != NULL; dn = (struct DeviceNode *)BADDR(dn->dn_Next))

???

Still some agreements to be made concerning DOS-packets
(make them Exec-messages?), Global Vector stuff is illegal
anyway (CUSTOMSCREEN CON-window magic is the only exception
I can think of). And you should have a real close look at
the original OVS.ASM - horrible! And a quote from the
AmigaDOS manual: "However, you do not need to use A6 to hold
a pointer to the [DOS] library base; you may use any other
register if you need to." Nothing that can't be solved!

This method actually DOES BREAK almost all programs that
were written before KS/WB1.4, but I think all programmers
should be able to update their software within, say, two
years? (no-one expects CP/M software to run under MS-DOS).
This will also kill all the BCPL-stuff like MCC-Assem,
Cambridge Lisp and (horrors!) ABasiC! :-( BTW: MCC sells
lots of stuff for the Atari ST (including a BCPL compiler,
huh?) which does not have a BCPL-OS.

Any comments appreciated

!ralph

Ralph Babel, Falkenweg 3, D-6204 Taunusstein, FRG