paxscripter.pas

来自「Delphi脚本控件」· PAS 代码 · 共 1,898 行 · 第 1/5 页

PAS
1,898 行
字号
  Optimization := true;
end;

destructor TPaxScripter.Destroy;
begin
  UnregisterLanguages;

  fScripter.Free;
  fCallStack.Free;
  fSearchPathes.Free;

  inherited;
end;

function TPaxScripter.FindTempObject(const Key: TVarRec): TObject;
begin
  result := fScripter.TempObjectList.FindObject(Key);
end;

function TPaxScripter.AddTempObject(const Key: TVarRec; Obj: TObject): Integer;
begin
  result := fScripter.TempObjectList.Add(Key, Obj);
end;

procedure TPaxScripter.SetSearchPathes(const Value: TStrings);
begin
  fSearchPathes.Assign(Value);
end;

function TPaxScripter.GetCurrentProcID: Integer;
begin
  result := fScripter.Code.LevelStack.Top;
end;

function TPaxScripter.IsConstructor(ID: Integer): Boolean;
begin
   result := fScripter.SymbolTable.TypeSub[ID] = tsConstructor;
end;

function TPaxScripter.IsDestructor(ID: Integer): Boolean;
begin
  result := fScripter.SymbolTable.TypeSub[ID] = tsDestructor;
end;

function TPaxScripter.IsVarParameter(ID: Integer): Boolean;
begin
  result := fScripter.SymbolTable.ByRef[ID] = 1;
end;

function TPaxScripter.IsConstParameter(ID: Integer): Boolean;
begin
  result := fScripter.SymbolTable.ByRef[ID] = 2;
end;

function TPaxScripter.IsStatic(ID: Integer): Boolean;
var
  K: TPaxMemberKind;
  ClassRec: TPaxClassRec;
  I, L: Integer;
  MemberRec: TPaxMemberRec;
  D: TPaxMethodDefinition;
begin
  result := true;
  K := GetKind(ID);
  case K of
    mkClass:
    begin
      ClassRec := fScripter.ClassList.FindClass(ID);
      if ClassRec <> nil then
        result := ClassRec.IsStatic;
    end;
    mkMethod:
    if ID > 0 then
    begin
      L := fScripter.SymbolTable.Level[ID];
      if fScripter.SymbolTable.Kind[ID] = KindType then
      begin
        ClassRec := fScripter.ClassList.FindClass(L);
        if ClassRec <> nil then
        begin
          result := ClassRec.IsStatic;
          if result then
            Exit;

          for I:=0 to ClassRec.MemberList.Count - 1 do
          begin
            MemberRec := ClassRec.MemberList[I];
            if MemberRec.ID = ID then
            begin
              result := MemberRec.IsStatic;
              Exit;
            end;
          end;
        end;
      end
      else // nested function
        result := false;
    end
    else if ID < 0 then
    begin
      D := DefinitionList[-ID];
      result := D.IsStatic;
    end;
  end
end;

procedure TPaxScripter.SetStackSize(Value: Integer);
begin
  fScripter.fStackSize := Value;
end;

function TPaxScripter.GetStackSize: Integer;
begin
  result := fScripter.fStackSize;
end;

procedure TPaxScripter.SetOptimization(Value: Boolean);
begin
  fScripter.Code.SignFOP := Value;
end;

function TPaxScripter.GetOptimization: Boolean;
begin
  result := fScripter.Code.SignFOP;
end;

function TPaxScripter.GetTotalLineCount: Integer;
begin
  result := fScripter.TotalLineCount;
end;

function TPaxScripter.GetOnPrint: TPaxScripterPrintEvent;
begin
  result := TPaxScripterPrintEvent(fScripter.OnPrint);
end;

procedure TPaxScripter.SetOnPrint(Value: TPaxScripterPrintEvent);
begin
  fScripter.OnPrint := TPrintEvent(Value);
end;

function TPaxScripter.GetOnDefine: TPaxScripterDefineEvent;
begin
  result := TPaxScripterDefineEvent(fScripter.OnDefine);
end;

procedure TPaxScripter.SetOnDefine(Value: TPaxScripterDefineEvent);
begin
  fScripter.OnDefine := TOnDefineEvent(Value);
end;

function TPaxScripter.GetOnChangedVariable: TPaxScripterVarEvent;
begin
  result := TPaxScripterVarEvent(fScripter.OnChangedVariable);
end;

procedure TPaxScripter.SetOnChangedVariable(Value: TPaxScripterVarEvent);
begin
  fScripter.OnChangedVariable := TVarEvent(Value);
end;

{$IFDEF UNDECLARED_EX}
procedure TPaxScripter.SetOnUndeclaredIdentifier(Value: TPaxScripterVarEventEx);
begin
  fScripter.OnUndeclaredIdentifier := TVarEventEx(Value);
end;

function TPaxScripter.GetOnUndeclaredIdentifier: TPaxScripterVarEventEx;
begin
  result := TPaxScripterVarEventEx(fScripter.OnUndeclaredIdentifier);
end;

{$ELSE}

function TPaxScripter.GetOnUndeclaredIdentifier: TPaxScripterVarEvent;
begin
  result := TPaxScripterVarEvent(fScripter.OnUndeclaredIdentifier);
end;

procedure TPaxScripter.SetOnUndeclaredIdentifier(Value: TPaxScripterVarEvent);
begin
  fScripter.OnUndeclaredIdentifier := TVarEvent(Value);
end;
{$ENDIF}

function TPaxScripter.GetOnHalt: TPaxScripterEvent;
begin
  result := TPaxScripterEvent(fScripter.OnHalt);
end;

procedure TPaxScripter.SetOnHalt(Value: TPaxScripterEvent);
begin
  fScripter.OnHalt := TScripterEvent(Value);
end;

function TPaxScripter.GetOnLoadDll: TPaxLoadDllEvent;
begin
  result := TPaxLoadDllEvent(fScripter.OnLoadDll);
end;

procedure TPaxScripter.SetOnLoadDll(Value: TPaxLoadDllEvent);
begin
  fScripter.OnLoadDll := TLoadDllEvent(Value);
end;

function TPaxScripter.GetOnVirtualObjectMethodCallEvent: TPaxVirtualObjectMethodCallEvent;
begin
  result := TPaxVirtualObjectMethodCallEvent(fScripter.OnVirtualObjectMethodCall);
end;

procedure TPaxScripter.SetOnVirtualObjectMethodCallEvent(Value: TPaxVirtualObjectMethodCallEvent);
begin
  fScripter.OnVirtualObjectMethodCall := TVirtualObjectMethodCallEvent(Value);
end;

function TPaxScripter.GetOnVirtualObjectPutPropertyEvent: TPaxVirtualObjectPutPropertyEvent;
begin
  result := TPaxVirtualObjectPutPropertyEvent(fScripter.OnVirtualObjectPutProperty);
end;

procedure TPaxScripter.SetOnVirtualObjectPutPropertyEvent(Value: TPaxVirtualObjectPutPropertyEvent);
begin
  fScripter.OnVirtualObjectPutProperty := TVirtualObjectPutPropertyEvent(Value);
end;


function TPaxScripter.GetOnReadExtraData: TPaxScripterStreamEvent;
begin
  result := TPaxScripterStreamEvent(fScripter.OnReadExtraData);
end;

procedure TPaxScripter.SetOnReadExtraData(Value: TPaxScripterStreamEvent);
begin
  fScripter.OnReadExtraData := TStreamEvent(Value);
end;

function TPaxScripter.GetOnWriteExtraData: TPaxScripterStreamEvent;
begin
  result := TPaxScripterStreamEvent(fScripter.OnWriteExtraData);
end;

procedure TPaxScripter.SetOnWriteExtraData(Value: TPaxScripterStreamEvent);
begin
  fScripter.OnWriteExtraData := TStreamEvent(Value);
end;

function TPaxScripter.GetOnShowError: TPaxScripterEvent;
begin
  result := TPaxScripterEvent(fScripter.OnShowError);
end;

procedure TPaxScripter.SetOnShowError(Value: TPaxScripterEvent);
begin
  fScripter.OnShowError := TScripterEvent(Value);
end;

function TPaxScripter.GetOnRunning: TPaxCodeEvent;
begin
  result := TPaxCodeEvent(fScripter.OnRunning);
end;

procedure TPaxScripter.SetOnRunning(Value: TPaxCodeEvent);
begin
  fScripter.OnRunning := TCodeEvent(Value);
end;

{$IFDEF ONRUNNING}

// See BASE_SCRIPTER.pas for details.

function TPaxScripter.GetOnRunningUpdate: TPaxScripterEvent;
begin
  result := TPaxScripterEvent(fScripter.OnRunningUpdate);
end;

procedure TPaxScripter.SetOnRunningUpdate(Value: TPaxScripterEvent);
begin
  fScripter.OnRunningUpdate := TScripterEvent(Value);
end;

function TPaxScripter.GetOnRunningUpdateActive: Boolean;
begin
  result := fScripter.OnRunningUpdateActive;
end;

procedure TPaxScripter.SetOnRunningUpdateActive(Value: Boolean);
begin
  fScripter.OnRunningUpdateActive := Value;
end;

function TPaxScripter.GetOnRunningSync: TPaxScripterEvent;
begin
  result := TPaxScripterEvent(fScripter.OnRunningSync);
end;

procedure TPaxScripter.SetOnRunningSync(Value: TPaxScripterEvent);
begin
  fScripter.OnRunningSync := TScripterEvent(Value);
end;

{$ENDIF}

function TPaxScripter.GetOnUsedModule: TPaxUsedModuleEvent;
begin
  result := TPaxUsedModuleEvent(fScripter.OnUsedModule);
end;

procedure TPaxScripter.SetOnUsedModule(Value: TPaxUsedModuleEvent);
begin
  fScripter.OnUsedModule := TUsedModuleEvent(Value);
end;

function TPaxScripter.GetOnInclude: TPaxIncludeEvent;
begin
  result := TPaxIncludeEvent(fScripter.OnInclude);
end;

procedure TPaxScripter.SetOnInclude(Value: TPaxIncludeEvent);
begin
  fScripter.OnInclude := TIncludeEvent(Value);
end;

function TPaxScripter.GetOnLoadSourceCode: TPaxLoadSourceCodeEvent;
begin
  result := TPaxLoadSourceCodeEvent(fScripter.OnLoadSourceCode);
end;

procedure TPaxScripter.SetOnLoadSourceCode(Value: TPaxLoadSourceCodeEvent);
begin
  fScripter.OnLoadSourceCode := TLoadSourceCodeEvent(Value);
end;

function TPaxScripter.GetOnChangeState: TPaxScripterChangeStateEvent;
begin
  result := TPaxScripterChangeStateEvent(fScripter.OnChangeState);
end;

procedure TPaxScripter.SetOnChangeState(Value: TPaxScripterChangeStateEvent);
begin
  fScripter.OnChangeState := TOnChangeStateEvent(Value);
end;

function TPaxScripter.GetOnDelphiInstanceCreate: TPaxScripterInstanceEvent;
begin
  result := TPaxScripterInstanceEvent(fScripter.OnDelphiInstanceCreate);
end;

procedure TPaxScripter.SetOnDelphiInstanceCreate(Value: TPaxScripterInstanceEvent);
begin
  fScripter.OnDelphiInstanceCreate := TOnInstanceEvent(Value);
end;

function TPaxScripter.GetOnDelphiInstanceDestroy: TPaxScripterInstanceEvent;
begin
  result := TPaxScripterInstanceEvent(fScripter.OnDelphiInstanceDestroy);
end;

procedure TPaxScripter.SetOnDelphiInstanceDestroy(Value: TPaxScripterInstanceEvent);
begin
  fScripter.OnDelphiInstanceDestroy := TOnInstanceEvent(Value);
end;

function TPaxScripter.GetOnCompilerProgress: TPaxCompilerProgressEvent;
begin
  result := TPaxCompilerProgressEvent(fScripter.OnCompilerProgress);
end;

procedure TPaxScripter.SetOnCompilerProgress(Value: TPaxCompilerProgressEvent);
begin
  fScripter.OnCompilerProgress := TCompilerProgressEvent(Value);
end;

function TPaxScripter.GetModules: TStringList;
begin
  result := fScripter.Modules;
end;

function TPaxScrip

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?