PETModuleTree.Mod 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038
  1. MODULE PETModuleTree; (** AUTHOR "?"; PURPOSE "Visualize module structure as tree"; *)
  2. IMPORT
  3. Commands, Diagnostics, Streams, Files, TextUtilities, WMStandardComponents, WMGraphics, WMProperties, WMComponents,
  4. Strings, WMTrees, FoxScanner, ModuleParser, PETTrees;
  5. CONST
  6. Title = " Program Structure";
  7. TitleError = " Program Structure (Errors)";
  8. ShowImages = TRUE;
  9. ImageActive = "ModuleTreesIcons.tar://activity.png";
  10. ImageCommandProc = "ModuleTreesIcons.tar://arrow-red.png";
  11. ImageContextProc = "ModuleTreesIcons.tar://arrow-green.png";
  12. (* Coloring for types *)
  13. ColorTypes = 000008FFFH;
  14. ColorObjects = WMGraphics.Blue;
  15. ColorActiveObjects = ColorObjects;
  16. (* Coloring for procedures *)
  17. ColorProcedure = WMGraphics.Black;
  18. ColorExclusive = WMGraphics.Red;
  19. ColorHasExclusiveBlock = WMGraphics.Magenta;
  20. ColorInterrupt = 00CCCCFFH; (* dark cyan *)
  21. SortIgnore = 1;
  22. SortProcedure = 2;
  23. SortNo = 90;
  24. SortBody = 99;
  25. (* Info.flags *)
  26. NotPublic = 0;
  27. (* Special procedure types *)
  28. Other = 0;
  29. CommandProc = 1; (* PROCEDURE(); *)
  30. ContextProc = 2; (* PROCEDURE(context : Commands.Context); *)
  31. TYPE
  32. Name = ARRAY 32 OF CHAR;
  33. TYPE
  34. TreeNode = OBJECT(PETTrees.TreeNode);
  35. VAR
  36. commandName : Strings.String; (* name of command procedure if node represent an executable command *)
  37. modulename : Name;
  38. sortHint : LONGINT;
  39. flags : SET;
  40. position : LONGINT;
  41. PROCEDURE &Init*;
  42. BEGIN
  43. Init^;
  44. commandName := NIL;
  45. modulename := "";
  46. sortHint := SortIgnore;
  47. flags := {};
  48. position := 0;
  49. END Init;
  50. END TreeNode;
  51. TYPE
  52. ModuleTree* = OBJECT (PETTrees.Tree)
  53. VAR
  54. showTypeHierarchy-, showImportedModules- : WMProperties.BooleanProperty;
  55. moduleName : Name;
  56. detailsBtn, publicBtn: WMStandardComponents.Button;
  57. showPublicOnly : BOOLEAN;
  58. PROCEDURE & Init*;
  59. BEGIN
  60. Init^;
  61. NEW(showTypeHierarchy, PrototypeShowTypeHierarchy, NIL, NIL); properties.Add(showTypeHierarchy);
  62. NEW(showImportedModules, PrototypeShowImportedModules, NIL, NIL); properties.Add(showImportedModules);
  63. moduleName := "NONE";
  64. showPublicOnly := FALSE;
  65. NEW(detailsBtn); detailsBtn.alignment.Set(WMComponents.AlignLeft);
  66. detailsBtn.caption.SetAOC("Details");
  67. detailsBtn.isToggle.Set(TRUE);
  68. detailsBtn.SetPressed(FALSE);
  69. detailsBtn.onClick.Add(ShowDetailsHandler);
  70. toolbar.AddContent(detailsBtn);
  71. NEW(publicBtn); publicBtn.alignment.Set(WMComponents.AlignClient);
  72. publicBtn.caption.SetAOC("PublicOnly");
  73. publicBtn.SetPressed(FALSE);
  74. publicBtn.isToggle.Set(TRUE);
  75. publicBtn.onClick.Add(ShowPublicHandler);
  76. toolbar.AddContent(publicBtn);
  77. END Init;
  78. PROCEDURE PropertyChanged*(sender, data : ANY);
  79. BEGIN
  80. IF (data = showTypeHierarchy) OR (data = showImportedModules) THEN
  81. RefreshHandler(NIL, NIL);
  82. ELSE
  83. PropertyChanged^(sender, data);
  84. END;
  85. END PropertyChanged;
  86. PROCEDURE ShowDetailsHandler(sender, data : ANY);
  87. VAR isPressed : BOOLEAN;
  88. BEGIN
  89. IF ~IsCallFromSequencer() THEN
  90. sequencer.ScheduleEvent(SELF.ShowPublicHandler, sender, data);
  91. ELSE
  92. isPressed := detailsBtn.GetPressed();
  93. Acquire;
  94. showTypeHierarchy.Set(isPressed);
  95. showImportedModules.Set(isPressed);
  96. Release;
  97. END;
  98. END ShowDetailsHandler;
  99. PROCEDURE ShowPublicHandler(sender, data : ANY);
  100. BEGIN
  101. IF ~IsCallFromSequencer() THEN
  102. sequencer.ScheduleEvent(SELF.ShowPublicHandler, sender, data);
  103. ELSE
  104. showPublicOnly := ~showPublicOnly;
  105. publicBtn.SetPressed(showPublicOnly);
  106. tree.Acquire;
  107. SetNodeVisibilities(tree.GetRoot(), showPublicOnly);
  108. tree.Release;
  109. END;
  110. END ShowPublicHandler;
  111. PROCEDURE SetNodeVisibilities(parent : WMTrees.TreeNode; showPublicOnly : BOOLEAN);
  112. VAR n : WMTrees.TreeNode; state : SET;
  113. BEGIN
  114. n := tree.GetChildren(parent);
  115. WHILE n # NIL DO
  116. SetNodeVisibilities(n, showPublicOnly);
  117. state := tree.GetNodeState(n);
  118. IF (n IS TreeNode) THEN
  119. IF NotPublic IN n(TreeNode).flags THEN
  120. IF showPublicOnly THEN INCL(state, WMTrees.NodeHidden) ELSE EXCL(state, WMTrees.NodeHidden); END;
  121. END;
  122. END;
  123. tree.SetNodeState(n, state);
  124. n := tree.GetNextSibling(n);
  125. END;
  126. END SetNodeVisibilities;
  127. PROCEDURE AddModule(node : WMTrees.TreeNode; module : ModuleParser.Module; expand, showPublicOnly, showTypeHierarchy, showImportedModules : BOOLEAN);
  128. BEGIN (* tree must be locked!!! *)
  129. IF (node IS TreeNode) THEN
  130. SetNodeInfo(node(TreeNode), module, module.ident, TRUE, SortIgnore, treeView.clTextDefault.Get(), {});
  131. END;
  132. IF (module.ident # NIL) & (module.ident.name # NIL) THEN
  133. tree.SetNodeCaption(node, module.ident.name);
  134. ELSE
  135. tree.SetNodeCaption(node, StrUNKNOWN);
  136. END;
  137. IF (module.context # NIL) & (module.context.name # NIL) THEN
  138. AddPostfixToCaption(node, StrIN);
  139. AddPostfixToCaption(node, module.context.name);
  140. END;
  141. AddImportList(node, module.importList, showImportedModules);
  142. AddDefinitions(node, module.definitions);
  143. AddDeclSeq(node, module.declSeq);
  144. IF module.bodyPos # 0 THEN
  145. AddBody (node, module, module.modifiers, module.bodyPos);
  146. END;
  147. IF expand THEN tree.SetNodeState(node, {WMTrees.NodeExpanded}); END;
  148. SetNodeVisibilities(node, showPublicOnly);
  149. END AddModule;
  150. PROCEDURE GetNewNode*() : PETTrees.TreeNode; (* overwrite *)
  151. VAR node : TreeNode;
  152. BEGIN
  153. NEW(node); RETURN node;
  154. END GetNewNode;
  155. PROCEDURE AddNodes*(parent : PETTrees.TreeNode; diagnostics : Diagnostics.Diagnostics; log : Streams.Writer);
  156. VAR module : ModuleParser.Module; scanner : FoxScanner.Scanner; reader : TextUtilities.TextReader;
  157. BEGIN
  158. ASSERT(diagnostics # NIL);
  159. AddNodes^(parent, diagnostics, log);
  160. NEW(reader, editor.text);
  161. scanner := FoxScanner.NewScanner("PETModuleTree", reader, 0, diagnostics);
  162. ModuleParser.Parse(scanner, module);
  163. IF (module # NIL) THEN
  164. IF (module.ident # NIL) & (module.ident.name # NIL) THEN
  165. COPY(module.ident.name^, moduleName);
  166. ELSE
  167. moduleName := "UNKOWN";
  168. END;
  169. IF showTypeHierarchy.Get() THEN
  170. ModuleParser.SetSuperTypes(module);
  171. END;
  172. AddModule(parent, module, TRUE, showPublicOnly, showTypeHierarchy.Get(), showImportedModules.Get());
  173. IF module.hasError THEN SetTitle(TitleError);
  174. ELSE SetTitle(Title);
  175. END;
  176. ELSE
  177. moduleName := "UNKNOWN";
  178. END;
  179. END AddNodes;
  180. PROCEDURE ClickNode*(sender, data : ANY);
  181. VAR node : WMTrees.TreeNode; extInfo : PETTrees.ExternalInfo;
  182. BEGIN
  183. IF (data # NIL) & (data IS WMTrees.TreeNode) THEN
  184. tree.Acquire;
  185. node := data(WMTrees.TreeNode);
  186. IF (node IS TreeNode) & (node(TreeNode).pos = NIL) THEN
  187. (* Use pos of child (for VAR, CONST and IMPORT) *)
  188. node := tree.GetChildren(node);
  189. END;
  190. tree.Release;
  191. IF (node # NIL) & (node IS TreeNode) THEN
  192. IF (node(TreeNode).modulename = moduleName) THEN
  193. IF (node(TreeNode).pos # NIL) THEN
  194. SetEditorPosition(node(TreeNode).pos.GetPosition(), TRUE);
  195. END;
  196. ELSE
  197. NEW(extInfo, node(TreeNode).modulename, node(TreeNode).position);
  198. onGoToFile.Call(extInfo);
  199. END;
  200. END
  201. END
  202. END ClickNode;
  203. PROCEDURE MiddleClickNode*(sender, data : ANY);
  204. VAR commandStr, ignoreMsg : ARRAY 128 OF CHAR; len: LONGINT; ignore: WORD;
  205. BEGIN
  206. IF (data # NIL) & (data IS TreeNode) & (data(TreeNode).commandName # NIL) & (data(TreeNode).modulename # "") THEN
  207. COPY(data(TreeNode).modulename, commandStr);
  208. Strings.Append(commandStr, Commands.Delimiter);
  209. Strings.Append(commandStr, data(TreeNode).commandName^);
  210. len := Strings.Length(commandStr);
  211. IF (commandStr[len-1] = "*") THEN commandStr[len-1] := 0X; END;
  212. Commands.Activate(commandStr, NIL, {}, ignore, ignoreMsg);
  213. END;
  214. END MiddleClickNode;
  215. PROCEDURE SetNodeInfo(node : TreeNode; mnode : ModuleParser.Node; infoItem: ModuleParser.InfoItem; isPublic : BOOLEAN; sortHint, color: LONGINT; style: SET);
  216. VAR moduleNode : ModuleParser.Module; font: WMGraphics.Font;
  217. BEGIN
  218. node.flags := {};
  219. IF ~isPublic THEN INCL(node.flags, NotPublic); END;
  220. node.sortHint := sortHint;
  221. node.color := color;
  222. IF style = {} THEN
  223. font := PETTrees.FontPlain;
  224. ELSIF style = {WMGraphics.FontBold} THEN
  225. font := PETTrees.FontBold;
  226. ELSIF style = {WMGraphics.FontItalic} THEN
  227. font := PETTrees.FontItalic;
  228. ELSE
  229. (* unknown style *)
  230. font := PETTrees.FontPlain;
  231. END;
  232. node.font := font;
  233. IF (infoItem # NIL) THEN
  234. IF (mnode # NIL) THEN
  235. moduleNode := GetModuleNode(mnode);
  236. ELSE
  237. moduleNode := NIL;
  238. END;
  239. node.position := infoItem.pos;
  240. IF (moduleNode = NIL) OR ((moduleNode.ident # NIL) & (moduleNode.ident.name # NIL) & (moduleNode.ident.name^ = moduleName)) THEN
  241. node.external := FALSE;
  242. node.modulename := moduleName;
  243. NEW(node.pos, editor.text);
  244. node.pos.SetPosition(infoItem.pos);
  245. ELSE
  246. node.external := TRUE;
  247. node.pos := NIL;
  248. COPY(moduleNode.ident.name^, node.modulename);
  249. END;
  250. ELSE
  251. node.modulename := moduleName;
  252. END;
  253. END SetNodeInfo;
  254. PROCEDURE IsPublic(identDef : ModuleParser.IdentDef) : BOOLEAN;
  255. BEGIN
  256. RETURN (identDef.vis = ModuleParser.Public) OR (identDef.vis = ModuleParser.PublicRO);
  257. END IsPublic;
  258. PROCEDURE IsNodeGreater*(left, right: WMTrees.TreeNode): BOOLEAN;
  259. VAR leftCaption, rightCaption, leftTmp, rightTmp: Strings.String;
  260. BEGIN
  261. IF (left IS TreeNode) & (right IS TreeNode) &
  262. (left(TreeNode).sortHint >= right(TreeNode).sortHint) &
  263. (left(TreeNode).font = right(TreeNode).font) &
  264. (left(TreeNode).sortHint # SortNo) &
  265. (right(TreeNode).sortHint # SortNo) THEN
  266. (* continue *)
  267. ELSE
  268. RETURN FALSE;
  269. END;
  270. leftCaption := tree.GetNodeCaption(left);
  271. rightCaption := tree.GetNodeCaption(right);
  272. IF (leftCaption^ = "VAR") OR (rightCaption^ = "VAR") OR
  273. (leftCaption^ = "CONST") OR (rightCaption^ = "CONST") OR
  274. (leftCaption^ = "IMPORT") OR (rightCaption^ = "IMPORT")
  275. THEN RETURN FALSE
  276. END;
  277. leftTmp := Strings.NewString(leftCaption^);
  278. rightTmp := Strings.NewString(rightCaption^);
  279. Strings.TrimLeft(leftTmp^, '-');
  280. Strings.TrimLeft(rightTmp^, '-');
  281. RETURN leftTmp^ > rightTmp^;
  282. END IsNodeGreater;
  283. PROCEDURE HasPublicConsts(constDecl: ModuleParser.ConstDecl) : BOOLEAN;
  284. VAR n : ModuleParser.NodeList; c : ModuleParser.ConstDecl;
  285. BEGIN
  286. n := constDecl;
  287. WHILE (n # NIL) DO
  288. c := n (ModuleParser.ConstDecl);
  289. IF IsPublic(c.identDef) THEN RETURN TRUE; END;
  290. n := n.next;
  291. END;
  292. RETURN FALSE;
  293. END HasPublicConsts;
  294. PROCEDURE HasPublicVars(varDecl : ModuleParser.VarDecl) : BOOLEAN;
  295. VAR n, ni : ModuleParser.NodeList;
  296. BEGIN
  297. n := varDecl;
  298. WHILE (n # NIL) DO
  299. ni := n(ModuleParser.VarDecl).identList;
  300. WHILE (ni # NIL) DO
  301. IF IsPublic(ni(ModuleParser.IdentList).identDef) THEN RETURN TRUE; END;
  302. ni := ni.next;
  303. END;
  304. n := n.next;
  305. END;
  306. RETURN FALSE;
  307. END HasPublicVars;
  308. PROCEDURE GetModuleNode(node : ModuleParser.Node) : ModuleParser.Module;
  309. VAR n : ModuleParser.Node;
  310. BEGIN
  311. ASSERT(node # NIL);
  312. n := node;
  313. WHILE (n # NIL) & (n # n.parent) DO n := n.parent; END;
  314. IF (n # NIL) & (n IS ModuleParser.Module) THEN
  315. RETURN n (ModuleParser.Module);
  316. ELSE
  317. RETURN NIL;
  318. END;
  319. END GetModuleNode;
  320. PROCEDURE GetProcedureType(procHead : ModuleParser.ProcHead) : LONGINT;
  321. VAR type : LONGINT;
  322. PROCEDURE InModuleScope(procHead : ModuleParser.ProcHead) : BOOLEAN;
  323. VAR module : ModuleParser.Module;
  324. BEGIN
  325. IF (procHead # NIL) & (procHead.parent.parent.parent # NIL) & (procHead.parent.parent.parent IS ModuleParser.Module) THEN
  326. module := procHead.parent.parent.parent (ModuleParser.Module);
  327. RETURN (module.ident # NIL) & (module.ident.name # NIL) & (module.ident.name^ = moduleName);
  328. ELSE
  329. RETURN FALSE;
  330. END;
  331. END InModuleScope;
  332. PROCEDURE IsCommandProc(procHead : ModuleParser.ProcHead) : BOOLEAN;
  333. BEGIN
  334. RETURN (procHead # NIL) & (procHead.formalPars = NIL);
  335. END IsCommandProc;
  336. PROCEDURE IsContextProc(procHead : ModuleParser.ProcHead) : BOOLEAN;
  337. BEGIN
  338. RETURN (procHead # NIL) & (procHead.formalPars # NIL) & (procHead.formalPars.fpSectionList # NIL) &
  339. (procHead.formalPars.fpSectionList.next = NIL) & (procHead.formalPars.fpSectionList.const = FALSE) &
  340. (procHead.formalPars.fpSectionList.var = FALSE) & (procHead.formalPars.fpSectionList.type.qualident # NIL) &
  341. (procHead.formalPars.fpSectionList.type.qualident.ident.name^ = "Commands.Context");
  342. END IsContextProc;
  343. BEGIN
  344. type := Other;
  345. IF InModuleScope(procHead) & (procHead.identDef.vis = ModuleParser.Public) & ~(procHead.operator) & ~(procHead.inline) THEN
  346. IF IsCommandProc(procHead) THEN
  347. type := CommandProc;
  348. ELSIF IsContextProc(procHead) THEN
  349. type := ContextProc;
  350. END;
  351. END;
  352. RETURN type;
  353. END GetProcedureType;
  354. PROCEDURE AddBody (root: WMTrees.TreeNode; pnode : ModuleParser.Node; modifiers: SET; pos: LONGINT);
  355. VAR node: TreeNode;
  356. BEGIN
  357. node := NewNode(root, StrBODY);
  358. SetNodeInfo(node, pnode, NIL, FALSE, SortBody, GetColor(modifiers, treeView.clTextDefault.Get()), {});
  359. NEW(node.pos, editor.text);
  360. node.pos.SetPosition(pos);
  361. END AddBody;
  362. PROCEDURE AddImportList(parent: WMTrees.TreeNode; importList: ModuleParser.Import; showImportedModules : BOOLEAN);
  363. VAR
  364. module : ModuleParser.Module; filename : Files.FileName;
  365. n: ModuleParser.NodeList;
  366. newNode, importNode: TreeNode;
  367. import: ModuleParser.Import;
  368. nofImports : LONGINT;
  369. BEGIN
  370. n := importList;
  371. IF n # NIL THEN
  372. NEW(importNode);
  373. SetNodeInfo(importNode, importList, NIL, FALSE, SortIgnore, treeView.clTextDefault.Get(), {});
  374. tree.SetNodeCaption(importNode, StrIMPORT);
  375. tree.AddChildNode(parent, importNode);
  376. ELSE
  377. importNode := NIL;
  378. END;
  379. nofImports := 0;
  380. WHILE n # NIL DO
  381. import := n(ModuleParser.Import);
  382. newNode := AddInfoItem(importNode, import, import.ident, TRUE, SortIgnore, treeView.clTextDefault.Get(), {});
  383. IF import.alias # NIL THEN
  384. AddPostfixToCaption(newNode, StrBecomes);
  385. AddPostfixToCaption(newNode, import.alias.name);
  386. END;
  387. IF import.context # NIL THEN
  388. AddPostfixToCaption(newNode, StrIN);
  389. AddPostfixToCaption(newNode, import.context.name);
  390. END;
  391. IF (newNode # NIL) THEN INC(nofImports); END;
  392. IF showImportedModules THEN
  393. IF ((import.ident # NIL) & (import.ident.name # NIL)) OR ((import.alias # NIL) & (import.alias.name # NIL)) THEN
  394. IF (import.context # NIL) THEN COPY(import.context.name^, filename); Strings.Append(filename, "."); ELSE filename := ""; END;
  395. IF (import.alias # NIL) THEN
  396. Strings.Append(filename, import.alias.name^);
  397. ELSE
  398. Strings.Append(filename, import.ident.name^);
  399. END;
  400. Strings.Append(filename, ".Mod");
  401. module := ModuleParser.ParseFile(filename, NIL);
  402. IF (module = NIL) THEN
  403. filename := "I386."; Strings.Append(filename, import.ident.name^); Strings.Append(filename, ".Mod");
  404. module := ModuleParser.ParseFile(filename, NIL);
  405. END;
  406. IF (module # NIL) THEN
  407. AddModule(newNode, module, FALSE, TRUE, FALSE, FALSE);
  408. END;
  409. END;
  410. END;
  411. n := n.next;
  412. END;
  413. IF (importNode # NIL) THEN AddNumberPostfixToCaption(importNode, nofImports); END;
  414. END AddImportList;
  415. PROCEDURE AddDefinitions(parent: WMTrees.TreeNode; definitions: ModuleParser.Definition);
  416. VAR n, p: ModuleParser.NodeList; defNode, newNode: WMTrees.TreeNode;
  417. BEGIN
  418. n := definitions;
  419. WHILE n # NIL DO
  420. defNode := AddInfoItem(parent, n, n(ModuleParser.Definition).ident, TRUE, SortIgnore, WMGraphics.Green, {WMGraphics.FontItalic});
  421. p := n(ModuleParser.Definition).procs;
  422. WHILE p # NIL DO
  423. newNode := AddProcHead(defNode, p(ModuleParser.ProcHead));
  424. p := p.next;
  425. END;
  426. n := n.next;
  427. END;
  428. END AddDefinitions;
  429. PROCEDURE AddDeclSeq(parent: WMTrees.TreeNode; declSeq: ModuleParser.DeclSeq);
  430. VAR n: ModuleParser.NodeList; newNode: TreeNode;
  431. BEGIN
  432. n := declSeq;
  433. WHILE n # NIL DO
  434. declSeq := n(ModuleParser.DeclSeq);
  435. IF (declSeq.constDecl # NIL) THEN
  436. NEW(newNode);
  437. SetNodeInfo(newNode, declSeq.constDecl, NIL, HasPublicConsts(declSeq.constDecl), SortIgnore, treeView.clTextDefault.Get(), {});
  438. tree.SetNodeCaption(newNode, StrCONST);
  439. tree.AddChildNode(parent, newNode);
  440. AddConstDecl(newNode, declSeq.constDecl);
  441. END;
  442. IF declSeq.typeDecl # NIL THEN
  443. AddTypeDecl(parent, declSeq.typeDecl);
  444. END;
  445. IF (declSeq.varDecl # NIL) THEN
  446. NEW(newNode);
  447. SetNodeInfo(newNode, declSeq.varDecl, NIL, HasPublicVars(declSeq.varDecl), SortIgnore, treeView.clTextDefault.Get(), {});
  448. tree.SetNodeCaption(newNode, StrVAR);
  449. tree.AddChildNode(parent, newNode);
  450. AddVarDecl(newNode, declSeq.varDecl);
  451. END;
  452. IF declSeq.procDecl # NIL THEN
  453. AddProcDecl(parent, declSeq.procDecl);
  454. END;
  455. n := n.next;
  456. END;
  457. END AddDeclSeq;
  458. PROCEDURE AddProcDecl(treeNode: WMTrees.TreeNode; procDecl: ModuleParser.ProcDecl);
  459. VAR n: ModuleParser.NodeList; newNode: WMTrees.TreeNode;
  460. BEGIN
  461. n := procDecl;
  462. WHILE n # NIL DO
  463. procDecl := n(ModuleParser.ProcDecl);
  464. newNode := AddProcHead(treeNode, procDecl.head);
  465. IF (procDecl.declSeq # NIL) & (newNode # NIL) THEN
  466. AddDeclSeq(newNode, procDecl.declSeq);
  467. END;
  468. IF procDecl.bodyPos # 0 THEN
  469. AddBody (newNode, procDecl, {}, procDecl.bodyPos);
  470. END;
  471. n := n.next;
  472. END;
  473. END AddProcDecl;
  474. PROCEDURE AddProcHead(treeNode: WMTrees.TreeNode; procHead: ModuleParser.ProcHead): WMTrees.TreeNode;
  475. VAR
  476. newNode: TreeNode; caption: Strings.String;
  477. color : LONGINT; image : WMGraphics.Image; type : LONGINT;
  478. BEGIN
  479. IF (procHead # NIL) THEN
  480. color := GetColor(procHead.modifiers, ColorProcedure);
  481. newNode := AddIdentDef(treeNode, procHead, procHead.identDef, SortProcedure, color, {WMGraphics.FontBold});
  482. IF procHead.operator THEN
  483. IF procHead.identDef.vis = ModuleParser.Public THEN
  484. (* remove visibility sign (ugly) *)
  485. caption := tree.GetNodeCaption(newNode);
  486. Strings.TrimRight(caption^, '*');
  487. END;
  488. AddPrefixToCaption(newNode, StrQuote);
  489. AddPostfixToCaption(newNode, StrQuote);
  490. IF procHead.identDef.vis = ModuleParser.Public THEN
  491. (* add visibility sign (still ugly) *)
  492. AddPostfixToCaption(newNode, StrStar);
  493. END;
  494. END;
  495. IF procHead.constructor THEN
  496. AddPrefixToCaption(newNode, StrAmpersand);
  497. END;
  498. IF procHead.inline THEN
  499. AddPrefixToCaption(newNode, StrMinus);
  500. END;
  501. type := GetProcedureType(procHead);
  502. IF (type = CommandProc) OR (type = ContextProc) &
  503. (procHead.identDef # NIL) & (procHead.identDef.ident # NIL) & (procHead.identDef.ident.name # NIL) THEN
  504. newNode.commandName := procHead.identDef.ident.name;
  505. END;
  506. IF ShowImages THEN
  507. CASE type OF
  508. |CommandProc: image := WMGraphics.LoadImage(ImageCommandProc, TRUE);
  509. |ContextProc: image := WMGraphics.LoadImage(ImageContextProc, TRUE);
  510. ELSE
  511. image := NIL;
  512. END;
  513. IF image # NIL THEN
  514. tree.Acquire; tree.SetNodeImage(newNode, image); tree.Release;
  515. END;
  516. END;
  517. IF (ModuleParser.Overwrite IN procHead.modifiers) THEN
  518. AddPostfixToCaption(newNode, StrOverwrite);
  519. END;
  520. IF (ModuleParser.Overwritten IN procHead.modifiers) THEN
  521. AddPostfixToCaption(newNode, StrOverwritten);
  522. END;
  523. AddFormalPars(newNode, procHead.formalPars);
  524. RETURN newNode;
  525. ELSE
  526. RETURN NIL;
  527. END
  528. END AddProcHead;
  529. PROCEDURE AddFormalPars(parent: WMTrees.TreeNode; formalPars: ModuleParser.FormalPars);
  530. VAR newNode: WMTrees.TreeNode;
  531. BEGIN
  532. IF formalPars # NIL THEN
  533. AddFPSection(parent, formalPars.fpSectionList);
  534. NEW(newNode);
  535. tree.SetNodeCaption(newNode, StrRETURN);
  536. IF formalPars.returnType # NIL THEN
  537. AddType(newNode, formalPars.returnType, TRUE);
  538. tree.AddChildNode(parent, newNode);
  539. END;
  540. END;
  541. END AddFormalPars;
  542. PROCEDURE AddFPSection(parent: WMTrees.TreeNode; fpSection: ModuleParser.FPSection);
  543. VAR newNode: TreeNode; n, l: ModuleParser.NodeList;
  544. BEGIN
  545. n := fpSection;
  546. WHILE n # NIL DO
  547. l := n(ModuleParser.FPSection).identList;
  548. WHILE l # NIL DO
  549. newNode := AddIdentDef(parent, l, l(ModuleParser.IdentList).identDef, SortIgnore, treeView.clTextDefault.Get(), {});
  550. (* Make parameters always visible *)
  551. EXCL(newNode.flags, NotPublic);
  552. IF n(ModuleParser.FPSection).var THEN
  553. AddPostfixToCaption(newNode, Strings.NewString(" (VAR)"));
  554. ELSIF n(ModuleParser.FPSection).const THEN
  555. AddPostfixToCaption(newNode, Strings.NewString(" (CONST)"));
  556. END;
  557. AddType(newNode, n(ModuleParser.FPSection).type, FALSE);
  558. l := l.next;
  559. END;
  560. n := n.next;
  561. END;
  562. END AddFPSection;
  563. PROCEDURE AddVarDecl(parent: WMTrees.TreeNode; varDecl: ModuleParser.VarDecl);
  564. VAR n: ModuleParser.NodeList; nofVariables, nofIdents : LONGINT;
  565. BEGIN
  566. n := varDecl; nofVariables := 0;
  567. WHILE n # NIL DO
  568. varDecl := n(ModuleParser.VarDecl);
  569. AddIdentList(parent, varDecl.identList, nofIdents);
  570. nofVariables := nofVariables + nofIdents;
  571. n := n.next;
  572. END;
  573. AddNumberPostfixToCaption(parent, nofVariables);
  574. END AddVarDecl;
  575. PROCEDURE AddTypeDecl(parent: WMTrees.TreeNode; typeDecl: ModuleParser.TypeDecl);
  576. VAR n: ModuleParser.NodeList; newNode: WMTrees.TreeNode;
  577. BEGIN
  578. n := typeDecl;
  579. WHILE n # NIL DO
  580. newNode := AddIdentDef(parent, n, n(ModuleParser.TypeDecl).identDef, SortIgnore, ColorTypes, {WMGraphics.FontItalic});
  581. AddType(newNode, n(ModuleParser.TypeDecl).type, FALSE);
  582. n := n.next;
  583. END;
  584. END AddTypeDecl;
  585. PROCEDURE AddType(parent: WMTrees.TreeNode; type: ModuleParser.Type; anonymous: BOOLEAN);
  586. VAR newNode: WMTrees.TreeNode;
  587. BEGIN
  588. IF type # NIL THEN
  589. IF type.qualident # NIL THEN
  590. newNode := AddQualident(parent, type.qualident, treeView.clTextDefault.Get(), {});
  591. ELSIF type.array # NIL THEN
  592. AddArray(parent, type.array);
  593. ELSIF type.record # NIL THEN
  594. AddRecord(parent, type.record, anonymous, TRUE);
  595. ELSIF type.pointer # NIL THEN
  596. AddPointer(parent, type.pointer);
  597. ELSIF type.object # NIL THEN
  598. AddObject(parent, type.object, anonymous, TRUE);
  599. ELSIF type.procedure # NIL THEN
  600. AddProcedure(parent, type.procedure);
  601. ELSIF type.enum # NIL THEN
  602. AddEnum(parent, type.enum);
  603. ELSIF type.cell # NIL THEN
  604. AddCell(parent, type.cell, anonymous)
  605. ELSIF type.port # NIL THEN
  606. AddPort(parent, type.port);
  607. END;
  608. END;
  609. END AddType;
  610. PROCEDURE AddRecord(parent: WMTrees.TreeNode; record: ModuleParser.Record; anonymous, addSuperRecords: BOOLEAN);
  611. VAR p: WMTrees.TreeNode;
  612. BEGIN
  613. IF record # NIL THEN
  614. IF anonymous THEN p := NewNode(parent, Strings.NewString("RECORD"));
  615. ELSE p := parent;
  616. END;
  617. IF addSuperRecords THEN AddSuperRecords(parent, record); END;
  618. IF record.super # NIL THEN
  619. AddPostfixToCaption(p, Strings.NewString(" ("));
  620. AddPostfixToCaption(p, record.super.ident.name);
  621. AddPostfixToCaption(p, Strings.NewString(")"));
  622. END;
  623. AddFieldDecl(p, record.fieldList);
  624. END;
  625. END AddRecord;
  626. PROCEDURE AddEnum(parent: WMTrees.TreeNode; enum: ModuleParser.Enum);
  627. VAR p: WMTrees.TreeNode; num: LONGINT;
  628. BEGIN
  629. IF enum # NIL THEN
  630. AddIdentList(parent, enum.identList,num);
  631. END;
  632. END AddEnum;
  633. PROCEDURE AddFieldDecl(parent: WMTrees.TreeNode; fieldDecl: ModuleParser.FieldDecl);
  634. VAR newNode: WMTrees.TreeNode; n, l: ModuleParser.NodeList;
  635. BEGIN
  636. n := fieldDecl;
  637. WHILE n # NIL DO
  638. l := n(ModuleParser.FieldDecl).identList;
  639. WHILE l # NIL DO
  640. newNode := AddIdentDef(parent, l, l(ModuleParser.IdentList).identDef, SortIgnore, treeView.clTextDefault.Get(), {});
  641. AddType(newNode, n(ModuleParser.FieldDecl).type, FALSE);
  642. l := l.next;
  643. END;
  644. n := n.next;
  645. END;
  646. END AddFieldDecl;
  647. PROCEDURE AddPointer(parent: WMTrees.TreeNode; pointer: ModuleParser.Pointer);
  648. VAR newNode: WMTrees.TreeNode;
  649. BEGIN
  650. IF pointer # NIL THEN
  651. newNode := NewNode(parent, Strings.NewString("POINTER TO"));
  652. IF (pointer.type # NIL) & (pointer.type.record # NIL) & (pointer.type.record.super # NIL) THEN
  653. AddPostfixToCaption(parent, Strings.NewString(" ("));
  654. AddPostfixToCaption(parent, pointer.type.record.super.ident.name);
  655. AddPostfixToCaption(parent, Strings.NewString(")"));
  656. END;
  657. AddType(newNode, pointer.type, TRUE);
  658. END;
  659. END AddPointer;
  660. PROCEDURE AddArray(parent: WMTrees.TreeNode; array: ModuleParser.Array);
  661. VAR newNode: WMTrees.TreeNode;
  662. BEGIN
  663. IF array # NIL THEN
  664. newNode := NewNode(parent, StrARRAY);
  665. IF ~array.open THEN
  666. IF (array.len # NIL) & (array.len.name # NIL) THEN
  667. AddPostfixToCaption(newNode, array.len.name);
  668. AddPostfixToCaption(newNode, Strings.NewString(" "));
  669. END;
  670. END;
  671. AddPostfixToCaption(newNode, StrOF);
  672. AddType(newNode, array.base, TRUE);
  673. END;
  674. END AddArray;
  675. PROCEDURE NewNode(parent: WMTrees.TreeNode; caption: Strings.String): TreeNode;
  676. VAR newNode: TreeNode;
  677. BEGIN
  678. IF parent # NIL THEN
  679. NEW(newNode);
  680. tree.SetNodeCaption(newNode, caption);
  681. tree.AddChildNode(parent, newNode);
  682. END;
  683. RETURN newNode;
  684. END NewNode;
  685. PROCEDURE AddQualident(parent: WMTrees.TreeNode; qualident: ModuleParser.Qualident; color: LONGINT; style: SET):
  686. WMTrees.TreeNode;
  687. VAR newNode: WMTrees.TreeNode;
  688. n: ModuleParser.NodeList;
  689. BEGIN
  690. IF qualident # NIL THEN
  691. newNode := AddInfoItem(parent, qualident, qualident.ident, TRUE, SortIgnore, color, style);
  692. n := qualident.next;
  693. WHILE n # NIL DO
  694. AddPostfixToCaption(newNode, Strings.NewString(", "));
  695. AddPostfixToCaption(newNode, n(ModuleParser.Qualident).ident.name);
  696. n := n.next;
  697. END;
  698. END;
  699. RETURN newNode;
  700. END AddQualident;
  701. PROCEDURE AddSuperRecords(parent : WMTrees.TreeNode; record : ModuleParser.Record);
  702. VAR
  703. newNode : TreeNode;
  704. superRecord : ModuleParser.Record;
  705. moduleNode : ModuleParser.Module;
  706. node : ModuleParser.Node;
  707. typeDecl : ModuleParser.TypeDecl;
  708. caption : ARRAY 256 OF CHAR;
  709. BEGIN
  710. ASSERT(record # NIL);
  711. superRecord := record.superPtr;
  712. WHILE (superRecord # NIL) DO
  713. NEW(newNode);
  714. SetNodeInfo(newNode, superRecord, NIL, TRUE, SortNo, WMGraphics.Black, {WMGraphics.FontItalic});
  715. moduleNode := GetModuleNode(superRecord);
  716. IF (moduleNode # NIL) & (moduleNode.ident # NIL) & (moduleNode.ident.name # NIL) & (moduleNode.ident.name^ # moduleName) THEN
  717. COPY(moduleNode.ident.name^, caption); Strings.Append(caption, ".");
  718. ELSE
  719. caption := "";
  720. END;
  721. node := superRecord.parent.parent;
  722. WHILE (node # NIL) & ~(node IS ModuleParser.TypeDecl) DO node := node.parent; END;
  723. IF (node # NIL) THEN
  724. typeDecl := node (ModuleParser.TypeDecl);
  725. Strings.Append(caption, typeDecl.identDef.ident.name^);
  726. ELSE
  727. caption := "ERROR!";
  728. END;
  729. tree.SetNodeCaption(newNode, Strings.NewString(caption));
  730. tree.AddChildNode(parent, newNode);
  731. AddRecord(newNode, superRecord, FALSE, FALSE);
  732. newNode.color := WMGraphics.Black;
  733. superRecord := superRecord.superPtr;
  734. END;
  735. END AddSuperRecords;
  736. PROCEDURE AddSuperClasses(parent : WMTrees.TreeNode; object : ModuleParser.Object);
  737. VAR
  738. newNode : TreeNode;
  739. superClass : ModuleParser.Object;
  740. moduleNode : ModuleParser.Module;
  741. typeDecl : ModuleParser.TypeDecl;
  742. caption : ARRAY 256 OF CHAR;
  743. BEGIN
  744. ASSERT(object # NIL);
  745. superClass := object.superPtr;
  746. WHILE (superClass # NIL) DO
  747. NEW(newNode);
  748. SetNodeInfo(newNode, superClass, NIL, TRUE, SortNo, WMGraphics.Black, {WMGraphics.FontItalic});
  749. moduleNode := GetModuleNode(superClass);
  750. IF (moduleNode # NIL) & (moduleNode.ident # NIL) & (moduleNode.ident.name # NIL) & (moduleNode.ident.name^ # moduleName) THEN
  751. COPY(moduleNode.ident.name^, caption); Strings.Append(caption, ".");
  752. ELSE
  753. caption := "";
  754. END;
  755. typeDecl := superClass.parent.parent (ModuleParser.TypeDecl);
  756. Strings.Append(caption, typeDecl.identDef.ident.name^);
  757. tree.SetNodeCaption(newNode, Strings.NewString(caption));
  758. tree.AddChildNode(parent, newNode);
  759. AddObject(newNode, superClass, FALSE, FALSE);
  760. newNode.color := WMGraphics.Black;
  761. superClass := superClass.superPtr;
  762. END;
  763. END AddSuperClasses;
  764. PROCEDURE AddObject(parent: WMTrees.TreeNode; object: ModuleParser.Object; anonymous, addSuperClasses: BOOLEAN);
  765. VAR newNode, p: WMTrees.TreeNode; image : WMGraphics.Image;
  766. BEGIN
  767. IF object # NIL THEN
  768. IF anonymous THEN p := NewNode(parent, Strings.NewString("OBJECT"));
  769. ELSE p := parent;
  770. END;
  771. IF (p IS TreeNode) THEN
  772. p(TreeNode).color := ColorObjects;
  773. END;
  774. IF ModuleParser.Active IN object.modifiers THEN
  775. IF (p IS TreeNode) THEN
  776. p(TreeNode).color := ColorActiveObjects;
  777. END;
  778. IF ShowImages THEN
  779. image := WMGraphics.LoadImage(ImageActive, TRUE);
  780. IF image # NIL THEN
  781. tree.Acquire; tree.SetNodeImage(p, image); tree.Release;
  782. END;
  783. END;
  784. END;
  785. IF (object.super # NIL) & (object.super.ident # NIL) & addSuperClasses THEN
  786. AddPostfixToCaption(p, Strings.NewString(" ("));
  787. AddPostfixToCaption(p, object.super.ident.name);
  788. AddPostfixToCaption(p, Strings.NewString(")"));
  789. END;
  790. IF object.implements # NIL THEN
  791. newNode := AddQualident(p, object.implements, treeView.clTextDefault.Get(), {});
  792. AddPrefixToCaption(newNode, Strings.NewString("Implements "));
  793. END;
  794. IF addSuperClasses THEN
  795. AddSuperClasses(p, object);
  796. END;
  797. IF object.declSeq # NIL THEN
  798. AddDeclSeq(p, object.declSeq);
  799. END;
  800. IF object.bodyPos # 0 THEN
  801. AddBody (p, object, object.modifiers, object.bodyPos);
  802. END;
  803. END;
  804. END AddObject;
  805. PROCEDURE AddCell(parent: WMTrees.TreeNode; cell: ModuleParser.Cell; anonymous: BOOLEAN);
  806. VAR newNode, p: WMTrees.TreeNode; image : WMGraphics.Image;
  807. BEGIN
  808. IF cell # NIL THEN
  809. IF anonymous THEN p := NewNode(parent, Strings.NewString("CELL"));
  810. ELSE p := parent;
  811. END;
  812. IF (p IS TreeNode) THEN
  813. p(TreeNode).color := ColorObjects;
  814. END;
  815. IF cell.formalPars # NIL THEN
  816. AddFormalPars(p, cell.formalPars);
  817. END;
  818. IF cell.declSeq # NIL THEN
  819. AddDeclSeq(p, cell.declSeq);
  820. END;
  821. IF cell.bodyPos # 0 THEN
  822. AddBody (p, cell, cell.modifiers, cell.bodyPos);
  823. END;
  824. END;
  825. END AddCell;
  826. PROCEDURE AddPort(parent: WMTrees.TreeNode; port:ModuleParser.Port);
  827. VAR p: WMTrees.TreeNode;
  828. BEGIN
  829. p := NewNode(parent, Strings.NewString("PORT"));
  830. END AddPort;
  831. PROCEDURE AddProcedure(parent: WMTrees.TreeNode; proc: ModuleParser.Procedure);
  832. VAR newNode: WMTrees.TreeNode;
  833. BEGIN
  834. IF proc # NIL THEN
  835. newNode := NewNode(parent, Strings.NewString("PROCEDURE"));
  836. IF proc.delegate THEN AddPostfixToCaption(newNode, Strings.NewString(" {DELEGATE}")) END;
  837. AddFormalPars(newNode, proc.formalPars);
  838. END;
  839. END AddProcedure;
  840. PROCEDURE AddIdentList(parent: WMTrees.TreeNode; identList: ModuleParser.IdentList; VAR nofIdents : LONGINT);
  841. VAR n: ModuleParser.NodeList; newNode: WMTrees.TreeNode;
  842. BEGIN
  843. nofIdents := 0;
  844. n := identList;
  845. WHILE n # NIL DO
  846. newNode := AddIdentDef(parent, n, n(ModuleParser.IdentList).identDef, SortIgnore, treeView.clTextDefault.Get(), {});
  847. INC(nofIdents);
  848. n := n.next;
  849. END;
  850. END AddIdentList;
  851. PROCEDURE AddConstDecl(parent: WMTrees.TreeNode; constDecl: ModuleParser.ConstDecl);
  852. VAR
  853. n: ModuleParser.NodeList;
  854. newNode: WMTrees.TreeNode;
  855. c : ModuleParser.ConstDecl;
  856. nofConstants : LONGINT;
  857. BEGIN
  858. n := constDecl; nofConstants := 0;
  859. WHILE n # NIL DO
  860. c := n (ModuleParser.ConstDecl);
  861. newNode := AddIdentDef(parent, c, c.identDef, SortIgnore, treeView.clTextDefault.Get(), {});
  862. newNode := AddInfoItem(newNode, c, c.expr, IsPublic(c.identDef), SortIgnore, treeView.clTextDefault.Get(), {});
  863. INC(nofConstants);
  864. n := n.next;
  865. END;
  866. AddNumberPostfixToCaption(parent, nofConstants);
  867. END AddConstDecl;
  868. PROCEDURE AddIdentDef(
  869. parent: WMTrees.TreeNode;
  870. node : ModuleParser.Node; identDef: ModuleParser.IdentDef;
  871. sortHint, color: LONGINT; style: SET) : TreeNode;
  872. VAR
  873. newNode: TreeNode;
  874. BEGIN
  875. IF identDef # NIL THEN
  876. newNode := AddInfoItem(parent, node, identDef.ident, IsPublic(identDef), sortHint, color, style);
  877. IF identDef.vis = ModuleParser.Public THEN
  878. AddPostfixToCaption(newNode, StrStar);
  879. ELSIF identDef.vis = ModuleParser.PublicRO THEN
  880. AddPostfixToCaption(newNode, StrMinus);
  881. END;
  882. RETURN newNode;
  883. ELSE
  884. RETURN NIL;
  885. END
  886. END AddIdentDef;
  887. PROCEDURE AddInfoItem(
  888. parent: WMTrees.TreeNode;
  889. node : ModuleParser.Node; infoItem: ModuleParser.InfoItem;
  890. isPublic : BOOLEAN; sortHint, color : LONGINT; style: SET) : TreeNode;
  891. VAR
  892. newNode: TreeNode;
  893. BEGIN
  894. IF (infoItem # NIL) & (parent # NIL) THEN
  895. NEW(newNode);
  896. SetNodeInfo(newNode, node, infoItem, isPublic, sortHint, color, style);
  897. tree.SetNodeCaption(newNode, infoItem.name);
  898. tree.AddChildNode(parent, newNode);
  899. END;
  900. RETURN newNode;
  901. END AddInfoItem;
  902. END ModuleTree;
  903. VAR
  904. PrototypeShowTypeHierarchy, PrototypeShowImportedModules : WMProperties.BooleanProperty;
  905. StrUNKNOWN, StrVAR, StrCONST, StrIMPORT, StrIN, StrBODY, StrRETURN, StrARRAY, StrOF,
  906. StrBecomes, StrAmpersand, StrMinus, StrStar, StrQuote, StrOverwritten, StrOverwrite : Strings.String;
  907. PROCEDURE GetColor(modifiers : SET; defaultColor : LONGINT) : LONGINT;
  908. VAR color : LONGINT;
  909. BEGIN
  910. IF (ModuleParser.Exclusive IN modifiers) THEN color := ColorExclusive;
  911. ELSIF (ModuleParser.HasExclusiveBlock IN modifiers) THEN color := ColorHasExclusiveBlock;
  912. ELSIF (ModuleParser.Interrupt IN modifiers) THEN color := ColorInterrupt;
  913. ELSE
  914. color := defaultColor;
  915. END;
  916. RETURN color;
  917. END GetColor;
  918. PROCEDURE GenModuleTree*() : PETTrees.Tree;
  919. VAR tree : ModuleTree;
  920. BEGIN
  921. NEW(tree); RETURN tree;
  922. END GenModuleTree;
  923. PROCEDURE InitStrings;
  924. BEGIN
  925. StrUNKNOWN := Strings.NewString("UNKNOWN");
  926. StrVAR := Strings.NewString("VAR");
  927. StrCONST := Strings.NewString("CONST");
  928. StrIMPORT := Strings.NewString("IMPORT");
  929. StrIN := Strings.NewString(" IN ");
  930. StrBODY := Strings.NewString("BODY");
  931. StrRETURN := Strings.NewString("RETURN");
  932. StrARRAY := Strings.NewString("ARRAY ");
  933. StrOF := Strings.NewString("OF");
  934. StrBecomes := Strings.NewString(" := ");
  935. StrAmpersand := Strings.NewString("& ");
  936. StrMinus := Strings.NewString("-");
  937. StrStar := Strings.NewString("*");
  938. StrQuote := Strings.NewString('"');
  939. StrOverwritten := Strings.NewString(" [overwritten]");
  940. StrOverwrite := Strings.NewString(" [overwrite]");
  941. END InitStrings;
  942. BEGIN
  943. InitStrings;
  944. NEW(PrototypeShowTypeHierarchy, NIL, Strings.NewString("ShowTypeHierarchy"), Strings.NewString("Show type hierarchy?"));
  945. PrototypeShowTypeHierarchy.Set(FALSE);
  946. NEW(PrototypeShowImportedModules, NIL, Strings.NewString("ShowImportedModules"), Strings.NewString("Show imported modules details?"));
  947. PrototypeShowImportedModules.Set(FALSE);
  948. END PETModuleTree.
  949. Tar.Create ModuleTreesIcons.tar
  950. activity.png
  951. arrow-red.png
  952. arrow-yellow.png
  953. arrow-green.png
  954. arrow-blue.png
  955. ~