Syntax highlighting on Templot Club

Martin Wynne

Admin
Location
West of the Severn UK
Info
Please do not send requests for help direct to me via email.

Post your questions on the forum where everyone can see them and add helpful replies.
With the prospect of some activity on T3, here is the good news. :)

The posting editor on this new forum has 2 code formatting options:

xf_syntax_highlighting.png


Inline code looks like this: abc:=123; blue_banana:=False; which is useful for short clips.

Code provides a full editor box with syntax highlighting for a range of languages, but unfortunately not Pascal. The nearest for us seems to be SQL:

SQL:
    if slewing=True   // 1-11-99
       then begin
              if (ABS(slew)>slew_l) or (ABS(slew)<minfp)   // no SQRT, div by zero.
                 then begin
                        slew_pull_back:=0;
                        slew_angle:=0;
                      end
                 else begin
                        try
                          slew_pull_back:=( slew_l-SQRT(SQR(slew_l)-SQR(slew)) )*2;     // 1-11-99   *2 is arbitrary approx for shortening effect of S-curve.
                          slew_angle:=ARCTAN(slew_pull_back/slew);
                        except
                          slew_pull_back:=0;
                          slew_angle:=ARCTAN(2.0);
                        end;//try
                      end;
              slew_t:=slew_angle;    //  slewing angle is same for straight track.

              if slew_mode=2
                 then begin      // calc constants once only...

                        if slew2_kmax<0.02 then slew2_kmax:=0.02;       // safety.

                        slew2_rot:=ARCTAN(1-SQR(TANH(slew2_kmax)));     // dy/dx TANH(x) = 1-TANH^2(x)  rotation angle needed in trig units.

                        pin.x:=slew2_kmax;
                        pin.y:=TANH(slew2_kmax);
                        dotransform(0-slew2_rot,0,0,pin,pout);

                        slew2_ymax:=pout.y;
                        slew2_ymin:=0-slew2_ymax;
                      end;
            end;//slewing

With a scrollbar instead of line-wrapping for long lines, which is much better that some other formatters. :)

It's worth setting the font to Courier New in the main editor before using the Code editor, because the formatted code appears only on Preview or after posting.

cheers,

Martin.
 
_______________
message ref: 486
Top