System Procedures Insert and Delete
These functions process system procedures Insert
and Delete
. The first function processes system procedure Insert
.
Function Proc_Insert: Word; Far;
Var SubString, StringVariable, Position: TExpression;
begin
ExpectTokenAndGetNext (Token_LeftParenthesis);
SubString.ExpectAndStoreStringAndPushPointer;
ExpectTokenAndGetNext (Token_Comma);
StringVariable.ExpectStringVariable;
StringVariable.PushArrayPointerAndHighestIndex;
ExpectTokenAndGetNext (Token_Comma);
With Position do
begin
ExpectIntegerExpression;
CheckOrdinalRange (Ptr (SystemUnitSegment, Integer_TypeOffset));
PushExpression;
end;
ExpectTokenAndGetNext (Token_RightParenthesis);
StoreCode_icGoSub (SubString.IntermediateCodeOffset);
StoreCode_icGoSub (StringVariable.IntermediateCodeOffset);
StoreCode_icGoSub (Position.IntermediateCodeOffset);
GenerateInstruction_CALL_FAR (SysProc_SInsert);
Proc_Insert := EndSubroutine;
end;
This function processes system procedure Delete
.
Function Proc_Delete: Word; Far;
Var StringVariable, Index, Count: TExpression;
begin
ExpectTokenAndGetNext (Token_LeftParenthesis);
StringVariable.ExpectStringVariable;
ExpectTokenAndGetNext (Token_Comma);
With Index do
begin
ExpectIntegerExpression;
CheckOrdinalRange (Ptr (SystemUnitSegment, Integer_TypeOffset));
PushExpression;
end;
ExpectTokenAndGetNext (Token_Comma);
With Count do
begin
ExpectIntegerExpression;
CheckOrdinalRange (Ptr (SystemUnitSegment, Integer_TypeOffset));
PushExpression;
end;
ExpectTokenAndGetNext (Token_RightParenthesis);
StoreCode_icGoSub (StringVariable.IntermediateCodeOffset);
StoreCode_icGoSub (Index.IntermediateCodeOffset);
StoreCode_icGoSub (Count.IntermediateCodeOffset);
GenerateInstruction_CALL_FAR (SysProc_SDelete);
Proc_Delete := EndSubroutine;
end;