Browse Source

* PChar -> PAnsichar

Michaël Van Canneyt 2 years ago
parent
commit
a6f41f9f1c

+ 2 - 2
packages/symbolic/examples/rpnthing.pas

@@ -26,7 +26,7 @@ program RPNThing;
 
 Uses Symbolic,Crt;
 
-function GetKey:char;
+function GetKey:AnsiChar;
 
 begin
  repeat
@@ -43,7 +43,7 @@ end;
 
 VAR Stack    : array[0..100] of TExpression;
     I,StackPtr : Integer;
-    InputC   : Char;
+    InputC   : AnsiChar;
     S        : String;
     Flag     : Boolean;
 

+ 11 - 11
packages/symbolic/src/parsexpr.inc

@@ -123,9 +123,9 @@ Const
 Type
   String15 = String[15];
 
-Procedure ParserInternalError(const Msg:String;A,B:ArbInt);
+Procedure ParserInternalError(const Msg:ShortString;A,B:ArbInt);
 
-VAR S,S2 : String;
+VAR S,S2 : ShortString;
 
 begin
  Str(A,S);      {Usually a identification number for the occurance}
@@ -133,7 +133,7 @@ begin
  Raise EParserIE.Create(SParsIE+Msg+S+' '+S2);
 end;
 
-function TBaseExprParser.InFixToParseTree(Expr : String;VAR RPNexpr: String):pnode;
+function TBaseExprParser.InFixToParseTree(Expr : ShortString;VAR RPNexpr: ShortString):pnode;
 
 Var
   RPNStack   : Array[1..RPNMax] of PNode;        { Stack For RPN calculator }
@@ -256,7 +256,7 @@ parctan2 : begin
    end;
 end;
 
-Function IsFunction(S:String):ParseOperation;
+Function IsFunction(S:ShortString):ParseOperation;
 
 var Count:ParseOperation;
 
@@ -395,9 +395,9 @@ begin
  InFixToParseTree:=RpnPop;
 end;
 
-function TBaseExprParser.ParseTreeToInfix(expr:pnode):string;
+function TBaseExprParser.ParseTreeToInfix(expr:pnode):ShortString;
 
-var S,right,left : string;
+var S,right,left : ShortString;
     IsSimpleExpr : boolean;
 
 begin
@@ -444,13 +444,13 @@ begin
   ParseTreeToInfix:=S;
 end;
 
-function TBaseExprParser.ParseTreeToRPN(expr:pnode):string;
+function TBaseExprParser.ParseTreeToRPN(expr:pnode):ShortString;
 {not fast because of the prepending. Creating an array of pnode would maybe
 be faster}
 
-procedure SearchTree(Tree:pnode;var s:string);
+procedure SearchTree(Tree:pnode;var s:ShortString);
 
-var temp:string;
+var temp:ShortString;
 
 begin
  if tree<>nil then
@@ -481,7 +481,7 @@ begin
     end;
 end;
 
-var s : String;
+var s : ShortString;
 
 begin
  s:='';
@@ -494,4 +494,4 @@ end;
   Revision 1.1  2002/12/15 21:01:24  marco
   Initial revision
 
-}
+}

+ 19 - 19
packages/symbolic/src/symbolic.pas

@@ -87,7 +87,7 @@ TYPE
                          function CopyTree(p :pnode):pnode;
                          function NewFunc(fun:funcop;son:pnode):pnode; overload;
                          function NewFunc(fun:funcop;son,son2:pnode):pnode; overload;
-                         function NewVar(variable:string):pnode;
+                         function NewVar(variable:shortShortString):pnode;
                          procedure DisposeExpr(p:pnode);
                          end;
 
@@ -96,9 +96,9 @@ TYPE
 
     TBaseExprParser= class(TBaseExpression)
                     public
-                     function InFixToParseTree(Expr : String;VAR RPNexpr: String):pnode; virtual;
-                     function ParseTreeToRPN  (expr:pnode):string; virtual;
-                     function ParseTreeToInfix(expr:pnode):string; virtual;
+                     function InFixToParseTree(Expr : ShortString;VAR RPNexpr: ShortString):pnode; virtual;
+                     function ParseTreeToRPN  (expr:pnode):ShortString; virtual;
+                     function ParseTreeToInfix(expr:pnode):ShortString; virtual;
                     end;
 
     TEvaluator= CLASS;
@@ -111,14 +111,14 @@ TYPE
     TExpression = class(TBaseExprParser)
                     protected
                      InfixClean     : Boolean;
-                     InfixCache     : String;
+                     InfixCache     : ShortString;
                      Evaluator      : TEvaluator;
                      EvaluatorUpToDate : Boolean;
-                     function    GetInfix:String;
-                     function    GetRPN:String;
+                     function    GetInfix:ShortString;
+                     function    GetRPN:ShortString;
                      procedure Simpleop(expr:TExpression;oper:calcop);
                      function  Simpleopwithresult(expr:TExpression;oper:calcop):TExpression;
-                     Function  IntDerive(const derivvariable:String;theexpr:pnode):pnode;
+                     Function  IntDerive(const derivvariable:ShortString;theexpr:pnode):pnode;
                      Function  GetIntValue:LongInt;
                      Procedure SetIntValue(val:Longint);
                      Function  GetFloatValue:ArbFloat;
@@ -126,16 +126,16 @@ TYPE
                      Procedure UpdateConstants; {Kind of integrity check}
                     public
                      SimplificationLevel : Longint;
-                     CONSTRUCTOR Create(Infix:String);
+                     CONSTRUCTOR Create(Infix:ShortString);
                      CONSTRUCTOR EmptyCreate;
                      DESTRUCTOR Destroy; override;
 
-                     Procedure   SetNewInfix(Infix:String);
-                     Function    Derive(derivvariable:String):TExpression;
-                     procedure   SymbolSubst(ToSubst,SubstWith:String);
+                     Procedure   SetNewInfix(Infix:ShortString);
+                     Function    Derive(derivvariable:ShortString):TExpression;
+                     procedure   SymbolSubst(ToSubst,SubstWith:ShortString);
                      function    SymbolicValueNames:TStringList;
-                     function    Taylor(Degree:ArbInt;const x,x0:String):TExpression;
-                     function    Newton(x:String):TExpression;
+                     function    Taylor(Degree:ArbInt;const x,x0:ShortString):TExpression;
+                     function    Newton(x:ShortString):TExpression;
 
                      procedure   SimplifyConstants;
 
@@ -150,8 +150,8 @@ TYPE
                      procedure RaiseTo(Expr:TExpression);
                      procedure SubFrom(Expr:TExpression);
                      procedure Times(Expr:texpression);
-                     property  InfixExpr: string read GetInfix write SetNewInfix;
-                     property  RpnExpr: string read GetRPN;
+                     property  InfixExpr: ShortString read GetInfix write SetNewInfix;
+                     property  RpnExpr: ShortString read GetRPN;
                      property  ValueAsInteger:longint read GetIntValue write SetIntvalue; {Default?}
                      property  ValueAsFloat:arbfloat   read GetFloatValue write SetFloatValue;
                     end;
@@ -199,7 +199,7 @@ TYPE
                        VLIWRPNExpr      : pVLIWArr;
                       public
                        function    Evaldepth:longint;
-                       PROCEDURE   SetConstant(Name:String;Value:ArbFloat);
+                       PROCEDURE   SetConstant(Name:ShortString;Value:ArbFloat);
                        CONSTRUCTOR Create(VariableList:TStringList;Expression:pnode);
                        CONSTRUCTOR Create(VariableList:TStringList;Expression:TExpression);
                        DESTRUCTOR  Destroy; override;
@@ -226,7 +226,7 @@ TYPE
                  Terms: Array[0..499] of PtermNode;
                 end;
 }
-const InfixOperatorName   : array[addo..powo] of char= ('+','-','*','/','^');
+const InfixOperatorName   : array[addo..powo] of AnsiChar= ('+','-','*','/','^');
       FunctionNames    : array[cosx..lognx] of string[8]=(
              'cos','sin','tan','sqr','sqrt','exp','ln','inv','-',
              'cotan','arcsin','arccos','arctan','sinh',
@@ -469,7 +469,7 @@ end;}
 
 
 
-function TBaseExpression.NewVar(variable:string):pnode;
+function TBaseExpression.NewVar(variable:ShortString):pnode;
 
 var p :pnode;
 

+ 3 - 3
packages/symbolic/src/teval.inc

@@ -23,7 +23,7 @@ procedure TEvaluator.WriteVliw(p:VLIWEvalWord); forward;
 
 Procedure TEvalInternalError(A,B:ArbInt);
 
-VAR S,S2 : String;
+VAR S,S2 : ShortShortString;
 
 begin
  Str(ORD(A),S);
@@ -86,7 +86,7 @@ begin
  inherited Destroy;
 end;
 
-PROCEDURE   TEvaluator.SetConstant(Name:String;Value:ArbFloat);
+PROCEDURE   TEvaluator.SetConstant(Name:ShortShortString;Value:ArbFloat);
 
 Var Ind,I    : Longint;
     TmpList  : TList;
@@ -718,4 +718,4 @@ end;
   Revision 1.1  2002/12/15 21:01:28  marco
   Initial revision
 
-}
+}