Originally posted by John R. Heathcote
View Post
Announcement
Collapse
No announcement yet.
SourceCode Only
Collapse
X
-
New gConcordance() array -- Comments please
Guys,
New definition of gConcordance(). Makes it possible to track VB6 project files and corresponding PB code. I haven't
fully determined the exact usage, but I'm working on it today.
John,
How difficult would it be for the Editor to pass the vbPathFileName and vbLineNo within the file along with the code block? I can make the Tokenizer keep track, but it seems to me that the Editor would be a more logical place to keep track of the VB files and line nos. Then the Tokenizer will keep track of which PB code goes with which converted VB code block.
gConcordance() is a GLOBAL array. Size will vary significantly based on the size of the VB project being converted. Also, I'm thinking this will be more efficient if vbCodeString and pbCodeString are changed to pointers. Then we could use a dynamic array for the code blocks and eliminate the limitation of size with a single conversion.
Code:TYPE ConcordanceType 'use in Concordance() to keep track of which VB lines matche which PB lines vbPathFileName AS STRING * 256 'to control all VB6 files in project vbLineNo AS LONG 'to contorl lines in each VB6 file vbCodeString AS STRING * 256 'the active VB6 code block VB2PB_ConversionLevel AS LONG 'to control how deep to go with conversion pbPathFileName AS STRING * 256 'to control all PB files in project pbLineNo AS LONG 'to control lines in each PB file pbCodeString AS STRING * 256 'the active PB code block END TYPE
Do not go quiet into that good night,
... Rage, rage against the dark.
Comment
-
-
Stan,
How difficult would it be for the Editor to pass the vbPathFileName and vbLineNo within the file along with the code block?
gConcordance() is a GLOBAL array. Size will vary significantly based on the size of the VB project being converted.
Code:pbCodeString AS STRING * 256 'the active PB code block
Also, I'm thinking this will be more efficient if vbCodeString and pbCodeString are changed to pointers. Then we could use a dynamic array for the code blocks and eliminate the limitation of size with a single conversion.
Given the above limitations would it be better if the editor keeps track of some of this information? My thought here is since the source code line(s) and their location is extracted from the editor all we would really need is the conversion supplied by the Tokenizer, then let the editor determine where the converted code should be inserted in the file.
That way there would be reduced or no duplication of effort, or am I way off based here?Later...
JR
"When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson
Comment
-
-
Originally posted by John R. Heathcote View Post...
Does the Tokenizer require the line number to be absolute, or does it have to be relative to the procedure? ...
The UDT looks good.
...
For most lines this will be adequate, but how will you handle continued lines that would span more than 256 characters?
If the Tokenizer passes a really long PB string back to the Editor will that be a problem? In other words, perhaps the Editor should parse long logical lines into physical lines in the text. I think the Tokenizer should deal with logical lines and let the Editor handle all the formatting details. There shouldn't be any problem with line numbers if they refer to the first physical line in a logical line. Don't even have to be sequential so long as each line number is larger by at least 1 than the previous line number.
I don't know of any way to pass a pointer that points to a specific line in the Scintilla control. The only pointer I know of is the one to provide direct and faster access to the control itself, but not the data it contains. I will research this further and let you know my results.
Given the above limitations would it be better if the editor keeps track of some of this information? My thought here is since the source code line(s) and their location is extracted from the editor all we would really need is the conversion supplied by the Tokenizer, then let the editor determine where the converted code should be inserted in the file.Do not go quiet into that good night,
... Rage, rage against the dark.
Comment
-
-
Stan,
I've taken a look at the Scintilla documentation and there doesn't appear to be a way to pass a pointer to access the text within the control the way (I think) you envisioned. A pointer is passed, but it is to a dynamic string that is already created. The following code illustrates how you read text line by line:
Code:k = 0 nLine = -1 'Number of lines nLines = SciMsg(pSciVB, %SCI_GETLINECOUNT, 0, 0) redim uControl(0 to 25) as VBProperties do incr nLine if nLine > nLines - 1 then exit do nLen = SciMsg(pSciVB, %SCI_LINELENGTH, nLine, 0) sRecord = SPACE$(nLen) SciMsg pSciVB, %SCI_GETLINE, nLine, STRPTR(sRecord) sRecord = utl_ReplaceSpecialChars(sRecord) if left$(trim$(sRecord), 20) = "Attribute VB_Name = " THEN exit do
Code:SciMsg pSciVB, %SCI_GETLINE, nLine, STRPTR(sRecord)
If the Tokenizer passes a really long PB string back to the Editor will that be a problem?
In other words, perhaps the Editor should parse long logical lines into physical lines in the text. I think the Tokenizer should deal with logical lines and let the Editor handle all the formatting details.
There shouldn't be any problem with line numbers if they refer to the first physical line in a logical line. Don't even have to be sequential so long as each line number is larger by at least 1 than the previous line number.
Just a thought: the messaging system could send the actual line number without having to deal with pointers in the Editor. whadayathink ... maybe?
Good point there. I have a rather fuzzy answer, but I want to review the Tokenizer code before I go trying to explain how it works -- it's been a long Monday.
While fiddling around with some VB form stuff I came to the conclusion that the original VB code should be treated as sacred, IOW it shouldn't be changed at all. Taking this precaution will give the user the ultimate fall back position should something go awry during the conversion process. With this in mind I set up a process whereby should the user load the VB source code in the editor another MDI edit dialog is created for the output. Will this play havoc with Tokenizer tracking and indexing?
If it does, I can always re-read the converted procedure, send it to the Tokenizer, and re-index the necessary stuff. Does that work for you? As a thought: (Gee, I didn't have to take a shower to realize it) maybe we should have a specific indexing procedure as part of the Tokenizer that could be called upon to do its function at any time during conversion? This may be a bit cleaner to (re)index the necessary things in the source code after most of the conversion is completed and we know where critical items are located in the source code.
BTW, how was your trip to our fair state? Did you get to do any traveling?Later...
JR
"When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson
Comment
-
-
Originally posted by John R. Heathcote View Post...
I've taken a look at the Scintilla documentation and there doesn't appear to be a way to pass a pointer ...
BTW: If you have a more descriptive name for these 2 globals (only 1 letter difference in my names)...
...
Or we could create a global string array called gsVBSOURCE() and have the Tokenizer read this specific array so we wouldn't have to pass it as a parameter. While these solutions point out a limitation of the Scintilla control, I don't think it is a serious one.
...
This does have the potential to invalidate any indexing you may be tracking on the fly by line number by altering the number and content of the lines written back out to the editor, after conversion changes in the text, re-formatting long lines, etc.
The PB code will come back to you as logical lines w/o line continuation chars unless you think otherwise. That gives you more freedom with the formatting. We already introduced the $CRLF substitution; I think maybe we should keep internal translations to a minimum between modules. Just let the Tokenizer do it's thing within it's own space and give you back something that won't add extra work (ie.: a text string with $CRLF line terminators).
So you'll put logical lines in the VB code block and I'll put logical lines in the PB code block.
...
I'm assuming here that the reformatted physical lines of text are the ones sent to the Tokenizer and not shown in the editor, correct?
... "nLine" to sequentially access the lines of text ... The value of "nLine" will always comply with the Tokenizer requirement. Scintilla demands "nLine" be zero based, is this a problem?
I think we need to determine the standard of how we intend to pass the VB source code text to the Tokenizer before we get caught up in the above details.
... I came to the conclusion that the original VB code should be treated as sacred, IOW it shouldn't be changed at all. ... With this in mind I set up a process whereby should the user load the VB source code in the editor another MDI edit dialog is created for the output. Will this play havoc with Tokenizer tracking and indexing?
...
As a thought: (Gee, I didn't have to take a shower to realize it) maybe we should have a specific indexing procedure as part of the Tokenizer that could be called upon to do its function at any time during conversion? This may be a bit cleaner to (re)index the necessary things in the source code after most of the conversion is completed and we know where critical items are located in the source code.
any volunteers?)
BTW, how was your trip to our fair state? Did you get to do any traveling?Do not go quiet into that good night,
... Rage, rage against the dark.
Comment
-
-
Stan,
I agree that the editor and Tokenizer should do what they do best, that will serve to clean up many programming issues.
I also agree that the gvbCodeBlock and gpbCodeBlock variable names are too close to each other. How about renaming gvbCodeBlock to gvbSource?
I think the Editor is a more logical place for that, what with the formatting and all. Tokenizer will just read what it's given and post back in the PB block string.
The PB code will come back to you as logical lines w/o line continuation chars unless you think otherwise. That gives you more freedom with the formatting. We already introduced the $CRLF substitution; I think maybe we should keep internal translations to a minimum between modules. Just let the Tokenizer do it's thing within it's own space and give you back something that won't add extra work (ie.: a text string with $CRLF line terminators).
So you'll put logical lines in the VB code block and I'll put logical lines in the PB code block.
After reading your post (with a fresh clean mind) I realized the Tokenizer needs to do 98+% of it's stuff within it's own space. That way we don't have to pass icky things like pointers around between our modules.
The trip was an easy one, once I got on the plane. The weather is beautiful! I've got a very good view of the mountains from my hotel. (Is that THE mountains or just the foothills?) No snow in Boulder so far, but there were white capped peaks in the distance this weekend.
If you want to see some truly rugged mountains head to the southwest corner of our state and visit the San Juan mountain range near Durango. There you will see some mountains. While you are there in Durango take a ride on the Durango to Silverton narrow gage railroad train which has been featured in many old western movies. It's worth the trip for the scenery alone. Should you keep on heading southwest from Durango you will see Monument Valley, also a film location site for many old John Wayne movies, equally impressive.
Some trivia for your amusement, Colorado boasts more 14,000+ foot mountains than any other state in the U.S. Eishenhower Tunnels (on I-70) are the highest traffic tunnels in the world. Also, Colorado is only one of two states in the U.S. where water flows out of, but not into the state. The other state is Hawaii.
Been awfully busy the past weeks, but I'm planning a trip to Rocky Mountain State Park on Saturday. Got a brand new camera just for this!Later...
JR
"When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson
Comment
-
-
Originally posted by John R. Heathcote View Post...
How about renaming gvbCodeBlock to gvbSource?
...
user defined option, but for now we should probably hard code the line split point at, say, 80 characters so it is readable without scrolling around too much to read it, just to get this beast out the door.
Again, I agree. Limiting the direct editor/Tokenizer interface will also make it easier to add editor functionality without worrying about invalidating some functionality in the Tokenizer.
...
As I mentioned previously if you get on I-70 and head west you will see many more mountains ...
Alas, this is the only free weekend I was able to work out.That's the problem with business trips -- business gets in the way having fun. Good thing I like the job.
Interesting that you mentioned all those John Wayne movies. While taking a walk the other day I imagined myself in that old classic, Shane. I'm not exactly where I was, but I felt like I was walking through those old westerns.
...
Maybe on a return trip you might want to consider visiting the Black Canyon on the Gunnison. It is sort of Colorado's western slope answer to the Grand Canyon. ...Do not go quiet into that good night,
... Rage, rage against the dark.
Comment
-
-
Stan,
That's the problem with business trips -- business gets in the way having fun.
Interesting that you mentioned all those John Wayne movies. While taking a walk the other day I imagined myself in that old classic, Shane. I'm not exactly where I was, but I felt like I was walking through those old westerns.
Now back to business, does anybody have some code snippets for VB form conversion so I can see how difficult it will be to integrate this with the Scintilla edit control? Would greatly appreciate it.Later...
JR
"When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson
Comment
-
Comment