Création/déclaration de variable pendant l'exécution d'un programme
cs_TouTSpeed
Messages postés72Date d'inscriptionjeudi 5 janvier 2006StatutMembreDernière intervention30 août 2007
-
30 août 2007 à 14:09
Caribensila
Messages postés2527Date d'inscriptionjeudi 15 janvier 2004StatutMembreDernière intervention16 octobre 2019
-
31 août 2007 à 02:23
Bonjour
Je recherche des informations si cela est possible , existe sur la création de variables dans un programme en cours d'exécution .
Par exemple j'ai un programme qui lit une chaine de caractère et je souhaiterais, qu'il créé la variable correspondant a cette chaine,pendant son exécution.
function TRTStrings.AddString(const ID, STR: string): integer;
var LID : string;
begin
Result := -1;
if ID = EmptyStr then
begin
Error(saAdd, RTSTRERR_IDNOTDEFINED);
end
else
begin
LID := LowerCase(ID);
Result := fIdList.IndexOf(LID);
if Result = -1 then
begin
Result := fIdList.Add(LID);
fStList.Add(Str);
fLastAction := saAdd;
end
else
Error(saAdd,RTSTRERR_IDALLREADYEXISTS);
end;
end;
procedure TRTStrings.BeginUpdate;
begin
fStList.BeginUpdate;
fIdList.BeginUpdate;
end;
function TRTStrings.Capacity: cardinal;
begin
result := Length(fIdList.Text) + Length(fStList.Text);
end;
function TRTStrings.DeleteString(const ID: string) : boolean;
var Ix : integer;
begin
if ID = EmptyStr then
begin
Error(saDelete, RTSTRERR_IDNOTDEFINED);
end
else
begin
Ix := fIdList.IndexOf(LowerCase(ID));
Result := Ix <> -1;
if Result then
begin
fIdList.Delete(Ix);
fStList.Delete(Ix);
fLastAction := saDelete;
end
else
Error(saDelete,RTSTRERR_IDNOTFOUND);
end;
end;
destructor TRTStrings.Destroy;
begin
fStList.Free;
fIdList.Free;
inherited;
end;
procedure TRTStrings.DoListChange(Sender: TObject);
begin
if Assigned(fOnChange) then
fOnchange(Self);
end;
procedure TRTStrings.EndUpdate;
begin
fIdList.EndUpdate;
fStList.EndUpdate;
end;
procedure TRTStrings.Error(const Action: TRTStringsAction;
const ErrorCode: integer);
begin
fLastAction := saUnknow;
if Assigned(fOnError) then
fOnError(Self, Action, ErrorCode);
end;
function TRTStrings.GetString(const ID: string): string;
var Ix : integer;
begin
if ID = EmptyStr then
begin
Error(saGet, RTSTRERR_IDNOTDEFINED);
end
else
begin
Ix := fIdList.IndexOf(LowerCase(ID));
if Ix <> -1 then
begin
result := fStList[Ix];
fLastAction := saGet;
end
else
Error(saGet,RTSTRERR_IDNOTFOUND);
end;
end;
function TRTStrings.IdExists(const ID: string): boolean;
begin
result := fIdList.IndexOf(LowerCase(ID)) <> -1;
end;
function TRTStrings.ModifyString(const ID, STR: string): boolean;
var Ix : integer;
begin
if ID = EmptyStr then
begin
Error(saModify, RTSTRERR_IDNOTDEFINED);
end
else
begin
Ix := fIdList.IndexOf(LowerCase(ID));
result := Ix <> -1;
if result then
begin
fStList[Ix] := STR;
fLastAction := saModify;
end
else
Error(saModify,RTSTRERR_IDNOTFOUND);
end;
end;
Caribensila
Messages postés2527Date d'inscriptionjeudi 15 janvier 2004StatutMembreDernière intervention16 octobre 201918 31 août 2007 à 02:23
@ Francky
Ta DLL à musique que tout le Monde Entier attend?
J'arrête pas de pisser dans un bidule, et y'a pas de DLL à musique qui sort. Bordel!
- soit j'dois avoir de l'albumine ou un truc du genre.
- soit c'est pas un violon.
Bref, on attend les analyses d'urine avant de faire l'autopsie du bidule...