RingFmt.ring formatting code

56 views
Skip to first unread message

Bert Mariani

unread,
Oct 9, 2025, 11:38:40 AMOct 9
to The Ring Programming Language
Hello Mahmoud et ALL

I tested  RingFmt.ring against a simple script.
These are the result differences with my CodeFormatter.ring
Note the  "See" line as for readability.
I think RingFmt.ring can use some extra spacing.

==========================
Process file: code-2-b.ring
===========================================
test()

func test()

        z++
        a = 6
        b = 5
        if a >= b
                a = 4
        ok
        if a <= b and z = 9
                a = 12
        ok
        see "Data: "+A+"abc"+"++"+B+nl   // <<<<<
        return

==========================

test()
func test()
    z++
    a = 6
    b = 5
    if a >= b
        a = 4
    ok
    if a <= b AND z = 9
        a = 12
    ok
    See "Data: " + A + "abc" + "++" + B + nl    // <<<<<
    return

==========================
code-2-b.ring
CodeFormatter.ring

Bert Mariani

unread,
Oct 27, 2025, 3:11:41 PM (4 days ago) Oct 27
to The Ring Programming Language
Hello Mahmoud et ALL

Attached it the GUI version of RingFmt.ring
   - RingFmt-GUI.ring
   - code-1.c.ring

The original code is ALL intact.
Added a few  "addText( sData)  for output to the TextEdit Box in the original code.

USAGE:
Go-Dialog
   Select 1 file ring file
   Formats it.

Go-Directory
   Enter the * Pattern to match fileNames:  Ex.   code-2*  ,  *.ring   etc
   It will bring up a Directory Dialog.
   Click on "Select Directory"  OR  change Directory.
   Formats all  ring files that the match Pattern in the name.

Params:
   Chose parameter using dropdown list
   Class
   Indent
   Output

FIXED for readability  - the Arithmetic Ops added
    RingFmt.ring  
         c = b-a
         plus = a+b
         SEE "Data: "+A+"abc"+"++"+B+nl

   RingFmt-Gui.ring
         c = b - a
         plus = a + b
        SEE "Data: " + A + "abc" + "++" + B + nl

Question:
The cTabChars = Tab  - -  8 spaces  -- which seems too much.
How can it be set to 4 spaces

func getTabChars
    cTabChars = Tab          // 8 spaces 
    switch cIndentation
        on :spaces
            cTabChars = Copy(" ",8)

==============================
OUTPUT

RingFormatterGUI.png
code-2-c.ring
RingFormatterGUI.png

Mansour Ayouni

unread,
Oct 27, 2025, 6:19:59 PM (3 days ago) Oct 27
to Bert Mariani, The Ring Programming Language
Hello Bert,

I appreciate your steady rhythm of making working and passionate contributions to Ring!

All the best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/3e96d16e-763a-43a5-a89c-096e8ea9557cn%40googlegroups.com.

Bert Mariani

unread,
Oct 28, 2025, 11:19:42 AM (3 days ago) Oct 28
to The Ring Programming Language
Hello Mansour

Thanks for the compliment !
Together with Everyone's Input we can make Ring easier to use,  performant, flexible ,and intuitive.

We can show Ring's  capabilities by writing various programs of interest with relative ease !
Programs that I have not attempted to write in the past with other languages ....
I have managed to write them in Ring and been surprised to be able to do them !
Because of Ring's huge capabilities and array of "Swiss Army Knife" Tools.

Best Regards
Bert Mariani
Reply all
Reply to author
Forward
0 new messages