Hi Chris,
On 7 Sep 2002, Chris Borgn=E6s wrote:
> First of all, I'd like to point out a feature of Cobol that most other
> languages aren't good at - storage handling.
> Take a look at this Linkage Section:
> LINKAGE SECTION.
> 01 LnkWAtkTab SYNC.
> 05 LnkWAtkRec OCCURS 20 TIMES INDEXED BY WAR-Idx.
> 10 LnkCritMinRoll OCCURS 5 TIMES INDEXED BY CMR-Idx.
> PIC 999 COMP.
> 10 LnkDiv PIC 99 COMP.
> 10 LnkCritTyp PIC XXX.
>
> The sync is necessary so C knows where a structure begins - on a word or
> half-word boundary. Without it the call returns gibberish. If it were
> Cobol calling this module the sync wouldn't be necessary!
>
> Here's the problem: where are the indexes' storage placed? I've got
> stuctures in C that don't include them:
>
> typedef struct {
> char WCd[2];
> =09int=09 CritMinRoll[5];
> =09int=09 Div;
> =09char=09CritTyp[3];
> } WAtkTab;
>
> WAtkTab=09Weapon[20];
In current TC's implementation, the index variable gets a separate storage
area. If you want to change the index, you must explicitly pass it to your
C subroutine.
best regards,
Rildo
------------------------------------------------------------------
Rildo Pragana FPGA/uControllers * Linux * tcl/tk
R.Joaquim Nabuco,92/302 Derby http://www.pragana.net
Recife, PE - Brazil 52011-000 +55-81-3223-5694
|