badidea wrote:Trying to convert the code into a class, so I can use it more easy in some code of mine...
You can set up three key-startet Geany commands. And several more startet by mouse activity. Which other features do you use, so that you are short of free command slots?
- <crtl>-1: FBeauty -> fix character cases
<crtl>-2: fbdoc -> generate templates for documentation (+ translate FB code to C code)
<crtl>-1: h_2_bi -> translate C code to FB code
It's open source, so you're free to convert the code to whatever you want. And convert it again after the next update.badidea wrote:Haven't checked to "-i" option yet.
What do you think of the conversion?
Would be cool to include an indent fixer. Not sure how complex that is.
Transforming keyword letter cases and auto indenting have totally different code parsing requirements. Auto indentation needs more information than the FBeauty parser can serve.
From my point of view auto-indentation is a bad idea. It's for people who always do what their teachers say. I often use custom indentation to make code more easy to understand. For example this code fragment from libpruio example pwm_cap
Code: Select all
IF .Errr THEN ?"NEW failed: " & *.Errr : EXIT DO
IF .Cap->config(P_IN, 2.) THEN _ ' configure input pin
?"failed setting input @P_IN (" & *.Errr & ")" : EXIT DO
DIM AS Float_t _
f1 _ '*< Variable for calculated frequency.
, d1 _ '*< Variable for calculated duty cycle.
, f0 = 31250 _ '*< The required frequency.
, d0 = .5 '*< The required duty cycle.
IF .Pwm->setValue(P_OUT, f0, d0) THEN _
?"failed setting output @P_OUT (" & *.Errr & ")" : EXIT DO
IF .config(1, 2) THEN _ ' upload configuration to PRU
?"config failed: " & *.Errr : EXIT DO