Page 1 of 1

Editor help - does it work with macros ?

Posted: Sun May 14, 2017 8:09 pm
by Brane2
Or perhaps is there a way to add similar fuctionality ?

I'd like to be able to define string of chars when working with C, but there is no simple way of doing this.

In C, "my_string_abc" makes a string (= that text + \n" ) somewhere in predefined read-only data space of a program.

When I want to set the value of the elements of char array, I have to use signle qoutes around { 'e' , 'a' , 'c' , 'h', '_', 'c' , 'h' , 'a' , 'r' }, which is killing me.

Quick workaround is to make a simple CLI util which would accept my string and generate separate header file that I could then include.

But that is major drain on my love of life and PITA in general. :x

Is there a way that I could have some sort of plugin/macro that could automate such things ?

Re: Editor help - does it work with macros ?

Posted: Sun May 14, 2017 9:20 pm
by eranif
Whats wrong with writing something like this:

Code: Select all

const char* myString = "hello world";
?

Re: Editor help - does it work with macros ?

Posted: Sun May 14, 2017 9:30 pm
by Brane2
That version automatically appends \n to the string and also reserves space for const string.

I want to use struct that uses char string with known length, without the need for special chars.

It would be cool if C would recognise something like

Code: Select all

 char myarr[]= { 'something' }
which it doesn't . GCC AFAIK recognises it, but it doesn't work in that way.

Re: Editor help - does it work with macros ?

Posted: Sun May 14, 2017 9:39 pm
by Brane2
BTW, this would be nice to have:

- option for selectable number of columns formatting.

- option for inserting chars as given in typed string and/or file, their codes in hexa/decimal/octal/binary, their escaped codes like \xxx in hex, octal or bin.

Re: Editor help - does it work with macros ?

Posted: Sun May 14, 2017 10:12 pm
by Brane2
BTW, GIMP has an option for saving a graphics in form of C array ( which surprised me, I admit).

But for small and/or non-graphic stuff, it would be very nice to have an option from Codelite's side.

I suspect this coudl be very useful in embedded systems ( includion of binary headers, special code sequences, small graphics and icons etc).