📄 csource.pas
字号:
unit CSource;
// Free for any project that try to translate C to Pascal
// (c)2002 by Paul TOTH <tothpaul@free.fr>
interface
// clear any previous info
procedure NewContext;
procedure PushContext;
procedure PopContext;
// standard C structures
// #define
procedure Define(name,parms,value:string);
implementation
Type
TSymbol=class
Name:string;
end;
TContext=class
Index:integer;
publics :array of TSymbol;
Privates:array of TSymbol;
Symbols :array of TSymbol;
end;
Var
Context :TContext;
Contexts :array of TContext;
ContextStack:array of TContext;
procedure NewContext;
begin
Context:=TContext.Create;
Context.Index:=Length(Contexts);
SetLength(Contexts,Context.Index+1);
Contexts[Context.Index]:=Context;
end;
procedure PushContext;
var
stack:integer;
begin
stack:=Length(ContextStack);
SetLength(ContextStack,stack+1);
ContextStack[stack]:=Context;
end;
procedure PopContext;
var
stack:integer;
begin
stack:=Length(ContextStack)-1;
Context:=ContextStack[stack];
SetLength(ContextStack,stack);
end;
//--------------
Type
TKeyWord=class
end;
//--------------
Type
TDefine=class(TKeyWord)
fContext:TContext;
fName :string;
fParms:string;
fvalue:string;
Constructor Create(AName,AParms,AValue:string);
end;
Constructor TDefine.Create(AName,AParms,AValue:string);
begin
fContext:=Context;
fName :=AName;
fParms :=AParms;
fValue :=AValue;
// KeyWord.Add(Self);
end;
procedure Define(name,parms,value:string);
begin
TDefine.Create(name,parms,value);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -