π
<-

iostream et STL

C, C++, ASM...

Re: iostream et STL

Unread postby parisse » 10 May 2014, 15:38

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).
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 89.4%
 
Posts: 3721
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: iostream et STL

Unread postby Excale » 10 May 2014, 15:54

Built!
Its seems to work correctly on the emulator.
Thanks!
User avatar
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 3.9%
 
Posts: 2955
Images: 3
Joined: 10 Sep 2010, 00:00
Gender: Male
Calculator(s):
MyCalcs profile

Re: iostream et STL

Unread postby Excale » 10 May 2014, 17:50

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.

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?

Image
User avatar
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 3.9%
 
Posts: 2955
Images: 3
Joined: 10 Sep 2010, 00:00
Gender: Male
Calculator(s):
MyCalcs profile

Re: iostream et STL

Unread postby parisse » 10 May 2014, 19:00

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)
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 89.4%
 
Posts: 3721
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: iostream et STL

Unread postby Excale » 10 May 2014, 21:26

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 If (wline) wline[j] = 0;.

(plus it stores a 4 bytes \0 instead of a 2 bytes \0)
User avatar
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 3.9%
 
Posts: 2955
Images: 3
Joined: 10 Sep 2010, 00:00
Gender: Male
Calculator(s):
MyCalcs profile

Re: iostream et STL

Unread postby Adriweb » 10 May 2014, 22:56

Just for the sake of getting everything to compile, only ustl fails, for me :
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 ? :P

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
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 79.7%
 
Posts: 14820
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: iostream et STL

Unread postby parisse » 11 May 2014, 09:18

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:
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.
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 89.4%
 
Posts: 3721
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: iostream et STL

Unread postby Lionel Debroux » 11 May 2014, 09:23

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.
User avatar
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 11.3%
 
Posts: 6869
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Class: -
GitHub: debrouxl

Re: iostream et STL

Unread postby parisse » 11 May 2014, 16:59

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
Code: Select all
inline double abs(double d){ return (d<0)?-d:d;}
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 89.4%
 
Posts: 3721
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Previous

Return to Native: Ndless, Linux, ...

Who is online

Users browsing this forum: ClaudeBot [spider] and 12 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1500 utilisateurs:
>1482 invités
>11 membres
>7 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)