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

Darius Blaszijk dhkblaszyk at zeelandnet.nl
Mon Jan 15 00:27:13 CET 2007


Goksie,

You could also start reading the output of the FPC compiler :) Normally it 
gives hints, warning and errors where to start looking for to correct your 
code. Iow don't ask for the obvious before looking yourself first.

Darius

----- Original Message ----- 
From: "Daniël Mantione" <daniel.mantione at freepascal.org>
To: <myklass at gmail.com>; "FPC-Pascal users discussions" 
<fpc-pascal at lists.freepascal.org>
Sent: Sunday, January 14, 2007 11:26 PM
Subject: Re: [fpc-pascal] Can someone help me to debug and correct this 
code?




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
>


--------------------------------------------------------------------------------


> _______________________________________________
> 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