Difference between revisions of "Trinity in Trouble"

From Freepascal Amiga wiki
Jump to navigation Jump to search
(→‎List of issues: relocated fixed issues, better overview)
(→‎Table of units: update table entry for keyboard.device)
Line 26: Line 26:
 
| agraphics    || graphics.library      || class="working" | yes || class="working" | yes || class="working" | yes ||
 
| agraphics    || graphics.library      || class="working" | yes || class="working" | yes || class="working" | yes ||
 
|-
 
|-
| akeyboard    || keyboard.device      || class="working" | yes || class="not"    | no  || class="not"    | no  ||
+
| akeyboard    || keyboard.device      || class="working" | yes || class="not"    | no  || class="not"    | no  || Mag: AROS version available (not in github yet).
 
|-
 
|-
 
| diskfont      || diskfont.library      || class="working" | yes || class="working" | yes || class="not"    | no  ||
 
| diskfont      || diskfont.library      || class="working" | yes || class="working" | yes || class="not"    | no  ||

Revision as of 19:52, 27 September 2015

Note

Based on Free Pascal branch "fixes 3.0"

Feel free to add delete or change status.

Our trinity consist of Amiga, AROS and MorphOS.

Unfortunately, there are (still) some incompatibilities and/or some lack of consistency here and there. The idea is to have a list here that mentions them all. Layout may change, i simply had to start somewhere.

NOTE: I thought there is no use to mention the Tag, Tags, Taglist, etc. inconsistency and additional incompatibilities that this causes. We are all aware of those and will hopefully get some unity in the future

Table of units

List of available units per platform:
Unit Category OS3.x AROS MorphOS Remark(s)
agraphics graphics.library yes yes yes
akeyboard keyboard.device yes no no Mag: AROS version available (not in github yet).
diskfont diskfont.library yes yes no
cybergraphics cybergraphics.library yes yes no

List of issues

  • function: DoMethod()
Amiga version seems missing completely.
Implemented versions for AROS and MorphOS don't follow autodocs 100% and are inconsistent.
  • function: ASLRequestTags()
AROS implementation seems missing.
Amiga implements it in utility unit systemvartags (see also unit: systemvartags)
MorphOS implements it in unit ASL
  • structure: Hook
AROS version, entries are not IPTR rather APTR.
  • function: SetAttrs()
Amiga + MorphOS implementations seems missing
  • unit: Workbench
MorphOS version seems missing
  • unit: systemvartags
This utility unit is Amiga specific and implements most if not all vartags versions of library-calls rendering it incompatible with AROS and MorphOS
  • function: VFPrintf()
AutoDocs: LONG = VFPrintf(BPTR, STRPTR, LONG *)
Amiga declaration: FUNCTION VFPrintf(fh : LONGINT location 'd1';const format : pCHAR location 'd2';const argarray : POINTER location 'd3') : LONGINT; syscall _DOSBase 354;
AROS declaration: function VFPrintf(Fh: BPTR; const format: STRPTR; const ArgArray: PLongInt): LongInt; syscall AOS_DOSBase 59;
MorphOS declaration: function VFPrintf(fh : LongInt location 'd1'; format: PChar location 'd2'; argarray: Pointer location 'd3'): LongInt; SysCall MOS_DOSBase 354;
NOTE: the generic pointer declaration prevents using "VFPrintf(nil/0, 'text', vargs );" where vargs = array of long.
Remark: AFAIK for AROS it is theoretically possible to pass 64-bit formatted values.
  • function: AslRequest()
autodocs: BOOL AslRequest( APTR,struct TagItem * );
Amiga: FUNCTION AslRequest(requester : POINTER location 'a0'; tagList : pTagItem location 'a1') : LongInt; syscall AslBase 060;
AROS: function AslRequest(Requester: Pointer; const Tags: array of const): LongBool;
MorphOS: function AslRequest(requester: Pointer location 'a0'; tagList : pTagItem location 'a1'): LongBool; SysCall AslBase 060;
  • function: SetGadgetAttrs()
MorphOS version seems missing
  • function: WriteStr()
On MorphOS this function seems declared as Amiga-function, which clashes with Free Pascal build-in function WriteStr. Strange as WriteStr seems only declared as dos/stdio.h macro.
  • function: CoerceMethod()
MorphOS version seems missing completely (including CoerceMethodA().
Amiga version has CoerceMethodA() implemented but no CoerceMethod()
Implemented versions for AROS and Amiga don't follow autodocs 100% and are inconsistent.
  • type: Tag
Autodocs: "typedef ULONG Tag;"
Amiga: "Type Tag = LongInt;"
  • record field: ti_Data of record tTagItem
Autodocs: "ULONG ti_Data;"
Amiga: "ti_Data : LongInt;"
  • type: PPObject_
Missing for Amiga and MorphOS
  • function: TextLength()
MorphOS: types the string parameter as pShortInt. Autodocs/Amiga/AROS uses type STRPTR.
  • function: Text()
MorphOS: still called Text() while Amiga and AROS named it GfxText(). Also the string parameter for MorphOS is declared as pShortInt. Autodocs/Amiga/AROS uses type STRPTR.
  • type TDateTime
Amiga + AROS: declares this structure (and accompanied pointer) as TDateTime,
MorphOS: declares this structure _TDateTime and accompanied pointer _PDateTime
Remark: TDateTime declared in AmigaDOS conflicts with Free Pascal's declared TDateTime structure.
  • function: DateToStr()
All: This function conflicts with Free Pascal own DateToStr function.
  • function: AllocDosObjectTags()
MorphOS: Function missing.
  • const: ACTION_READ
MorphOS: Defines this constant as 'R', which is incompatible with TDOSPacket.dp_Type (LONG)
Remark: Amiga + AROS defines this constant as ACTION_READ = $52; // 'R'
  • const: ACTION_WRITE
MorphOS: Defines this constant as 'W', which is incompatible with TDOSPacket.dp_Type (LONG)
Remark: Amiga + AROS defines this constant as ACTION_WRITE = $57; // 'W'
  • unit: CyberGraphics
MorphOS: Missing
  • Function: ReadArgs()
autodocs: struct RDArgs * ReadArgs(STRPTR, LONG *, struct RDArgs *)
Amiga: FUNCTION ReadArgs(const arg_template : pCHAR location 'd1'; arra : pLONGINT location 'd2'; args : pRDArgs location 'd3') : pRDArgs; syscall _DOSBase 798;
AROS: function ReadArgs(const Template: STRPTR; var Array_: IPTR; RdArgs: PRDArgs): PRDArgs; syscall AOS_DOSBase 133;
MorphOS: function ReadArgs(arg_template: PChar location 'd1'; var array1: LongInt location 'd2'; args: PRDArgs location 'd3'): PRDArgs; SysCall MOS_DOSBase 798;
Remark: using var for Array_ parameter is ok, but restricts when attempting to pass f.i. a record structure. Why not declare both variants in such cases ?
  • function ObtainBestPen()
MorphOS: Missing
  • structure TWindow field WScreen
Autodocs: struct Screen *WScreen;
Amiga: WScreen : Pointer;
AROS: WScreen : PScreen;
MorphOS: WScreen : Pointer;
  • macro: RASSIZE()
Amiga: missing
MorphOS: missing
  • unit: diskfont
MorphOS: missing
  • Const: MIDDLEUP
Amiga: Missing
MorphOS: Missing
  • Const: MIDDLEDOWN
Amiga: Missing
MorphOS: Missing
  • field: dri_pens of structure tDrawInfo
Autodocs: UWORD *dri_Pens; /* pointer to pen array */
Amiga: dri_Pens : Pointer; { pointer to pen array }
AROS: dri_Pens : PWord; // pointer to pen array
MorphOS: dri_Pens : Pointer; { pointer to pen array }
Remark: afaik the pen array is an array of word (for all platforms), so the only really practical type for dri_pens would then be a Pointer to an unsigned word


amigalib specifics:

  • function: CreatePort()
Missing for AROS and MorphOS
  • function: DeletePort()
Missing for AROS and MorphOS
  • function: CreateExtIO()
Missing for AROS and MorphOS
  • function: DeleteExtIO()
Missing for AROS and MorphOS


Fixed in current trunk:

  • function: GetAttr() fixed in trunk [1]
MorphOS uses a var for parameter Return-Value while Amiga + AROS uses a pointer. Autodocs states it to be a pointer.
  • function: AllocMem() (high priority) Fixed in trunk [2]
MorphOS implemented it as ExecAllocMem
Amiga + AROS version have this function declared as AllocMem(), which is ambiguous with Free Pascal's AllocMem function.
  • function: Info() fixed in trunk [3]
AutoDocs: BOOL = Info( BPTR, struct InfoData * )
Amiga declaration: FUNCTION Info(lock : LONGINT location 'd1'; parameterBlock : pInfoData location 'd2') : LongBool; syscall _DOSBase 114;
AROS declaration: function Info(Lock: BPTR; ParameterBlock: PInfoData): LongInt; syscall AOS_DOSBase 19;
MorphOS declaration: function Info(lock : LongInt location 'd1'; parameterBlock: PInfoData location 'd2'): LongInt; SysCall MOS_DOSBase 114;
  • macros: All MUI macros fixed in trunk [4]
Amiga: The OBJ_xxx() macros are not implemented as macro's at all, rather as a cast to a particular structure in order to obtain information -> that is totally completely wickedly wrong.
MorphOS: See Amiga.
  • Constants: MUIX_R, MUIX_C, MUIX_L, MUIX_N, MUIX_B, MUIX_I, MUIX_U, MUIX_PT and MUIX_PH fixed in trunk [5]
AMIGA + AROS: these MUI constants uses c-language escape code characters, which won't work for Free Pascal.
MorphOS: declared them as they should.
  • function: NextTagItem() fixed in trunk [6]
autodocs: struct TagItem *NextTagItem(struct TagItem **);
Amiga: function NextTagItem(Item : ppTagItem location 'a0') : pTagItem; syscall _UtilityBase 048;
AROS: function NextTagItem(var Item: PTagItem): PTagItem; syscall AOS_UtilityBase 8;
MorphOS: function NextTagItem(tagListPtr: pPTagItem location 'a0'): PTagItem; SysCall MOS_UtilityBase 048;
  • function ReadPixelArray8() fixed in [7]
autodocs: LONG ReadPixelArray8(struct RastPort *, UWORD, UWORD, UWORD, UWORD, UBYTE *, struct RastPort *);
Amiga: FUNCTION ReadPixelArray8(rp: pRastPort location 'a0'; xstart: ULONG location 'd0'; ystart: ULONG location 'd1'; xstop: ULONG location 'd2'; ystop: ULONG location 'd3'; array_: pointer location 'a2'; temprp: pRastPort location 'a1'): LONGINT; syscall GfxBase 780;
AROS: function ReadPixelArray8(Rp: PRastPort; xStart, yStart, xStop, yStop: LongWord; Array_: PByte; TempRp: PRastPort): LongInt; syscall GfxBase 130;
MorphOS: function ReadPixelArray8(rp: pRastPort location 'a0'; xstart: CARDINAL location 'd0'; ystart: CARDINAL location 'd1'; xstop: CARDINAL location 'd2'; ystop: CARDINAL location 'd3'; array1: pCHAR location 'a2'; temprp: pRastPort location 'a1'): LongInt; SysCall GfxBase 780;
Remark: PChar for pointing to Array data ?
  • function WritePixelArray8()
See: ReadPixelArray8()
  • function PolyDraw() fixed in trunk [8]
Autodocs: void PolyDraw( struct RastPort *, WORD, WORD * );
Amiga: PROCEDURE PolyDraw(rp : pRastPort location 'a1'; count : LONGINT location 'd0';const polyTable : pLongint location 'a0'); syscall GfxBase 336;
AROS: procedure PolyDraw(Rp: PRastPort; Count: LongInt; PolyTable: PSmallInt); syscall GfxBase 56;
MorphOS: procedure PolyDraw(rp : pRastPort location 'a1'; count : LongInt location 'd0'; VAR polyTable : INTEGER location 'a0'); SysCall GfxBase 336;
Remark: MorphOS' use of var for argument polyTable is imho just plain weird and also dictates the array to consist out of integers. Amiga version dictates using LongInt for the PolyTable array.

Some of your finest

  • AslRequest()
 {$IFDEF AMIGA}
 if (AslRequest(fr, nil) <> 0) then
 {$ENDIF}
 {$IFDEF AROS}
 if (AslRequestA(fr, nil)) then
 {$ENDIF}
 {$IFDEF MORPHOS}
 if (AslRequest(fr, nil)) then
 {$ENDIF}
 begin
  // Could we now please check what the requester returned ?
 end;


Hardening trinity

In order to circumvent some of the inconsistencies and incompatibilities, there was need for a solution without tempering with the RTL and/or default support units.

That's were unit trinity comes into play, which solves some of the encountered issues (the unit itself is a work in progress). It provides the user with a way to solve things and let sources compile without too much hassle/workarounds.

The latest version of unit trinity is kindly provided by Magorium and can be found here.