translations plus small fixes
parent
ca254d70b6
commit
fd6147bea0
|
@ -13,18 +13,20 @@
|
||||||
// *
|
// *
|
||||||
// * You should have received a copy of the GNU General Public License
|
// * You should have received a copy of the GNU General Public License
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.///////////////////////////////////////////////////////////////////////
|
// * along with this program. If not, see http://www.gnu.org/licenses/.///////////////////////////////////////////////////////////////////////
|
||||||
// compilation des diverses instructions
|
// Compilation of various instructions
|
||||||
// toutes les routines Compile sont statiques
|
// Compile all routines are static
|
||||||
// et retournent un object selon ce qui a été trouvé comme instruction
|
// And return an object according to what was found as instruction
|
||||||
|
|
||||||
// principe de compilation:
|
// Compiler principle:
|
||||||
// les routines Compile retournent un objet de la classe correspondant à l'opération trouvée
|
// compile the routines return an object of the class corresponding to the operation found
|
||||||
// il s'agit toujours d'une classe fille de CBotInstr.
|
// This is always a subclass of CBotInstr.
|
||||||
// ( les objets CBotInstr ne sont jamais utilisés directement )
|
// (CBotInstr objects are never used directly)
|
||||||
|
|
||||||
|
|
||||||
|
// Compiles if the routine returns NULL is that the statement is false
|
||||||
|
// Or misunderstood.
|
||||||
|
// The error is then on the stack CBotCStack :: Isok () is FALSE
|
||||||
|
|
||||||
// si la routine Compile retourne NULL, c'est que l'instruction est fausse
|
|
||||||
// ou incomprise.
|
|
||||||
// L'erreur se trouve alors sur la pile CBotCStack::IsOk() est FALSE
|
|
||||||
|
|
||||||
|
|
||||||
#include "CBot.h"
|
#include "CBot.h"
|
||||||
|
|
|
@ -1346,9 +1346,7 @@ public:
|
||||||
|
|
||||||
void SetIdent(long n);
|
void SetIdent(long n);
|
||||||
|
|
||||||
static
|
static CBotVarClass* Find(long id);
|
||||||
CBotVarClass*
|
|
||||||
CBotVarClass::Find(long id);
|
|
||||||
|
|
||||||
|
|
||||||
// CBotVar* GivMyThis();
|
// CBotVar* GivMyThis();
|
||||||
|
@ -1599,8 +1597,8 @@ private:
|
||||||
CBotToken m_openblk;
|
CBotToken m_openblk;
|
||||||
CBotToken m_closeblk;
|
CBotToken m_closeblk;
|
||||||
public:
|
public:
|
||||||
CBotFunction::CBotFunction();
|
CBotFunction();
|
||||||
CBotFunction::~CBotFunction();
|
~CBotFunction();
|
||||||
static
|
static
|
||||||
CBotFunction* Compile(CBotToken* &p, CBotCStack* pStack, CBotFunction* pFunc, BOOL bLocal = TRUE);
|
CBotFunction* Compile(CBotToken* &p, CBotCStack* pStack, CBotFunction* pFunc, BOOL bLocal = TRUE);
|
||||||
static
|
static
|
||||||
|
|
|
@ -1,39 +1,41 @@
|
||||||
pour la gestion des instances d'une classe.
|
|
||||||
|
|
||||||
l'objet créé actuellement avec CBotVar::Create(nom, pClasse)
|
for managing instances of a class.
|
||||||
est a conserver tel quel, en dehors des vars sur la pile
|
|
||||||
|
|
||||||
il faut un autre type de variable pour garder les pointeurs
|
the object being created with CBotVar :: Create (name, pClasse)
|
||||||
CBotTypPtClass par exemple
|
is to keep as is, outside the vars on the stack
|
||||||
|
|
||||||
L'instance de la classe doit avoir un compteur d'utilisation
|
we need another type of variable to keep the pointers
|
||||||
qui est le nombre d'objet de classe CBotTypPtClass qui y réfèrent.
|
For example CBotTypPtClass
|
||||||
Le compteur est décrémenté lorsque le pointeur est détruit,
|
|
||||||
l'objet supprimé lorsqu'il n'y a plus de pointeurs.
|
The instance of the class must have a usage count
|
||||||
|
which is the number of class object to which they refer CBotTypPtClass.
|
||||||
|
The counter is decremented when the pointer is destroyed,
|
||||||
|
be deleted when there is more pointers.
|
||||||
|
|
||||||
|
|
||||||
Dans le cas des robots, Daniel crée une instance de sa classe "Object"
|
In the case of robots, Daniel creates an instance of class "Object"
|
||||||
et peut retourner des pointeurs à cette instance par des routines genre FindRobot()
|
and can return pointers to this proceeding by routines such FindRobot ()
|
||||||
|
|
||||||
Object FindRobot(int n) { }
|
Object FindRobot (int n) {}
|
||||||
|
|
||||||
pResult dans ce cas est un pointeur CBotTypPtClass
|
pResult in this case is a pointer CBotTypPtClass
|
||||||
lorsqu'il a trouvé le robot concerné, il lui faudra faire
|
when he found the robot concerned, it must make
|
||||||
|
|
||||||
pResult->SetPointeur(InstanceDeLaClassObject);
|
pResult-> SetPointeur (InstanceDeLaClassObject);
|
||||||
|
|
||||||
cette opération incrémente le compteur des références
|
this operation increments the reference
|
||||||
|
|
||||||
--
|
-
|
||||||
|
|
||||||
lorsque le robot est détruit, l'instance de la classe Object correspondant
|
when the robot is destroyed, the instance of the Object class corresponding
|
||||||
est détruit également.
|
is also destroyed.
|
||||||
s'il reste des pointeurs à cet objet, et l'on risque la planté
|
if there are pointers to that object, and we planted the risk
|
||||||
|
|
||||||
solution 1:
|
Solution 1:
|
||||||
garder non pas le pointeur à l'objet directement, mais
|
not keep the pointer to the object directly, but
|
||||||
un index dans une tables de pointeurs
|
an index into a table of pointers
|
||||||
|
|
||||||
|
Solution 2:
|
||||||
|
not destroy the object when there imédiatement pointers
|
||||||
|
but marked as virtually destroyed
|
||||||
|
|
||||||
solution 2:
|
|
||||||
ne pas détruire l'objet imédiatement lorsqu'il reste des pointeurs
|
|
||||||
mais le marqué comme virtuellement détruit
|
|
Loading…
Reference in New Issue