iostream et STL
Re: iostream et STL
Indeed, galois_field works only with RTTI. Replace at_GF by at_nop in static_lexer_at.h and this time it should link (unless there is another problem with libraries).
-
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)- Posts: 3721
- Joined: 13 Dec 2013, 16:35
- Gender:
- Calculator(s):→ MyCalcs profile
Re: iostream et STL
Built!
Its seems to work correctly on the emulator.
Thanks!
Its seems to work correctly on the emulator.
Thanks!
-
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 2955
- Images: 3
- Joined: 10 Sep 2010, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
Re: iostream et STL
I read the API quick-doc (http://www-fourier.ujf-grenoble.fr/~par ... l#Examples) but I cannot find any reference to UTF-8/unicode.
utf82unicode returns a string which isn't \0\0 terminated. What did I do wrong?

- Code: Select all
nio::console console_cin;
console_cin_ptr=&console_cin;
clrscr();
giac::context c;
string s(unicode2utf8(calcul)); // wchar_t* calcul; UTF-16
console_cin.foreground_color(nio::COLOR_GREEN);
giac::gen g(s,&c);
console_cin.foreground_color(nio::COLOR_BLUE);
g=eval(g,&c);
COUT << g << endl; //OK
COUT << g.print() << endl; //OK
bkpt();
utf82unicode(g.print())
utf82unicode returns a string which isn't \0\0 terminated. What did I do wrong?
-
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 2955
- Images: 3
- Joined: 10 Sep 2010, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
Re: iostream et STL
utf82unicode takes a char * as argument, not a string, the compiler should not compile utf82unicode(g.print()) but utf82unicode(g.print().c_str()) should work and return a 0 terminated wchar_t * (it is allocated using varname=new wchar_t[size+1]; therefore should be deleted by delete [] varname)
-
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)- Posts: 3721
- Joined: 13 Dec 2013, 16:35
- Gender:
- Calculator(s):→ MyCalcs profile
Re: iostream et STL
Actually, sizeof(wchar_t) seems to be 4. The final 0 is thus placed too far (UTF-16 would rather have a 2-bytes-long char type) with
(plus it stores a 4 bytes \0 instead of a 2 bytes \0)
If (wline) wline[j] = 0;
.(plus it stores a 4 bytes \0 instead of a 2 bytes \0)
-
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 2955
- Images: 3
- Joined: 10 Sep 2010, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
Re: iostream et STL
Just for the sake of getting everything to compile, only ustl fails, for me :
I've tried changing some things in the Config.mk, to no avail... :/
How did you get it to link ?
giac works fine with your .a
Edit : well, creating a main.cc with just
- Code: Select all
ld (ld-elf2flt): -shared used without passing a shared library ID
I've tried changing some things in the Config.mk, to no avail... :/
How did you get it to link ?

giac works fine with your .a

Edit : well, creating a main.cc with just
int main(void) { return 0; }
, and removing the "-shared" in slib (config.mk), it did link correctly... and giac still works correctly 
MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)My calculator programs
Mes programmes pour calculatrices
-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 14820
- Images: 1131
- Joined: 01 Jun 2007, 00:00
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- Twitter: adriweb
- GitHub: adriweb
Re: iostream et STL
Indeed, I was mistaken, unicode is not UTF16 (except maybe on windows?), sizeof(wchar_t)==4 and not 2. It seems there are UTF8 to UTF16 converter in global.cc:
they just need to be declared in global.h in order to be used.
- Code: Select all
unsigned int ConvertUTF8toUTF16 (
const UTF8* sourceStart, const UTF8* sourceEnd,
UTF16* targetStart, UTF16* targetEnd, ConversionFlags flags);
unsigned int ConvertUTF16toUTF8 (
const UTF16* sourceStart, const UTF16* sourceEnd,
UTF8* targetStart, UTF8* targetEnd, ConversionFlags flags);
they just need to be declared in global.h in order to be used.
-
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)- Posts: 3721
- Joined: 13 Dec 2013, 16:35
- Gender:
- Calculator(s):→ MyCalcs profile
Re: iostream et STL
In C11, one can use char16_t and char32_t... but few library functions can deal with those, and C11 support in the real world remains lackluster for now (I faced the problem for libhpcalcs).
Membre de la TI-Chess Team.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
-
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)- Posts: 6869
- Joined: 23 Dec 2009, 00:00
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: -
- GitHub: debrouxl
Re: iostream et STL
Updated:
1/ http://www-fourier.ujf-grenoble.fr/~parisse/calc/giac.tgz to version 1.1.1, including export of utf8 to utf16 conversion functions.
2/ http://www-fourier.ujf-grenoble.fr/~parisse/calc/nspire-io.tar.bz2 change to dtostr (some doubles were not printed correctly at all)
3/ http://www-fourier.ujf-grenoble.fr/~parisse/calc/ndless.tar.bz2: cmath changed, inline definition for abs did not work, changed to
1/ http://www-fourier.ujf-grenoble.fr/~parisse/calc/giac.tgz to version 1.1.1, including export of utf8 to utf16 conversion functions.
2/ http://www-fourier.ujf-grenoble.fr/~parisse/calc/nspire-io.tar.bz2 change to dtostr (some doubles were not printed correctly at all)
3/ http://www-fourier.ujf-grenoble.fr/~parisse/calc/ndless.tar.bz2: cmath changed, inline definition for abs did not work, changed to
- Code: Select all
inline double abs(double d){ return (d<0)?-d:d;}
-
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)- Posts: 3721
- Joined: 13 Dec 2013, 16:35
- Gender:
- Calculator(s):→ MyCalcs profile
Return to Native: Ndless, Linux, ...
Who is online
Users browsing this forum: ClaudeBot [spider] and 12 guests