1

Voilà, deux questions :

- Comment créer une variable de type STR, et comment créer une variable de type NUM ? Enfin je veux dire est-il possible d'utiliser push_ANSI_string et push_longint (ou qqchose dans le genre) au lieu d'apprendre la structure de ces variables ?

- Est-il possible avec cette méthode de modifier des variables systèmes, en l'occurence la variable 'ok' qui vaut 0 ou 1 suivant la touche utilisée pour sortir d'une boite dialog:enddlog ?
avatar
All right. Keep doing whatever it is you think you're doing.
------------------------------------------
Besoin d'aide sur le site ? Essayez par ici :)

2

tu peux faire un programme qui retourne une valeur, mais dans une variable, et non dans l'écran HOME

#define RETURN_VALUE nom_de_la_variable


cf doc de TIGCC


mais connaitre les formats des variables n'est pas une mauvaise idée... c assez instructif.
ET maitriser la VAT de la TI doit pouvoir donner une idée de système d'exploitation, et doit donner uen idée de la FAT sur PC, je pense...
(pas sûr)



sinon, modifier les variable ssytèmes...
vu qu'elles ne sont pas dans la VAT, je ne pense pas vraiment...
avatar
Tutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall

3

Beuh non c pas possible le RETURN_VALUE...

Déjà parceque ça fait un peu trop "pré-maché" je veux avoir quand même un bout de programme qui crée ma variable. Mais c'est pas très important, le problèmes c'est que je veux pouvoir retourner plein de variables distinctes, donc nécessairement il faut les créer "à la main".

La doc je l'ai lue, mais le format des fichiers (surtout des NUM) me parrait un peu compliqué... J'ai apprit qq trucs sur la VAT avec vertel, mais la création de STR et de NUM je pense que ça ne me servira jamais, c pas la peine d'apprendre ça.

push_ANSI_string et push_longint marcheraient d'après toi ?
avatar
All right. Keep doing whatever it is you think you're doing.
------------------------------------------
Besoin d'aide sur le site ? Essayez par ici :)

4

ben, si tu veux les créer à la main, tu as deux possibilité :

soit appel à stdio.h => plus simple, mais moins performant.
soit tu fais tout toi-même (vat.h), plus performant, mais moins simple.


le format des NUM est effectivement pas mal complexe...
voila presque un an, j'ai commencé à rédiger quelque chose sur les formats de vars... j'ai toujours pas fini (pas eu le temps)... j'espère pdt le svacances
création d'une str, c extrément simple. (il me semble que c texte + 0 + STR_TAG en gros)

push machin... je sais pas... mais je pense pas...
Il s'agit de créer une varible... donc, pas sur le stack, mais dans la VAT...
avatar
Tutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall

5

Bon je viens de tester push_ANSI_string, ça marche parfaitement top

Par contre je vais encore être confronté à ce putain de bug des espaces... Enfin bon ça se contourne Kevin m'avait expliqué comment faut que je retrouve le topic.
Pour les NUM si ça pouvait marcher aussi bien ça m'arrangerais tongue
V essayer ça tout de suite...
avatar
All right. Keep doing whatever it is you think you're doing.
------------------------------------------
Besoin d'aide sur le site ? Essayez par ici :)

6

Puis c'est pas tellement compliqué, la VAT, surtout pour toi, Bob 64, qui avec Vertel a du t'en servir pas mal...
Les formats fichier se ressemblent tous énormément : TAILLE_DE_LA_VAR (2 octets)+CODE+CARACTÈRE_NUL+TAG (en gros)

7

en gros.
pour la majeure partie des vars, c simple...

y'a que pr les progs basic et num que c chaud...

sinon, STr => simple
txt => simple

listes et autres, ça doit pas être trop dur.
avatar
Tutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall

8

Moué liste c'est très simple, et ça j'ai du m'en servir plus d'une fois dans vertel, en effet...
END_TAG,arg(n),arg(n-1)...arg(2),arg(1),LIST_TAG

STR c'est bon ça marche nikel (même avec des espaces), en effet c'était pas compliqué. Par contre NUM je sens que ça va prendre un peu plus de temps...
avatar
All right. Keep doing whatever it is you think you're doing.
------------------------------------------
Besoin d'aide sur le site ? Essayez par ici :)

9

num, y'a 36 possibilités...
les nombres simple, c pas dur.
les flotants, c plus dur smile
les expressions aussi.

je dois avoir un texte là dessus quelque part sur mon dur...

sinon, regarde dans la doc du SDK de TI, il me semble que cette partie est pas mal expliquéeq
avatar
Tutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall

10

Tu crees ta var dans l'estack puis
DerefSym(SymAdd(SYM_STR(machin)))->handle = HS_popEstack();

Voila grin

11

ça marche ???

Merde... Et moi qui me fait chier avec des trucs du style :

esi_bkp=top_estack;
push_quantum(END_TAG);
push_ANSI_string(vat_name(chr_str));
push_quantum(STR_TAG);
chr_ptr=vat_make(chr_var,top_estack-esi_bkp+2);
if(chr_ptr) memcpy(chr_ptr+2,esi_bkp+1,top_estack-esi_bkp);
top_estack=esi_bkp;


char *vat_make(char *chr_var,unsigned long lng_siz)
{
SYM_ENTRY *sym_var;
char *chr_sym;
sym_var=DerefSym(SymAdd(vat_name(chr_var)));
chr_sym=(char*)HeapDeref(sym_var->handle=HeapAlloc(lng_siz));
*(unsigned short *)chr_sym=lng_siz-2;
return chr_sym;
}
avatar
All right. Keep doing whatever it is you think you're doing.
------------------------------------------
Besoin d'aide sur le site ? Essayez par ici :)

12

Mouais... J'ai parlé trop vite les strings créées ne sont pas toujours valides, il doit manquer qq chose...
Et la routine de la doc de TIGCC crée une variable qui plante le Vars-link sad
avatar
All right. Keep doing whatever it is you think you're doing.
------------------------------------------
Besoin d'aide sur le site ? Essayez par ici :)

13

squale92 a écrit :
les flotants, c plus dur smile

Les flottants, c'est très simple, vu que TIGCC (le SDK de TI aussi, d'ailleurs) calcule tout le temps avec les flottants au format BCD, le même stocké dans les variables. Il suffit de remplacer l'octet des 2 derniers chiffres significatifs (tronqués quand on stocke une variable) par un FLOAT_TAG. Et il y a aussi la routine EX_stoBCD qui fait tout pour toi.

Et pour les entiers, c'est juste:
- POSINT_TAG ou NEGINT_TAG
- nombre d'octets (par exemple 0 pour 0, 1 pour 1-255, 2 pour 256-65535, ...)
- octet le plus significatif
...
- octet le moins significatif
et tout ça à l'envers, c'est-à-dire en fin de compte:
- octet le moins significatif
...
- octet le plus significatif
- nombre d'octets (par exemple 0 pour 0, 1 pour 1-255, 2 pour 256-65535, ...)
- POSINT_TAG ou NEGINT_TAG
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

14

J'ai jamais essaye si ca marchait. Peut etre HS_popEstack ne freait pas une MULTI_EXPR.

15

Quelques fonctions en vrac :
Correction : le lien ne marche pas ...
Si j'ai le temps, je ferais peut-être une routine CIntToAMSInt, mais de toutes façons, ce n'est pas compliqué smile
/****************************************************************************** * * project name:    C / AMS variables interface (static library). * initial date:    08/05/2002 * author:          Fabien Vinas -- fabienvin@voila.fr (zdrubal) * description:     main header file * * Note : You could use functions from 'estack.h' as GetStrnArg instead of those *        from 'vat.h' I used in the AMS String reading, but I found it more *        'funny' :). But It seems that functions using ESI pointers (such as *        AMSIntToCInt) are more optimized and that they take less memory. *        So as to optimize the library, I will implement string and char *        functions aliases that use functions from 'estack.h'. * *******************************************************************************/ short AMSFracToCInts(const char *VarName, long *Numerator, long *Denominator) {      HSym HSymVar;      SYM_ENTRY *pSymEntry;      ESI Tag;            HSymVar = SymFind(SYMSTR(VarName));      if (HSymVar.folder == H_NULL) return FALSE;      if ((pSymEntry = DerefSym(HSymVar)) == NULL) return FALSE;      Tag = HToESI(pSymEntry->handle);      if (*Tag != POSFRAC_TAG && *Tag != NEGFRAC_TAG) return FALSE;            if (*Tag == POSFRAC_TAG) {           *Numerator = GetIntArg(Tag);           Tag++;           *Denominator = GetIntArg(Tag);     return TRUE;      }      else {           *Numerator = -GetIntArg(Tag);           Tag++;           *Denominator = GetIntArg(Tag);           return TRUE;      } } short PrettyPrintAMSVar(const char *VarName, short x, short y) {      HSym HSymVar;      SYM_ENTRY *pSymEntry;      ESI Tag;            HSymVar = SymFind(SYMSTR(VarName));      if (HSymVar.folder == H_NULL) return FALSE;      if ((pSymEntry = DerefSym(HSymVar)) == NULL) return FALSE;      Tag = HToESI(pSymEntry->handle);   Print2DExpr(Parse2DExpr(Tag,FALSE),DeskTop,x,y);   return TRUE; } short PrettyPrintWithScrollingAMSVar(const char *VarName) {   // Returns -1 if an error occurs.   // Returns 0 if the key ESC has been pressed.   // Returns 1 if the key ENTER, or APPS has been pressed.   HSym HSymVar;   SYM_ENTRY *pSymEntry;   ESI Tag, ParsedExpr;   short bottom, top, width;   short PossibleMoves = 0, Return = -1;   short ActPosX, ActPosY, TmpPosX = 0, TmpPosY = 0;   WINDOW Window;   INT_HANDLER SaveInt1;   SaveInt1 = GetIntVec (AUTO_INT_1);   SetIntVec (AUTO_INT_1, DUMMY_HANDLER);   WinOpen (&Window,MakeWinRect (0,0,240,128),WF_SAVE_SCR | WF_NOBORDER);   WinActivate (&Window);   HSymVar = SymFind(SYMSTR(VarName));   if (HSymVar.folder == H_NULL) return -1;   if ((pSymEntry = DerefSym(HSymVar)) == NULL) return -1;   Tag = HToESI(pSymEntry->handle);   ParsedExpr = Parse2DExpr(Tag,FALSE);   Parms2D (ParsedExpr,&width,&bottom,&top);   if (width > LCD_WIDTH) PossibleMoves += 1;   if (bottom + top > LCD_HEIGHT) PossibleMoves += 2;   ActPosX = 1;   ActPosY = 1 + top;   while(TRUE) {     if(ActPosX != TmpPosX || ActPosY != TmpPosY) {          WinClr(&Window);       Print2DExpr(ParsedExpr,&Window,ActPosX,ActPosY);     }     TmpPosX = ActPosX;     TmpPosY = ActPosY;        if (_89_KEY_ESC) { Return = 0; break; }        if (_89_KEY_UP && PossibleMoves >= 2) ActPosY += 2;        if (_89_KEY_DOWN && PossibleMoves >= 2) ActPosY -= 2;        if (_89_KEY_LEFT && (PossibleMoves % 2) == 1) ActPosX += 2;        if (_89_KEY_RIGHT && (PossibleMoves % 2) == 1) ActPosX -= 2;        if (_89_KEY_UP && _89_KEY_2ND && PossibleMoves >= 2) ActPosY += 10;        if (_89_KEY_DOWN && _89_KEY_2ND && PossibleMoves >= 2) ActPosY -= 10;        if (_89_KEY_LEFT && _89_KEY_2ND && (PossibleMoves % 2) == 1) ActPosX += 10;        if (_89_KEY_RIGHT && _89_KEY_2ND && (PossibleMoves % 2) == 1) ActPosX -= 10;        if (_89_KEY_ENTER || _89_KEY_APPS) { Return = 1; break; }        if (ActPosY + bottom <= LCD_HEIGHT - 5) ActPosY = TmpPosY;        if (ActPosY - top >= 5) ActPosY = TmpPosY;     if (ActPosX >= 5) ActPosX = TmpPosX;     if (ActPosX + width <= LCD_WIDTH - 5) ActPosX = TmpPosX;   }   WinClose (&Window);   SetIntVec (AUTO_INT_1,SaveInt1);   ngetchx();   return Return; } short PrintAMSVar(const char *VarName, char *Dest) {      HSym HSymVar;      SYM_ENTRY *pSymEntry;      ESI Tag;      HANDLE Handle;            HSymVar = SymFind(SYMSTR(VarName));      if (HSymVar.folder == H_NULL) return FALSE;      if ((pSymEntry = DerefSym(HSymVar)) == NULL) return FALSE;      Tag = HToESI(pSymEntry->handle);   Handle = Parse1DExpr(Tag,FALSE,0);   if (Handle == H_NULL) return FALSE;   strcpy(Dest,(char *)HeapDeref(Handle));   HeapFree(Handle);   return TRUE; } unsigned char AMSCharToCChar(const char *VarName, unsigned short position) {      HSym HSymVar;      SYM_ENTRY *pSymEntry;      HANDLE Handle;            if(!position) return FALSE;      HSymVar = SymFind(SYMSTR(VarName));      if (HSymVar.folder == H_NULL) return FALSE;      if ((pSymEntry = DerefSym(HSymVar)) == NULL) return FALSE;      Handle = pSymEntry->handle;      if (!(*HToESI(Handle) == STR_TAG)) return FALSE;            return *((unsigned char *)HeapDeref(Handle) + 2 + position); } short AMSStrToCStr(char *Str, const char *VarName) {      HSym HSymVar;      SYM_ENTRY *pSymEntry;      unsigned char *pFile;      HANDLE Handle;      short index = 0;            HSymVar = SymFind(SYMSTR(VarName));      if (HSymVar.folder == H_NULL) return FALSE;      if ((pSymEntry = DerefSym(HSymVar)) == NULL) return FALSE;      Handle = pSymEntry->handle;      if (!(*HToESI(Handle) == STR_TAG)) return FALSE;      pFile = (unsigned char *)HeapDeref(Handle) + 3;      while(*pFile)     {           Str[index] = *pFile++;           index++;      }      Str[index] = 0;            return TRUE; } long AMSIntToCInt(const char *VarName) {      HSym HSymVar;      SYM_ENTRY *pSymEntry;      ESI Tag;            HSymVar = SymFind(SYMSTR(VarName));      if (HSymVar.folder == H_NULL) return FALSE;      if ((pSymEntry = DerefSym(HSymVar)) == NULL) return FALSE;      Tag = HToESI(pSymEntry->handle);      if (*Tag != POSINT_TAG && *Tag != NEGINT_TAG) return FALSE;            if (*Tag == POSINT_TAG) return GetIntArg(Tag);      else return -GetIntArg(Tag); } short CStrToAMSStr(const char *Str, const char *VarName) {      HANDLE Handle;      HSym HSymVar;      SYM_ENTRY *pSymEntry;      unsigned long StrLen = strlen(Str);      unsigned char *pFile;      unsigned short i;              if (!(Handle = HeapAlloc(StrLen + 5))) return FALSE;   HSymVar = SymAdd(SYMSTR(VarName));   if (HSymVar.folder == H_NULL) {     HeapFree(Handle);          return FALSE;   }      if ((pSymEntry = DerefSym(HSymVar)) == NULL) {     HeapFree(Handle);     return FALSE;   }      pSymEntry->handle = Handle;      pFile = (unsigned char *)HeapDeref(pSymEntry->handle);      if (StrLen + 3 <= 0xFF) {        *pFile++ = 0;        *pFile++ = StrLen + 3;   }   else {        *pFile++ = (StrLen + 3) / 0xFF;        *pFile++ = (StrLen + 3) % 0xFF - 1;   }      *pFile++ = 0;      for (i=0;i<StrLen;i++) {     *pFile++ = Str[i];   }      *pFile++ = 0;   *pFile++ = STR_TAG;        return TRUE;  }

16

Au fait, pourquoi ne pas utiliser VarStore?
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

17

SymAdd a ete documente avant que varStore ne le soit smile

18

Kevin Kofler a écrit :
Au fait, pourquoi ne pas utiliser VarStore?

Je trouve cette fonction trop compliquée sick.