Code folding for Clipper, Xbase language

This forum should be used for all code folding problems, questions or suggestions. You can also use this forum to request folding support for a new language.
Post Reply
Tadeusz
Posts: 2
Joined: Fri Feb 25, 2005 4:07 pm

Code folding for Clipper, Xbase language

Post by Tadeusz » Tue May 17, 2005 2:14 pm

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 
 

jussij
Site Admin
Posts: 2429
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Wed May 18, 2005 8:21 am

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

Tadeusz
Posts: 2
Joined: Fri Feb 25, 2005 4:07 pm

Post by Tadeusz » Wed May 18, 2005 1:18 pm

It works. Thanks

aschaft

CLipper code folding

Post by aschaft » Fri Jul 15, 2005 9:17 am

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

jussij
Site Admin
Posts: 2429
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Sat Jul 16, 2005 1:58 am

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

jussij
Site Admin
Posts: 2429
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Sat Jul 16, 2005 2:18 am

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

aschaft
Posts: 6
Joined: Fri Jul 15, 2005 9:34 am

Post by aschaft » Sat Jul 16, 2005 10:55 am

Thanks, I'll try it out.

I'll check on the static part as well

Alex

aschaft
Posts: 6
Joined: Fri Jul 15, 2005 9:34 am

Class/endclass bug

Post by aschaft » Sat Jul 16, 2005 11:27 am

Hi,

It seems there's a problem with the class/endclass collapse. Clicking on the - next to class collapses the whole file.

Alex

jussij
Site Admin
Posts: 2429
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Sun Jul 17, 2005 11:24 pm

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.

aschaft
Posts: 6
Joined: Fri Jul 15, 2005 9:34 am

Post by aschaft » Mon Jul 18, 2005 7:51 am

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
//--------------------------------

jussij
Site Admin
Posts: 2429
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Mon Jul 18, 2005 9:21 am

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

aschaft
Posts: 6
Joined: Fri Jul 15, 2005 9:34 am

Post by aschaft » Mon Jul 18, 2005 7:02 pm

That's perfect, thanks.

Alex

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 2 guests