On Mon, Jun 09, 2003 at 12:57:24AM +1000, James Mills wrote:
> On Sun, Jun 08, 2003 at 04:43:21PM +0200, Michael Van Canneyt wrote:
> >
> >
> > On Sun, 8 Jun 2003, James Mills wrote:
> >
> > > Hi,
> > >
> > > I get this error from a very simple class:
> > >
> > > Runtime error 216 at 0x0805A735
> > > 0x0805A735
> > > 0x080481FF TCONFIG__PRINT, line 29 of configclass.pas
> > > 0x0805BE35 main, line 29 of forum.pas
> > > 0x080480B0
> > >
> > > Any ideas ?
> >
> > You should also show the forum.pas file.
> > The constructor Create should be in the 'public' section of the class,
> Ahh I think that's where my error lies. (stupid me)
>
> cheers
> James
Actually it makes no difference, so I'll attach all relevant files.
cheers
James
>
> > not in the first (private) section.
> >
> > Michael.
> >
> >
> > _______________________________________________
> > fpc-pascal maillist - [EMAIL PROTECTED]
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
> --
> -
> - James Mills
> Zero Defect Software Engineers Group - ZDSEG
>
> _______________________________________________
> fpc-pascal maillist - [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
--
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG
unit Config;
interface
uses
configClass;
procedure init;
procedure done;
procedure load;
procedure print;
var
conf: TConfig;
confFile: String;
implementation
procedure init;
begin
confFile := 'forum.conf';
end;
procedure done;
begin
conf.Destroy;
end;
procedure load;
begin
conf := TConfig.Create;
end;
procedure print;
begin
conf.print;
end;
end.
unit configClass;
interface
type
TConfig = class(TObject)
private
fileName: String;
public
temp: String;
constructor Create;
procedure print;
end;
implementation
constructor TConfig.Create;
begin
temp := 'hello';
inherited Create;
end;
procedure TConfig.print;
begin
writeLn('#Forum Configuration:');
writeLn('#');
writeLn('/General/');
writeLn('templateDir=', temp);
writeLn;
end;
end.
program forum;
uses
Linux, Config;
const max_data = 1000;
type datarec = record
name,value : string;
end;
var data : array[1..max_data] of datarec;
i,nrdata : longint;
c : char;
literal,aname : boolean;
var
s: String;
f: Text;
begin
config.init;
writeln ('Content-type: text/html');
writeln;
if getenv('REQUEST_METHOD')<>'POST' then
begin
conf.print;
assign(f, '/home/prologic/www/data/forum/templates/index.html');
reset(f);
while not EOF(f) do
begin
readLn(f, s);
writeLn(s);
end;
close(f);
halt(1);
end;
if getenv('CONTENT_TYPE')<>'application/x-www-form-urlencoded' then
begin
writeln ('This script can only be used to decode form results');
halt(1);
end;
nrdata:=1;
aname:=true;
while not eof(input) do
begin
literal:=false;
read(c);
if c='\' then
begin
literal:=true;
read(c);
end;
if literal or ((c<>'=') and (c<>'&')) then
with data[nrdata] do
if aname then name:=name+c else value:=value+c
else
begin
if c='&' then
begin
inc (nrdata);
aname:=true;
end
else
aname:=false;
end
end;
writeln ('<H1>Form Results :</H1>');
writeln ('You submitted the following name/value pairs :');
writeln ('<UL>');
for i:=1 to nrdata do writeln ('<LI> ',data[i].name,' = ',data[i].value);
writeln ('</UL>');
end.