True. You may can consider something like this: $ perl -e "while(<>){ s/\/\/(.*)$/\/* \1 *\//; print; }" | indent for(i=3D0;i<10;i++) // kahjg sdjg skjdg fkjsg fkjg sdkfjg askdjfg kasjg fkjasgdfkjhags kfjg skjfg kjsg fkjags kfjgskajdfg kjsg fkjags kjdfg js { } for (i =3D 0; i < 10; i++) { /* kahjg sdjg skjdg fkjsg fkjg sdkfjg askdjfg * kasjg fkjasgdfkjhags kfjg skjfg kjsg * fkjags kfjgskajdfg kjsg fkjags kjdfg js */ } Also upon the word 'beautifier' you may can also search for 'pretty print'. Tamas On Mon, Aug 1, 2011 at 9:05 PM, peter green wrote: > Tamas Rudnai wrote: > > Do you mean formatting the C++ source to a nicer looking format? > No > > There is a > > tool called 'indent' for that which is standar on most linux and unix > > distributions including MacOS X. > While indent does supposedly have a line length limiting feature it > doesn't seem possible to use it without using all the other > "beautifying" features and it doesn't shorten comment lines. > > > > Also you can search for 'c++ beautifier'. > > With 'indent' you can tell your coding style and it changes the source > code > > according to that. For example if you like the curly on the same line a= s > the > > function definition or a new line, if you want space after brackets, > > indenting etc. > > > > For example: > > > > tamas-mac:~ trudnai$ indent > > for(i=3D0; i<10; i++) { int u=3D0; int v=3D0; for(v=3D9;v;v--) { }} > > for (i =3D 0; i < 10; i++) { > > int u =3D 0; > > int v =3D 0; > > for (v =3D 9; v; v--) { > > } > > } > > > > As you can see from the first line it creates a nicer looking source > code. > > But you can change the style, for example to put the curly into the nex= t > > line instead: > > > > tamas-mac:~ trudnai$ indent -bl > > for(i=3D0; i<10; i++) { int u=3D0; int v=3D0; for(v=3D9;v;v--) { }} > > for (i =3D 0; i < 10; i++) > > { > > int u =3D 0; > > int v =3D 0; > > for (v =3D 9; v; v--) > > { > > } > > } > > > > You can also tell to break up long lines without braking the C++ rules = as > it > > contains a true C++ parser... > > > > Tamas > > > > > > > > > > On Mon, Aug 1, 2011 at 6:46 PM, peter green > wrote: > > > > > >> I want a tool that can take c++ code (though I think the only c++ > >> specfic feature i'm using is c++ style comments) and break up lines > >> without destroying the code and without making any other unessacery > >> changes. > >> > >> Anyone got any suggestions for a tool that can do this? > >> -- > >> http://www.piclist.com PIC/SX FAQ & list archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > >> > > > > > > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .