Subject: | |
From: | |
Reply To: | |
Date: | Fri, 22 May 1998 11:41:18 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Ernest writes:
>
> I am continuing is my attempt to write CM switch stubs for the new date
> intrinsics since Gopi informed me HP has no plans for CM versions of them.
> HPDATECONVERT, HPDATEDIFF, HPDATEOFFSET and HPCALENDAR are working fine,
> but I can't seem to get HPDATEFORMAT to work. No matter what I pass for the
> input date I get -2 returned in the first word on the status. Since we
...
> Procedure hpdateformat (
> date_code : integer;
> var input_date : integer;
> var formatspec : pac16;
> var fmtdate : pac16;
> var fmtdatelen : integer;
> var dt_status : shr_ary4;
> cut_off : integer );
>
> var
>
> arglist[8] := waddress(fmtdatelen);
> argdesc[6] := 6;
>
> arglist[9] := waddress(ws_status);
> if (arglist[9] Mod 2 > 0) then
> arglist[9] := arglist[9] + 1;
>
> argdesc[7] := 6;
>
> arglist[10] := 0;
> arglist[11] := cut_off;
> argdesc[7] := 3;
...
Just a guess, but you may have learned why you don't want multiple lines of
inline code building the HPSWTONNAME parameters. :)
Note that you have two instances of "argdesc[7] :=". Presumably the second
one should be [8], not [7]. Now, as to whether or not that fixes your
problem...I don't know.
I recommend using helper routines, like:
Procedure add_item_16 ( {adds one 16-bit argument}
ityp : shortint;
ival : shortint);
begin
if next_desc_inx > max_desc_inx then
fail...
argdesc [next_desc_inx] := inum;
next_desc_inx := next_desc_inx + 1;
if next_list_inx > max_list_inx then
fail...
arglist [next_list_inx] := ival;
next_list_inx := next_list_inx + 1;
end {add_item16 proc};
Procedure add_item_32 ( {adds one 32-bit argument}
ityp : shortint;
ival : integer);
type
fake_type = record
case boolean of
false: (i32 : integer);
true: (half1 : shortint;
half2 : shortint);
end;
var
wish_i_had_type_coercion : fake_type;
begin
if next_desc_inx > max_desc_inx then
fail...
argdesc [next_desc_inx] := inum;
next_desc_inx := next_desc_inx + 1;
if next_list_inx >= max_list_inx then
fail...
wish_i_had_type_coercion.i32 := ival;
arglist [next_list_inx] := wish_i_had_type_coercion.half1;
arglist [next_list_inx + 1] := wish_i_had_type_coercion.half2;
next_list_inx := next_list_inx + 2;
end {add_item32 proc};
Then, you can use them like:
...
add_item_16 (typ_waddress, waddress (fmtdatelen));
{Pass a 32-bit (NM) aligned address for status...}
if odd (waddress (ws_status)) then
add_item_16 (typ_waddress, waddress (ws_status) + 1)
else
add_item_16 (typ_waddress, waddress (ws_status));
...
--
Stan Sieler [log in to unmask]
http://www.allegro.com/sieler.html
|
|
|