stugeolLe 27/03/2008 à 22:03
Bon avec TIGCC 0.96 Beta 8, je compile mon programme et toujour le même problème "invalide program reférence" , avec ou sans DoorOs, quand je fais re2pol(1,2,3) +{1,2}, ou re2pol(1,2,3) ->a cela viens peut être de ma source?
// transformation coordonnées rectangulaire en poliare
// Try this program donner les coordonnées(x,y)
#define USE_TI89
#define USE_TI92PLUS
#define USE_V200
#define MIN_AMS 101
#include <tigcclib.h>
void _main(void)
{
float pi,r,g,tang,a[3];
int i;
ESI argptr;
InitArgPtr (argptr);
pi=3.1415926535897932;
//Contrôle que les 2 arguments soient des entiers ou des rééls
for(i=0 ; i<3 ; i++)
{
if (GetArgType (argptr) == FLOAT_TAG) a[i] = GetFloatArg (argptr);
else if (GetArgType (argptr) == POSINT_TAG || GetArgType (argptr) == NEGINT_TAG)
{
if (GetArgType (argptr) == POSINT_TAG) a[i]= GetIntArg (argptr);
else a[i] = -(GetIntArg (argptr));
}
else
{
ST_helpMsg("Wrong arg type!");
while (GetArgType(top_estack)!=END_TAG)
top_estack=next_expression_index(top_estack);
top_estack--;
return;
}
}
//efface les arguments en trop
while (GetArgType(top_estack)!=END_TAG)
top_estack=next_expression_index(top_estack);
top_estack--;
//initialise selon le mode angulaire;
if (a[2]==0) tang=180;
else if (a[2]>0) tang=200;
else tang=pi;
//calcule r et g
if ((a[0]==0) || (a[1]==0)) // x=0 ou y=0
{
if ((a[0]==0) && (a[1]==0)) //x et y sont nuls
{
r=0;
g=0;
}
else if ((a[0]==0) && (a[1]!=0)) // x=0
{if (a[1]>0) g=0; //y>0
else g=tang;} // y<0
else if ((a[1]==0) && (a[0]!=0)) // y=0
{if (a[0]>0) g=tang/2; //x>0
else g=3*tang/2;} // x<0
}
else// x et y sont différents de 0
{
if (abs(a[0])<=abs(a[1]))
{
g=atan(a[0]/a[1])*tang/pi;
if (a[1]>0) g=(g<0)*2*tang+g;
else g=tang+g;
}
else
{
g=atan(a[1]/a[0])*tang/pi;;
if (a[0]>0) g=pi/2-g;
else g=3*pi/2-g;
}
}
a[0]=sqrt(a[0]*a[0]+a[1]*a[1]);
a[1]=g;
//retourne la liste de r et g
push_quantum(END_TAG);
push_Float (a[1]);
push_Float (a[0]);
push_quantum(LIST_TAG);
}