Editor help - does it work with macros ?

General questions regarding the usage of CodeLite
Brane2
CodeLite Curious
Posts: 7
Joined: Sun Oct 05, 2014 2:09 am
Genuine User: Yes
IDE Question: C++
Contact:

Editor help - does it work with macros ?

Post 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 ?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Editor help - does it work with macros ?

Post by eranif »

Whats wrong with writing something like this:

Code: Select all

const char* myString = "hello world";
?
Make sure you have read the HOW TO POST thread
Brane2
CodeLite Curious
Posts: 7
Joined: Sun Oct 05, 2014 2:09 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Editor help - does it work with macros ?

Post 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.
Brane2
CodeLite Curious
Posts: 7
Joined: Sun Oct 05, 2014 2:09 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Editor help - does it work with macros ?

Post 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.
Brane2
CodeLite Curious
Posts: 7
Joined: Sun Oct 05, 2014 2:09 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Editor help - does it work with macros ?

Post 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).
Post Reply