Mac OS 9 Lives

Mac OS 9 Discussion => Development & Programming => Topic started by: OS923 on December 02, 2019, 08:27:50 AM

Title: Contextual menu extension to reindent parameter lists
Post by: OS923 on December 02, 2019, 08:27:50 AM
I wrote a contextual menu extension to reindent parameter lists.

Before:
Code: [Select]
Bool Read(n1 x,
       n1 y,
             n1 z)
{
    if (!Read("\pInput (many)",
                m_save,
           k))
        {
        Return_false("\pError (-110)",
                       k);
        }
    /* Test(a,
          b); */
    Test(a,
       b);
    // Test(a,
    //    b);
    Test(a,
      b);
    Test(A(x,
      y),
             B(z,
                 w));
    return True;
}

After:
Code: [Select]
Bool Read(n1 x,
          n1 y,
          n1 z)
{
    if (!Read("\pInput (many)",
              m_save,
              k))
        {
        Return_false("\pError (-110)",
                     k);
        }
    /* Test(a,
          b); */
    Test(a,
         b);
    // Test(a,
    //    b);
    Test(a,
         b);
    Test(A(x,
           y),
         B(z,
           w));
    return True;
}

At this moment it contains 512 K of zeroes.
I'll try to make a smaller version.
Title: Re: Contextual menu extension to reindent parameter lists
Post by: OS923 on December 08, 2020, 11:03:01 AM
See the smaller version in the attachment.
Title: Re: Contextual menu extension to reindent parameter lists
Post by: OS923 on December 23, 2020, 04:31:37 AM
Zero downloads? That’s one of my best softwares ever.
Title: Re: Contextual menu extension to reindent parameter lists
Post by: Daniel on December 23, 2020, 08:51:04 AM
Sadly, our greatest achievements are often completely useless for end users.
Title: Re: Contextual menu extension to reindent parameter lists
Post by: Jubadub on December 25, 2020, 05:50:52 AM
What are parameter lists used for? What are the benefits of reindenting them?

Depending on the answers to these 2 questions, it may get a lot more downloads. :)

EDIT: Typo fix.
Title: Re: Contextual menu extension to reindent parameter lists
Post by: OS923 on December 25, 2020, 07:22:39 AM
A parameter list is a part of a function prototype or a function call in a programming language. (This forum is about programming, remember?) We like to place the parameters neatly in one column, one parameter per line. This costs effort typing many spaces, so it’s helpful when this is done automatically.
Title: Re: Contextual menu extension to reindent parameter lists
Post by: Jubadub on December 25, 2020, 09:04:03 AM
I see, a parameter list, as in, the list of arguments to be passed onto a method within code in a text file of your choosing. For general code text identation. I see, my bad for not looking at the "Before" and "After" boxes carefully.

Yeah, that's cool, although I would personally not split my parameters with one per line... But still, that's a nice little CM. Does the ".sitx" also include the source?
Title: Re: Contextual menu extension to reindent parameter lists
Post by: OS923 on December 25, 2020, 09:10:21 AM
No, no source.
Title: Re: Contextual menu extension to reindent parameter lists
Post by: OS923 on January 21, 2021, 07:31:27 AM
There’s a bug where it doesn’t save the new text because the length is the same. There’s a small chance that this happens. This is already fixed for the next version.