* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "If it's squinky, then you know it's BrilligWare!" * * * * * * * * Source available at http://pando.org/downloads * * * * Brillig Enterprises (aka Chris Pando) (C)2004 * * * * * * * * This work is licensed under a Creative Commons * * * * Attribution-NonCommercial-ShareAlike License: * * * * http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * print heap * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is quick and dirty. Nothing to verify array indices, * * and (shudder) a lookup against an unordered array. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * CRTBNDRPG PGM(CPANDO/CP1222R) SRCFILE(CPANDO/SRC) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * h actgrp(*caller) dftactgrp(*no) bnddir('QC2LE') * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... files ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * fqsysprt o f 132 printer OflInd(*InOF) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... procedure interfaces ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * d cp1222r pr d usrspc 20a d cp1222r pi d usrspc 20a * * external procedures (from the C run-time library) * d memcpy pr ExtProc('memcpy') d * Value d * Value d 10i 0 Value * * external programs (from the Object APIs) * d rtvPtr pr ExtPgm('QUSPTRUS') d 20a d * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... data structures ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * d recordDS ds Based(ds@) d parent@ * d morp 1a d option 2a d object 10a d pathLen 10i 0 d pathVar 1a * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... standalone variables ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * d ds@ s * Based(UsrSpcOffSet@) d text s 120a d linCnt s 5i 0 d parent s 5i 0 d @@ s * Dim(32000) d @ s 5i 0 Dim(32000) d $I s 5i 0 d $J s 5i 0 d recordDSLen s 10i 0 Inz(%Len(recordDS)) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mainline * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /free *InLR = *On; rtvPtr( usrSpc : UsrSpcOffSet@ ); DoU (ds@ = *NULL); linCnt = linCnt + 1; text = *Blanks; memcpy( %Addr(text) : ds@ + 16 : (recordDSLen + pathLen - 17) ); $J = %LookUp( parent@ : @@ : 1 : $I); Monitor; // This is really sleazy, parent = @($J); // only fails first time On-Error; parent = 0; EndMon; If ( morp = 'M' ); $I = $I + 1; @@($I) = ds@; @($I) = linCnt; EndIf; Except Detail; UsrSpcOffSet@ = UsrSpcOffSet@ + 16; EndDo; Return; /end-free * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... *INZSR ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * CSR *INZSR BEGSR CSR ENDSR * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... "O" specs ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Oqsysprt e detail O linCnt z 5 O parent z 11 O text 132