π
<-
Chat plein-écran
[^]

iostream et STL

C, C++, ASM...

Re: iostream et STL

Message non lude parisse » 10 Mai 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).
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 78%
 
Messages: 3511
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: iostream et STL

Message non lude Excale » 10 Mai 2014, 15:54

Built!
Its seems to work correctly on the emulator.
Thanks!
Avatar de l’utilisateur
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 3.9%
 
Messages: 2955
Images: 3
Inscription: 10 Sep 2010, 00:00
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: iostream et STL

Message non lude Excale » 10 Mai 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: Tout sélectionner
        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
Avatar de l’utilisateur
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 3.9%
 
Messages: 2955
Images: 3
Inscription: 10 Sep 2010, 00:00
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: iostream et STL

Message non lude parisse » 10 Mai 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)
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 78%
 
Messages: 3511
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: iostream et STL

Message non lude Excale » 10 Mai 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)
Avatar de l’utilisateur
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 3.9%
 
Messages: 2955
Images: 3
Inscription: 10 Sep 2010, 00:00
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: iostream et STL

Message non lude Adriweb » 10 Mai 2014, 22:56

Just for the sake of getting everything to compile, only ustl fails, for me :
Code: Tout sélectionner
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 :)
Image

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...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80.3%
 
Messages: 14617
Images: 1218
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: iostream et STL

Message non lude parisse » 11 Mai 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: Tout sélectionner
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.
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 78%
 
Messages: 3511
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: iostream et STL

Message non lude Lionel Debroux » 11 Mai 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.
Avatar de l’utilisateur
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Prochain niv.: 11.2%
 
Messages: 6859
Inscription: 23 Déc 2009, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: -
GitHub: debrouxl

Re: iostream et STL

Message non lude parisse » 11 Mai 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: Tout sélectionner
inline double abs(double d){ return (d<0)?-d:d;}
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 78%
 
Messages: 3511
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Précédente

Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 19 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1500 utilisateurs:
>1486 invités
>9 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)