The Menu Commands "Source", "Interface", & "Documentation" unwrap item aliases, which is a very useful feature.
The Menu Command "Info->Global Variables" does not, which is both inconsistent and unhelpful.
I guess it should be easy to implement this feature by copying the procedure "CheckModName" from DevReferences, or DevBrowser, to DevDebug. (Maybe it would be better not to have three copies of the same procedure?)
Unwrapping IMPORT aliasses
Re: Unwrapping IMPORT aliasses
Below are the additions I tried in Module DevDebug. It seems to work fine, but the different values of the CONSTant "module" was a bit of a trap!
"CheckModName" is new (actually copied from elsewhere). "GetMod" has one new line.
"CheckModName" is new (actually copied from elsewhere). "GetMod" has one new line.
Code: Select all
PROCEDURE CheckModName (VAR mod: TextMappers.String; t: TextModels.Model);
CONST module = 101; (* Overrides global definition !! *)
VAR s: TextMappers.Scanner;
BEGIN
s.ConnectTo(t); s.SetPos(0); Scan(s);
IF s.type = module THEN
Scan(s);
WHILE (s.type # TextMappers.eot) & (s.type # import) DO Scan(s) END;
WHILE (s.type # TextMappers.eot) & (s.type # semicolon)
& ((s.type # TextMappers.string) OR (s.string # mod)) DO Scan(s) END;
IF s.type = TextMappers.string THEN
Scan(s);
IF s.type = becomes THEN
Scan(s);
IF s.type = TextMappers.string THEN
mod := s.string$
END
END
END
END
END CheckModName;
PROCEDURE GetMod (VAR mod: Kernel.Module);
VAR c: TextControllers.Controller; s: TextMappers.Scanner; beg, end: INTEGER; res: INTEGER; n: Kernel.Utf8Name;
BEGIN
mod := NIL;
c := TextControllers.Focus();
IF (c # NIL) & c.HasSelection() THEN
c.GetSelection(beg, end);
s.ConnectTo(c.text); s.SetPos(beg); s.Scan;
IF s.type = TextMappers.string THEN
CheckModName(s.string, c.text);
Strings.StringToUtf8(s.string, n, res); mod := Kernel.ThisMod(n$);
IF mod = NIL THEN
Dialog.ShowParamMsg("#Dev:ModuleNotFound", s.string, "", "");
END
ELSE Dialog.ShowMsg("#Dev:NoModuleNameSelected")
END
ELSE Dialog.ShowMsg("#Dev:NoSelectionFound")
END
END GetMod;
-
- Posts: 262
- Joined: Tue Sep 17, 2013 6:50 am
Re: Unwrapping IMPORT aliasses
I think this is an improvement.
If the code can be reused it would even be a simplification.
Is there any lower level module where the common code could be put for reuse?
- Josef
If the code can be reused it would even be a simplification.
Is there any lower level module where the common code could be put for reuse?
- Josef
Re: Unwrapping IMPORT aliasses
The obvious question ... I haven't had any time to investigate!Josef Templ wrote:Is there any lower level module where the common code could be put for reuse?
Actually I would like it to be exported (and documented!), as it would be useful in some of my private tools.
Re: Unwrapping IMPORT aliasses
The only obvious place to put the common code (without a new Module) is in TextMappers.
One would also want to move the duplicated copies of the procedure "Scan". The copies of Scan in DevReferences & DevBrowser are identical; the copy in DevDebug is different (bigger). One could easily make a dual purpose version (with an input BOOLEAN to configure it).
I'm not sure what the best thing to suggest is.
On second thoughts, maybe it is best to export these two procedres from DevReferences, and have DevBrowser & DevDebug import DevReferences?
One would also want to move the duplicated copies of the procedure "Scan". The copies of Scan in DevReferences & DevBrowser are identical; the copy in DevDebug is different (bigger). One could easily make a dual purpose version (with an input BOOLEAN to configure it).
I'm not sure what the best thing to suggest is.
On second thoughts, maybe it is best to export these two procedres from DevReferences, and have DevBrowser & DevDebug import DevReferences?
-
- Posts: 262
- Joined: Tue Sep 17, 2013 6:50 am
Re: Unwrapping IMPORT aliasses
Shouldn't this also be applied to DevDependencies?
Even if it is a pretty useless tool, for the sake of completeness
it should be considered, I think.
DevReferences looks like a good place to export from.
- Josef
Even if it is a pretty useless tool, for the sake of completeness
it should be considered, I think.
DevReferences looks like a good place to export from.
- Josef
- Ivan Denisov
- Posts: 363
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Krasnoyarsk, Russia
Re: Unwrapping IMPORT aliasses
This issue was resolved:
http://blackboxframework.org/unstable/m ... .html#a140
http://blackboxframework.org/unstable/m ... .html#a140