Page 1 of 1
Code folding for Clipper, Xbase language
Posted: Tue May 17, 2005 2:14 pm
by Tadeusz
Code: Select all
Extension: .prg .h .ch
Line Comment: //
Block Comment: /* */
Begin: begin sequence
End: end sequence
Begin: if
else
elseif
End: endif
Begin: for
End: end
Begin: function
End: return
Begin: procedure
End: return
Begin: do case
case
otherwise
End: endcase
Begin: do while
End: end do
PROCEDURE Main
LOCAL nMenuItem
@ 2, 1 PROMPT " DBF file "
@ 4, 1 PROMPT " NTX file "
@ 6, 1 PROMPT " Search "
MENU TO nMenuItem
SetPos( 0, 0 )
DO CASE
CASE nMenuItem == 1
? "selects DBF file"
CASE nMenuItem == 2
? "selects index file"
CASE nMenuItem == 3
? "searches data record"
OTHERWISE
nMenuItem := Alert( "Exit program?", ;
{" Yes "," No " } )
SetPos( 0, 0 )
DO CASE
CASE nMenuItem == 0
? "No selection met"
CASE nMenuItem == 1
QUIT
CASE nMenuItem == 2
? "continues program"
ENDCASE
ENDCASE
RETURN
Posted: Wed May 18, 2005 8:21 am
by jussij
The code folding for Clipper has been implemented and the new xFolder.dll can be found here:
http://www.zeusedit.com/z300/xfolder.zip
To install the new dll make a backup copy of the current
xFolder.dll file, located in the Zeus installation directory and replace it with one from the zip file above.
You will also need to create a new Clipper
Document Type and enable the
Display line folds margin option.
There is one issue with this new folder. The
.h extension is used by the
c/c++ folder so naturally any clipper
.h files will be folded incorrectly using the
c/c++ folder
If you find any other problems with this new dll just post a reply to this topic.
Cheers Jussi
Posted: Wed May 18, 2005 1:18 pm
by Tadeusz
It works. Thanks
CLipper code folding
Posted: Fri Jul 15, 2005 9:17 am
by aschaft
How easy is it for the end user to add items to these?
I'd like to see class/endclass, method/return, static/return, function/return
Alex
Posted: Sat Jul 16, 2005 1:58 am
by jussij
The folding is easy enough to change but at present it is hard coded into the folding dll, so the changes are not user configurable
But I am more than happy add your changes to the current folding dll so watch this space for a new dll coming soon
But I do have a question. The class/endclass is straight forward enough as is the method/return and I think the function/return is already in the folder dll. But I don't understand the static/return case
I did a bit of a search and found this link:
http://www.clipx/ng/clguide/ngbbed3.php
This page seems to suggest the
static is an optional qualifier for a function, so would not this fold already be covered by by the function/return case
Cheers Jussi
Posted: Sat Jul 16, 2005 2:18 am
by jussij
The above changes (other than the static change) have been made and the new xFolder.dll can be found here:
http://www.zeusedit.com/z300/xfolder.zip
To install the new dll make a backup copy of the current
xFolder.dll file, located in the Zeus installation directory and replace it with one from the zip file above.
You will also need to create a new Clipper
Document Type and enable the
Display line folds margin option.
Cheers Jussi
Posted: Sat Jul 16, 2005 10:55 am
by aschaft
Thanks, I'll try it out.
I'll check on the static part as well
Alex
Class/endclass bug
Posted: Sat Jul 16, 2005 11:27 am
by aschaft
Hi,
It seems there's a problem with the class/endclass collapse. Clicking on the - next to class collapses the whole file.
Alex
Posted: Sun Jul 17, 2005 11:24 pm
by jussij
But a few things to release is when any start of fold folds up the entire file it means that the number of start folds does not match the number of end folds.
So the folding might in fact be working, or alternatively your coding style might have confused the folding logic.
Could you please post a short snippet of sample code that highlights this problem.
Cheers Jussi
PS: The folder also has a
Lines Containing Multiple End of Fold Markers limitation.
Posted: Mon Jul 18, 2005 7:51 am
by aschaft
Hi,
Sample below
CLASS MyClass
DATA cTitle
Method New Constructor
Method Activate
ENDCLASS
//--------------------------------
Method New() CLASS MyClass
::cTitle := "My class"
return self
//--------------------------------
Method Activate
// Do something
return nil
//--------------------------------
Posted: Mon Jul 18, 2005 9:21 am
by jussij
This sample code definitely highlights a few problems.
For example the definition of the
Method New Constructor within the class is identical to implementation of that method, so naturally they both look like start of folds, where in fact only the later is a fold
Similarly the
CLASS MyClass definition text is also found in the implementation of the method and hence both these lines look like fold points, where in fact only the former line is a fold
So the folder in it's current state will definitely not work
Unless there is a way to distinguish the real fold points from the other non-fold points the folding can not possibly work.
The only way I can see that the two can be distinguished is the fact that the real folds will more likely than not occur at the start of line. Is this a valid assumption for most xBase code
So the new xfolder.dll implements this rule and provided the class, function, method and procedure are at the start of line the folding seems to now work fine.
Cheers Jussi
Posted: Mon Jul 18, 2005 7:02 pm
by aschaft
That's perfect, thanks.
Alex