A LONG time ago I recall seeing a manual for SPL to C conversion on the
3000.
I don't recall if there was an actual product behind it or just a helpful
manual on how to do it.
If you can track it down it may help with some of your tasks.
Bob Comeau
Sr. Systems Programmer Analyst
Crossley Carpet Mills Ltd.
(902)895-5491 ex 139
-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]]On
Behalf Of Peter Smithson
Sent: April 15, 2005 10:48 AM
To: [log in to unmask]
Subject: SPL - intialising variables (again)
Hi,
I know everyone was very clear that they don't get initialised. I think
that either this customer was very lucky that his code worked or maybe
there's a different rule for arrays? Last time they were assuming an
INTEGER was zero but this time I've got -
PROCEDURE blah
...
BEGIN
INTEGER ARRAY
...
,DATA'SEG (0:LAST'INDEX)
,MASK'CONT (*)=DATA'SEG(MASK'CONTENTS)
,MASK'LEN (*)=MASK'CONT(1)
...
IF MASK'CONT <> 0 THEN
I think that's bad as I can't see how MASK'CONT got set (well, it's set to
an element of DATA'SEG but that's not set either).
In C I'd understand that to be
int
...
,DATA_SEG [LAST_INDEX+1]
,*MASK_CONT = &DATA_SEG[MASK_CONTENTS]
,*MASK_LEN = &MASK_CONT[1]
...
if (*MASK_CONT != 0)
Is that an accurate translation? The only reason I can think that the
original SPL code is valid is that -
1) Local arrays are initialised. (which I doubt given that other local
variables are not)
2) The line ",MASK'LEN (*)=MASK'CONT(1)" has some other meaning than
I understand.
3) It's not valid - they've just been lucky.
I get these kind of problems all the time porting C code as uninitialised
data often only shows up on another compiler/platform. I suppose with SPL
code, it's never been moved around much so now that it's been translated to
C, these kind of issues are coming out.
Cheers
Peter
--
http://www.beluga.freeserve.co.uk
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|