Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

About AStyle plugin, Here is a new problem

<< < (2/3) > >>

Loaden:
example, this code:

--- Code: ---#include <windows.h>

int Foo (bool isBar)
{
    if (    isBar  ()  )
    {
        bar ();
        return 1;
    }
    else
        return 0;
}

int main()
{
    for (int i = 0; i < 10; ++i)
    {
        cout << i << endl;
    }

    ::MessageBox (0, 0, 0, 0);
    return 0;
}

--- End code ---
How to format it to:

--- Code: ---#include <windows.h>

int Foo(bool isBar)
{
    if (isBar())
    {
        bar();
        return 1;
    }
    else
        return 0;
}

int main()
{
    for (int i = 0; i < 10; ++i)
    {
        cout << i << endl;
    }

    ::MessageBox(0, 0, 0, 0);
    return 0;
}

--- End code ---
but not:

--- Code: ---#include <windows.h>

int Foo(bool isBar)
{
    if(isBar())
    {
        bar();
        return 1;
    }
    else
        return 0;
}

int main()
{
    for(int i = 0; i < 10; ++i)
    {
        cout << i << endl;
    }

    ::MessageBox(0, 0, 0, 0);
    return 0;
}

--- End code ---



[attachment deleted by admin]

MortenMacFly:

--- Quote from: Loaden on January 24, 2010, 05:47:53 pm ---example, this code:
[...]
How to format it to:
[...]
but not:
[...]

--- End quote ---
That's simply not possible with the set of options given.

Loaden:

--- Quote from: MortenMacFly on January 24, 2010, 06:42:03 pm ---
--- Quote from: Loaden on January 24, 2010, 05:47:53 pm ---example, this code:
[...]
How to format it to:
[...]
but not:
[...]

--- End quote ---
That's simply not possible with the set of options given.

--- End quote ---
Do not, AStyle can do that!
Launching tool 'AStyle': D:\LoveDEV\tool\AStyle.exe --style=allman --indent=spaces --indent-cases --indent-preprocessor --pad-oper --unpad-paren --keep-one-line-statements --keep-one-line-blocks --convert-tabs --suffix=none D:\Projects\fsefe\main.cpp (in D:\Projects\fsefe)
stdout> formatted  D:\Projects\fsefe\main.cpp
Tool execution terminated with status 0

Current code:

--- Code: ---#include <windows.h>

int Foo(bool isBar)
{
    if(              isBar              (        )           )
    {
        bar            (          );
        return 1;
    }
    else
        return 0;
}

int main()
{
    for(int i = 0; i < 10; ++i)
    {
        cout << i << endl;
    }

    ::MessageBox            (0, 0, 0, 0);
    return 0;
}

--- End code ---
Can formatted to :

--- Code: ---#include <windows.h>

int Foo(bool isBar)
{
    if (isBar())
    {
        bar();
        return 1;
    }
    else
        return 0;
}

int main()
{
    for (int i = 0; i < 10; ++i)
    {
        cout << i << endl;
    }

    ::MessageBox(0, 0, 0, 0);
    return 0;
}
--- End code ---

[attachment deleted by admin]

Loaden:
And I found a bug: If you run this tool, The CB Editor did not prompt the file has been modified.


[attachment deleted by admin]

MortenMacFly:

--- Quote from: Loaden on January 25, 2010, 01:11:01 am ---
--- Quote from: MortenMacFly on January 24, 2010, 06:42:03 pm ---That's simply not possible with the set of options given.

--- End quote ---
Do not, AStyle can do that!

--- End quote ---
Look: I meant it's not possible with the options given by C::B. You can enhance the plugin if you like and add the appropriate options. It's pretty easy.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version