DIRECTORY
Basics USING [bytesPerWord],
BcdDefs USING [BCD, FTIndex, FTRecord, MTIndex, MTNull, MTRecord, SGRecord, VersionID, VersionStamp],
CodeLister USING [ListCode, ListFGT],
Commander USING [CommandProc, Register],
CommandTool USING [Failed, ParseToList],
ConvertUnsafe USING [SubString],
FS,
FSBackdoor,
Literals USING [LitDescriptor, LTIndex, LTNull, LTRecord, MSTIndex, STIndex, STNull],
ListerUtils USING [PrintIndex, PrintName, PrintSE, PrintSei, PrintTree, PrintVersion, ReadMtr, ReadSgr, ShortName],
IO USING [Close, GetChar, PutChar, PutF, PutF1, PutFR1, PutRope, RIS, RopeFromROS, ROS, SetIndex, STREAM, UnsafeGetBlock],
Rope USING [Compare, Concat, Equal, Fetch, Flatten, Length, Match, Replace, ROPE, SkipTo],
SymbolPack,
Symbols USING [BitAddress, BodyRecord, BTIndex, ContextLevel, CSEIndex, CTXIndex, CTXNull, CTXRecord, HTIndex, ISEIndex, ISENull, lG, lL, lZ, MDIndex, Name, nullName, RootBti, SEIndex, SENull, SERecord, TransferMode, TypeClass, typeTYPE],
SymbolTable USING [Acquire, Base, Release],
Tree USING [Index, Link, NodeName];
T Y P E S & C O N S T A N T S
BCD: TYPE = BcdDefs.BCD;
BitAddress: TYPE = Symbols.BitAddress;
BTIndex: TYPE = Symbols.BTIndex;
BTRecord: TYPE = Symbols.BodyRecord;
bytesPerWord: NAT = Basics.bytesPerWord;
CSEIndex:
TYPE = Symbols.CSEIndex;
typeTYPE: CSEIndex = Symbols.typeTYPE;
ContextLevel:
TYPE = Symbols.ContextLevel;
lZ: ContextLevel = Symbols.lZ;
lG: ContextLevel = Symbols.lG;
lL: ContextLevel = Symbols.lL;
CTXIndex:
TYPE = Symbols.CTXIndex;
CTXNull: CTXIndex = Symbols.CTXNull;
CTXRecord: TYPE = Symbols.CTXRecord;
FTIndex: TYPE = BcdDefs.FTIndex;
FTRecord: TYPE = BcdDefs.FTRecord;
HTIndex: TYPE = Symbols.HTIndex;
ISEIndex:
TYPE = Symbols.ISEIndex;
ISENull: ISEIndex = Symbols.ISENull;
ISERecord: TYPE = SERecord.id;
LTIndex:
TYPE = Literals.LTIndex;
LTNull: LTIndex = Literals.LTNull;
LTRecord: TYPE = Literals.LTRecord;
LitDescriptor: TYPE = Literals.LitDescriptor;
MDIndex: TYPE = Symbols.MDIndex;
MSTIndex:
TYPE = Literals.MSTIndex;
MSTNull: MSTIndex = LOOPHOLE[STNull];
MTIndex:
TYPE = BcdDefs.MTIndex;
MTNull: MTIndex = BcdDefs.MTNull;
MTRecord: TYPE = BcdDefs.MTRecord;
Name:
TYPE = Symbols.Name;
nullName: Name = Symbols.nullName;
NodeName: TYPE = Tree.NodeName;
RefBCD: TYPE = REF BCD;
RefMTRecord: TYPE = REF MTRecord;
RefSGRecord: TYPE = REF SGRecord;
RootBti: BTIndex = Symbols.RootBti;
ROPE: TYPE = Rope.ROPE;
SEIndex:
TYPE = Symbols.SEIndex;
SENull: SEIndex = Symbols.SENull;
SERecord: TYPE = Symbols.SERecord;
SGRecord: TYPE = BcdDefs.SGRecord;
STIndex:
TYPE = Literals.STIndex;
STNull: STIndex = Literals.STNull;
STREAM: TYPE = IO.STREAM;
SubString: TYPE = ConvertUnsafe.SubString;
SymbolTableBase: TYPE = SymbolTable.Base;
TransferMode: TYPE = Symbols.TransferMode;
TypeClass: TYPE = Symbols.TypeClass;
VersionStamp: TYPE = BcdDefs.VersionStamp;
UC:
PROC [c:
CHAR]
RETURNS [
CHAR] = {
IF c IN ['a..'z] THEN RETURN ['A + (c - 'a)]
ELSE RETURN [c]};
ListSymbols: Commander.CommandProc =
TRUSTED {
[cmd: Handle] RETURNS [result: REF ← NIL, msg: ROPE ← NIL]
in: STREAM = IO.RIS[cmd.commandLine];
name: ROPE;
tempName: ROPE;
combinedSymbols, totalFiles: LIST OF REF ANY ← NIL;
sortedSymbols: BOOL ← cmd.procData.clientData = $SortedSymbols OR cmd.procData.clientData = $SortedDefs;
stream: STREAM ← NIL;
inStream: STREAM ← NIL;
stb: SymbolTableBase ← NIL;
any: BOOL ← FALSE;
switches: PACKED ARRAY CHAR['A..'Z] OF BOOL ← ALL[FALSE];
args:
LIST
OF
ROPE ← CommandTool.ParseToList[cmd
! CommandTool.Failed => {msg ← errorMsg; GO TO failed}
].list;
Cleanup:
PROC = {
IF stream # NIL AND stream # cmd.out THEN IO.Close[stream];
IF inStream # NIL THEN IO.Close[inStream];
IF stb # NIL THEN {SymbolTable.Release[stb]; stb ← NIL};
};
IsInCache:
PROC [name:
ROPE]
RETURNS [present:
BOOL ←
FALSE] = {
noteName: FSBackdoor.NameProc =
TRUSTED {
[fullGName: ROPE] RETURNS [continue: BOOLEAN]
present ← TRUE;
continue ← FALSE;
};
FSBackdoor.EnumerateCacheForNames[proc: noteName, pattern: name];
};
EachName:
FS.NameProc =
TRUSTED {
[fullFName: ROPE] RETURNS [continue: BOOL]
IF IsInCache[fullFName]
THEN tempName ← fullFName
ELSE
tempName ←
FS.Copy[from: fullFName, to: "///Temp/Lister.temp$", setKeep:
TRUE, keep: 6, remoteCheck:
FALSE
! FS.Error => {msg ← error.explanation; GO TO failed}
];
inStream ←
FS.StreamOpen[fileName: tempName, remoteCheck:
FALSE, streamOptions: [
FALSE,
TRUE,
TRUE,
TRUE,
TRUE]
! FS.Error => {msg ← error.explanation; GO TO failed}
];
{
ENABLE
UNWIND => Cleanup[];
short: ROPE ← ListerUtils.ShortName[fullFName];
bcd: RefBCD ← NEW[BCD];
ext: ROPE ← NIL;
outName: ROPE ← NIL;
configOk: BOOL ← FALSE;
defsOK: BOOL ← FALSE;
file: FS.OpenFile ← FS.OpenFileFromStream[inStream];
[] ←
IO.UnsafeGetBlock[
inStream,
[base: LOOPHOLE[bcd], startIndex: 0, count: SIZE[BCD]*bytesPerWord]];
IF switches['M] AND (bcd.nConfigs # 0 OR bcd.definitions) THEN GO TO processNext;
SELECT cmd.procData.clientData
FROM
$Bodies => ext ← ".bodyList";
$Code => ext ← ".codeList";
$FGT => ext ← ".fgtList";
$Files => {ext ← ".filesList"; configOk ← TRUE; defsOK ← TRUE};
$Symbols => {ext ← ".symbolList"; defsOK ← TRUE};
$Using => {ext ← ".usingList"; defsOK ← TRUE};
ENDCASE => ext ← ".list";
IF ext #
NIL
THEN {
SELECT
TRUE
FROM
switches['C] => ext ← NIL;
Rope.Match["*.bcd", short,
FALSE] =>
outName ← short.Replace[short.Length[]-4, 4, ext];
ENDCASE => outName ← short.Concat[ext];
};
SELECT
TRUE
FROM
bcd.versionIdent # BcdDefs.VersionID =>
IO.PutF1[cmd.out, "Not a valid Cedar bcd file: %g\n", [rope[short]]];
bcd.nConfigs # 0
AND ~configOk =>
IO.PutF1[cmd.out, "Bound configurations not supported: %g\n", [rope[short]]];
bcd.definitions
AND
NOT defsOK =>
IO.PutF1[cmd.out, "Definitions files not supported: %g\n", [rope[short]]];
ENDCASE => {
sourceName: ROPE ← NIL;
IF bcd.nConfigs = 0
THEN {
Now we have a single-module file.
Get the module.
mtr: RefMTRecord = ListerUtils.ReadMtr[inStream, bcd, LOOPHOLE[0]];
sgr: RefSGRecord = ListerUtils.ReadSgr[inStream, bcd, mtr.sseg];
pages:
CARDINAL =
IF bcd.extended THEN sgr.pages+sgr.extraPages ELSE sgr.pages;
IF pages = 0
THEN {
IO.PutF1[cmd.out, "Error - no symbols from %g\n", [rope[fullFName]]];
result ← $Failure;
GO TO bailOut;
};
stb ← SymbolTable.Acquire[[file, [sgr.base-1, pages]]];
};
Get the source fullFName for later
sourceName ← RopeForBcdName[inStream, bcd.ssOffset, bcd.source];
Open the output stream (if any)
IF ext =
NIL
THEN {
stream ← cmd.out;
IO.PutF1[stream, "Listing for %g\n", [rope[fullFName]] ];
}
ELSE {
IO.PutF[
cmd.out, "%g output to %g\n", [rope[cmd.command]], [rope[outName]]];
stream ← FS.StreamOpen[outName, $create];
IO.PutRope[stream, outName];
};
IF sortedSymbols
THEN {
IF ~bcd.definitions AND cmd.procData.clientData = $SortedDefs THEN GO TO bailOut;
totalFiles ← CONS[short, totalFiles];
}
ELSE {
IO.PutF1[stream, "\n object: %g {", [rope[short]]];
ListerUtils.PrintVersion[bcd.version, stream];
IO.PutRope[stream, "}\n source: "];
IO.PutRope[stream, sourceName];
IO.PutRope[stream, " {"];
ListerUtils.PrintVersion[bcd.sourceVersion, stream, TRUE];
IO.PutRope[stream, "}\n creator: {"];
ListerUtils.PrintVersion[bcd.creator, stream];
IO.PutRope[stream, "}\n\n"];
};
SELECT cmd.procData.clientData
FROM
$Bodies => PrintBodies[stream, stb];
$Code => CodeLister.ListCode[stream, inStream, stb, bcd, NIL];
$FGT => CodeLister.ListFGT[stream, inStream, stb, bcd];
$Files => PrintFiles[stream, bcd, fullFName];
$Symbols => PrintSymbols[bcd.definitions, stream, stb];
$Using => PrintUsing[stream, stb];
ENDCASE;
EXITS bailOut => {};
};
Cleanup[];
continue ← TRUE;
EXITS processNext => continue ← TRUE;
};
EXITS failed => {result ← $Failed; Cleanup[]; continue ← FALSE};
};
WHILE args #
NIL
DO
name ← args.first;
args ← args.rest;
SELECT
TRUE
FROM
Rope.Match["-*", name] => {
sense: BOOL ← TRUE;
num: INT ← 0;
FOR i:
INT
IN [1..Rope.Length[name])
DO
c: CHAR ← Rope.Fetch[name, i];
SELECT c
FROM
IN ['A..'Z] => switches[c] ← sense;
IN ['a..'z] => switches[c-('a-'A)] ← sense;
IN ['0..'9] => num ← num * 10 + (c - '0);
'~ => sense ← NOT sense;
ENDCASE;
ENDLOOP;
LOOP;
};
Rope.Match["*.bcd", name, FALSE], Rope.Match["*.bcd!*", name, FALSE] => {};
ENDCASE => name ← Rope.Concat[name, ".bcd"];
any ← TRUE;
name ←
FS.ExpandName[name
! FS.Error => {msg ← error.explanation; GO TO failed};
].fullFName;
IF NOT Rope.Match["*!*", name] THEN name ← Rope.Concat[name, "!h"];
FS.EnumerateForNames[name, EachName];
IF result # NIL THEN GO TO failed;
ENDLOOP;
IF
NOT any
THEN {
result ← $Failure;
msg ← IO.PutFR1["Usage: %g file ...", [rope[cmd.command]]];
};
EXITS failed => result ← $Failure;
};
PrintBodies:
PUBLIC
PROC [stream:
STREAM, stb: SymbolTableBase] = {
PrintBody:
PROC [bti: BTIndex]
RETURNS [
BOOL] = {
body: LONG POINTER TO BTRecord = @stb.bb[bti];
IO.PutRope[stream, "Body: "];
WITH b: body
SELECT
FROM
Callable => {
ListerUtils.PrintSei[b.id, stream, stb];
IF b.inline
THEN IO.PutRope[stream, " [inline]"]
ELSE {
IO.PutF1[stream, ", ep: %g", [cardinal[b.entryIndex]]];
WITH b
SELECT
FROM
Inner => IO.PutF1[stream, ", frame addr: %g", [cardinal[frameOffset]]];
ENDCASE;
};
IO.PutRope[stream, ", attrs: "];
IO.PutChar[stream, IF ~b.noXfers THEN 'x ELSE '-];
IO.PutChar[stream, IF b.hints.safe THEN 's ELSE '-];
IO.PutChar[stream, IF b.hints.nameSafe THEN 'n ELSE '-];
IF ~b.hints.noStrings THEN IO.PutRope[stream, "\n string literals"];
};
ENDCASE => IO.PutRope[stream, "(anon)"];
IO.PutRope[stream, "\n context: "];
ListerUtils.PrintIndex[body.localCtx, stream];
IO.PutF1[stream, ", level: %g", [cardinal[body.level]]];
WITH body.info
SELECT
FROM
Internal => {
IO.PutF1[stream, ", frame size: %g", [cardinal[frameSize]]];
IF body.kind = Callable
THEN ListerUtils.PrintTree[[subtree[index: bodyTree]], 0, stream, stb]
ELSE {IO.PutRope[stream, ", tree root: "]; ListerUtils.PrintIndex[bodyTree, stream]};
};
ENDCASE;
IO.PutRope[stream, "\n\n"];
RETURN [FALSE];
};
[] ← stb.EnumerateBodies[RootBti, PrintBody];
IO.PutRope[stream, "\n"];
};
PrintGlobalFrames:
PUBLIC
PROC [stream:
STREAM, stb: SymbolTableBase] = {
PrintBody:
PROC [bti: BTIndex]
RETURNS [
BOOL] = {
body: LONG POINTER TO BTRecord = @stb.bb[bti];
IO.PutRope[stream, "Body: "];
WITH b: body
SELECT
FROM
Callable => {
ListerUtils.PrintSei[b.id, stream, stb];
IF b.inline
THEN IO.PutRope[stream, " [inline]"]
ELSE {
IO.PutF1[stream, ", ep: %g", [cardinal[b.entryIndex]]];
WITH b
SELECT
FROM
Inner => IO.PutF1[stream, ", frame addr: %g", [cardinal[frameOffset]]];
ENDCASE;
};
IO.PutRope[stream, ", attrs: "];
IO.PutChar[stream, IF ~b.noXfers THEN 'x ELSE '-];
IO.PutChar[stream, IF b.hints.safe THEN 's ELSE '-];
IO.PutChar[stream, IF b.hints.nameSafe THEN 'n ELSE '-];
IF ~b.hints.noStrings THEN IO.PutRope[stream, "\n string literals"];
};
ENDCASE => RETURN [FALSE];
IO.PutRope[stream, "\n context: "];
ListerUtils.PrintIndex[body.localCtx, stream];
IO.PutF1[stream, ", level: %g", [cardinal[body.level]]];
WITH body.info
SELECT
FROM
Internal => {
IO.PutF1[stream, ", frame size: %g", [cardinal[frameSize]]];
IF body.kind = Callable
THEN ListerUtils.PrintTree[[subtree[index: bodyTree]], 0, stream, stb]
ELSE {IO.PutRope[stream, ", tree root: "]; ListerUtils.PrintIndex[bodyTree, stream]};
};
ENDCASE;
IO.PutRope[stream, "\n\n"];
RETURN [FALSE];
};
[] ← stb.EnumerateBodies[RootBti, PrintBody];
IO.PutRope[stream, "\n"];
};
PrintSymbols:
PUBLIC
PROC [definitions:
BOOL, stream:
STREAM, stb: SymbolTableBase] = {
ctx: CTXIndex;
limit: CTXIndex;
limit ← LOOPHOLE[stb.stHandle.ctxBlock.size];
ctx ← CTXIndex.FIRST + CTXRecord.nil.SIZE;
UNTIL ctx = limit
DO
PrintContext[ctx, definitions, stream, stb];
IO.PutRope[stream, "\n\n"];
ctx ← ctx + (
WITH stb.ctxb[ctx]
SELECT
FROM
included => CTXRecord.included.SIZE,
imported => CTXRecord.imported.SIZE,
ENDCASE => CTXRecord.simple.SIZE);
ENDLOOP;
IO.PutRope[stream, "\n"];
};
PrintContext:
PROC [ctx: CTXIndex, definitionsOnly:
BOOL, stream:
STREAM, stb: SymbolTableBase] = {
sei, root: ISEIndex;
cp: LONG POINTER TO CTXRecord = @stb.ctxb[ctx];
IO.PutRope[stream, "Context: "];
ListerUtils.PrintIndex[ctx, stream];
IF stb.ctxb[ctx].level # lZ
THEN
IO.PutF1[stream, ", level: %g", [cardinal[cp.level]]];
WITH c: cp
SELECT
FROM
included => {
IO.PutRope[stream, ", copied from: "];
ListerUtils.PrintName[stb.mdb[c.module].moduleId, stream, stb];
IO.PutRope[stream, " ["];
ListerUtils.PrintName[stb.mdb[c.module].fileId, stream, stb];
IO.PutRope[stream, ", "];
ListerUtils.PrintVersion[stb.mdb[c.module].stamp, stream];
IO.PutRope[stream, "], context: "];
ListerUtils.PrintIndex[c.map, stream];
};
imported => {
IO.PutRope[stream, ", imported from: "];
ListerUtils.PrintName[stb.mdb[stb.ctxb[c.includeLink].module].moduleId, stream, stb];
};
ENDCASE;
root ← sei ← stb.ctxb[ctx].seList;
DO
IF sei = SENull THEN EXIT;
ListerUtils.PrintSE[sei, 2, definitionsOnly , stream, stb];
IF (sei ← stb.NextSe[sei]) = root THEN EXIT;
ENDLOOP;
};
PrintUsing:
PROC [stream:
STREAM, stb: SymbolTableBase] = {
limit: CTXIndex = LOOPHOLE[stb.stHandle.ctxBlock.size];
ctx: CTXIndex ← CTXIndex.FIRST + CTXRecord.nil.SIZE;
firstUsing: BOOL ← TRUE;
pairs: LIST OF Pair ← NIL;
ros: STREAM ← IO.ROS[];
firstCopiedHash: Symbols.HTIndex;
InDirectory:
PROC [ctx: CTXIndex]
RETURNS [
BOOL] = {
FOR dirSei: ISEIndex
← stb.FirstCtxSe[stb.stHandle.directoryCtx], stb.NextSe[dirSei] UNTIL dirSei = ISENull DO
WITH se: stb.seb[stb.UnderType[stb.seb[dirSei].idType]]
SELECT
FROM
definition => IF ctx = se.defCtx THEN RETURN [TRUE];
ENDCASE;
ENDLOOP;
RETURN [FALSE];
};
DoContext:
PROC [ctx: CTXIndex] = {
IF ctx # CTXNull
THEN {
sei, root: ISEIndex;
cp: LONG POINTER TO CTXRecord = @stb.ctxb[ctx];
which: LIST OF Pair ← NIL;
key, modName: ROPE ← NIL;
mdi: MDIndex;
DoSei:
PROC [sei: ISEIndex] = {
sep: LONG POINTER TO ISERecord = @stb.seb[sei];
IF sep.hash < firstCopiedHash
THEN {
name: ROPE ← NIL;
IF sep.idType = typeTYPE
THEN {
typeSei: SEIndex ← sep.idInfo;
WITH tse: stb.seb[typeSei]
SELECT
FROM
id => {
IF tse.idCtx # ctx AND InDirectory[tse.idCtx] THEN RETURN;
};
ENDCASE;
};
ros ← IO.ROS[ros];
ListerUtils.PrintSei[sei, ros, stb];
name ← IO.RopeFromROS[ros, FALSE];
which.first.names ← InsertName[name, which.first.names];
};
};
WITH c: cp
SELECT
FROM
included => {
mdi ← c.module;
};
imported => {
mdi ← stb.ctxb[c.includeLink].module;
};
ENDCASE => RETURN;
Get the module name
ros ← IO.ROS[ros];
ListerUtils.PrintName[stb.mdb[mdi].moduleId, ros, stb];
modName ← IO.RopeFromROS[ros, FALSE];
[which, pairs] ← FindList[modName, pairs];
IF which.first.file =
NIL
THEN {
Get the module file name
modFileName: ROPE ← NIL;
ros ← IO.ROS[ros];
ListerUtils.PrintName[stb.mdb[mdi].fileId, ros, stb];
modFileName ← IO.RopeFromROS[ros, FALSE];
modFileName ← Rope.Flatten[modFileName, 0, Rope.SkipTo[modFileName, 0, "."]];
which.first.file ← modFileName;
};
root ← sei ← stb.ctxb[ctx].seList;
DO
IF sei = SENull THEN EXIT;
DoSei[sei];
IF (sei ← stb.NextSe[sei]) = root THEN EXIT;
ENDLOOP;
};
};
FOR hti: HTIndex
IN (0..
LENGTH[stb.ht])
DO
IF stb.ht[hti].ssIndex = stb.ht[hti - 1].ssIndex
THEN {
firstCopiedHash ← hti; EXIT};
REPEAT FINISHED => firstCopiedHash ← LENGTH[stb.ht];
ENDLOOP;
FOR dirSei: ISEIndex
← stb.FirstCtxSe[stb.stHandle.directoryCtx], stb.NextSe[dirSei] UNTIL dirSei = ISENull DO
WITH se: stb.seb[stb.UnderType[stb.seb[dirSei].idType]]
SELECT
FROM
definition => DoContext[se.defCtx];
ENDCASE;
ENDLOOP;
FOR dirSei: ISEIndex
← stb.FirstCtxSe[stb.stHandle.importCtx], stb.NextSe[dirSei] UNTIL dirSei = ISENull DO
WITH se: stb.seb[stb.UnderType[stb.seb[dirSei].idType]]
SELECT
FROM
definition => DoContext[se.defCtx];
transfer => {
bti: BTIndex = stb.seb[dirSei].idInfo;
DoContext[stb.bb[bti].localCtx];
};
ENDCASE;
ENDLOOP;
At this point all of the entries have been made.
IF pairs =
NIL
THEN IO.PutRope[stream, "No DIRECTORY.\n"]
ELSE {
IO.PutRope[stream, "DIRECTORY\n"];
WHILE pairs #
NIL
DO
pair: Pair = pairs.first;
names: LIST OF ROPE ← pair.names;
IO.PutRope[stream, " "];
IO.PutRope[stream, pair.key];
IF
NOT Rope.Equal[pair.key, pair.file,
FALSE]
THEN {
IO.PutF1[stream, ": FROM \"%g\"", [rope[pair.file]]];
};
IO.PutRope[stream, " USING ["];
WHILE names #
NIL
DO
IO.PutRope[stream, names.first];
IF names.rest # NIL THEN IO.PutRope[stream, ", "];
names ← names.rest;
ENDLOOP;
IF pairs.rest #
NIL
THEN IO.PutRope[stream, "],\n"]
ELSE IO.PutRope[stream, "];\n"];
pairs ← pairs.rest;
ENDLOOP;
};
};
PrintFiles:
PROC [stream:
STREAM, bcd: RefBCD, fileName:
ROPE] = {
FTRSeq: TYPE = RECORD [SEQUENCE len: NAT OF FTRecord];
inStream: STREAM = FS.StreamOpen[fileName, $read];
fti: CARDINAL = LOOPHOLE[FIRST[FTIndex]];
nFiles: CARDINAL = (bcd.ftLimit-FIRST[FTIndex])/SIZE[FTRecord];
bytes: CARDINAL = nFiles*SIZE[FTRecord]*bytesPerWord;
fileSeq: REF FTRSeq = NEW[FTRSeq[nFiles]];
ftp: LONG POINTER TO FTRecord ← @fileSeq[0];
IO.PutF1[stream, "# files: %g\n\n", [integer[nFiles]]];
IO.SetIndex[inStream, (fti+bcd.ftOffset)*bytesPerWord];
[] ←
IO.UnsafeGetBlock[
inStream,
[base: LOOPHOLE[@fileSeq[0]], startIndex: 0, count: bytes]];
FOR i:
NAT
IN [0..nFiles)
DO
IO.PutF[
stream, "%g - fti: %g",
[rope[RopeForBcdName[inStream, bcd.ssOffset, ftp.name]]],
[integer[i*SIZE[FTRecord]]]];
IO.PutRope[stream, ", version: "];
ListerUtils.PrintVersion[ftp.version, stream];
IO.PutRope[stream, "\n"];
ftp ← ftp + SIZE[FTRecord];
ENDLOOP;
IO.Close[inStream];
};
I N I T
Commander.Register[
"CodeLister", ListSymbols,
"List the code for a bcd file.", $Code];
Commander.Register[
"ExportsLister", ListSymbols,
"List the exports for a bcd file.", $Exports];
Commander.Register[
"FGTLister", ListSymbols,
"List the fine grain table for a bcd file.", $FGT];
Commander.Register[
"FilesLister", ListSymbols,
"List the items used by a bcd file.", $Files];
Commander.Register[
"GlobalFramesLister", ListSymbols,
"List the global frames for a bcd file.", $Globals];
Commander.Register[
"SymbolLister", ListSymbols,
"List the symbols for a bcd file.", $Symbols];
Commander.Register[
"UnboundLister", ListSymbols,
"List the items used by a bcd file.", $Unbound];
Commander.Register[
"UsingLister", ListSymbols,
"List the items used by a bcd file.", $Using];