[fpc-pascal] Can someone help me to debug and correct this code?

Daniël Mantione daniel.mantione at freepascal.org
Sun Jan 14 23:26:33 CET 2007



Op Sun, 14 Jan 2007, schreef Goksie:

> dear all,

Sorry, but this code is an unreadable mess and I have no idea what this 
stuff isw supposed to do. I see some things that are illegal such as 
starting an identifier with a number, which you might  want to fix first. 
Can you please format and indent your code in a more readable form, so we 
can at least read it?

Daniël

> const maxliststore=30;
> strmaxlen=20;
> type objecttype=string[strmaxlen];
> list=record
> object:array[1..maxliststore]of objecttype;
> last:integer;
> End;
> var choice:char;
> position,number:integer;
> str:Objecttype;
> 1st:List;
> procedure copyobject(var obj1,obj2:Objecttype);
> begin obj1:=obj2;
> end;
> procedure displayobj(obj:Objjecttype);
> begin
> write('',obj,'');
> end;
> procedure initialise(var 1st:list);
> begin 1st.Last:=0
> end;
> 
> function insert(ob:Objjecttype;position:integer;var 1st:List):integer;
> vari:integer;
> begin
> insert:=0;
> if not((position<1)or(position>1st.Last+1)
>                     or(position>maxliststore))then
> begin
> for i:=1st.last downto position do
>                copyobject(1st.object[i+1],1st.object[i]);
> copyobject(1st.object[position],obj);
> 1st.last:=1st.last+1;
> insert:=1;
> end
> end;
> 
> function delete(position:integer;var 1st:List):integer;
> var i:integer;
> begin
> if not((position<1)or(position>1st.last))then
> for i:=position to 1st.last do
> copyobject(1st.object[i],1st.object[i+1]);
> 1st.last:=1st.last-1;
> delete:=1;
> end
> end;
> procedure displaylist(var1st:List);
> var i:integer;
> begin
> for i:=1 to 1t.last do
> displayobj(1st.object[i];
> end;
> 
> Goksie
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 


More information about the fpc-pascal mailing list