comp.lang.ada
 help / color / mirror / Atom feed
* Re: cgi in turbo pascal or freepascal in windows 95
       [not found] <391BA598.A750AD0A@enztecNOS.PAMorg>
@ 2000-05-13  0:00 ` dbask
  2000-05-15  0:00   ` sking9999
  0 siblings, 1 reply; 3+ messages in thread
From: dbask @ 2000-05-13  0:00 UTC (permalink / raw)


dbask wrote:
> 
> Could someone please post some simple code in turbo pascal or
> freepascal that will do cgi in windows 95?
> 
> Thank you

I had a need for a 'Hello World!' level cgi program and I wanted to use
pascal (turbo pascal, freepascal and console delphi pascal dialect)
because of pascal's great string handling functions, ease of programming
and small and fast exe's. All of which make it a great programming
language for use in cgi programming.

The first 'Hello World!' cgi program I compiled was the following Turbo
C++ code I recieved in an IRC channel :

#include <iostream> 
int main() 
{
cout << "Content-type: text/html\n\n <html><body><p>Hello
World!</p></body></html>";
return 0;
}


I translated it into the following turbo pascal, freepascal and console
delphi pascal dialect 'Hello World!' cgi program :

program cgi1;
const nl = chr(13) + chr(10);
begin
write('Content-type: text/html',nl,nl);
write('<html><body>');
write('<p>Hello World!</p>');
write('</body></html>');
end.


Then into the following ADA 'Hello World' cgi program :

With Text_IO; Use Text_IO;
Pragma RangeCheck(off); Pragma Debug(off); Pragma Arithcheck(Off);
Procedure cgi1 Is
Begin
Put("Content-type: text/html"); New_Line; New_Line;
Put("<html><body>");
Put("<p>Hello World!</p>");
Put("</body></html>");
End cgi1;


The Html code that calls the cgi is :

<!-html for cgi->
<HTML>
<BODY>
<TITLE>CGI Example</TITLE>
<H1>CGI Example</H1>
<FORM ACTION="/cgi-bin/cgi1.exe" METHOD="POST">
<INPUT TYPE="submit" VALUE="Press Here">
</FORM>
</BODY>
</HTML>

Of course these programs are completely stripped down stdin/stdout
programs, but that is all that is needed for a starting cgi program.

A cgi 'Hello World' program is very useful to test whether the web
server is set up properly, the internet and computer systems are
functioning as needed, as well as a 'first program' on which to begin
with and gain cgi programming confidence.

Thank you to Jonas Maebe, Garry Wood, and Marco van de Voort for
replying to my inquiry. 

With freepascal running on both Windows and Linux it is the way to go.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cgi in turbo pascal or freepascal in windows 95
  2000-05-13  0:00 ` cgi in turbo pascal or freepascal in windows 95 dbask
@ 2000-05-15  0:00   ` sking9999
  2000-05-15  0:00     ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: sking9999 @ 2000-05-15  0:00 UTC (permalink / raw)



> I translated it into the following turbo pascal, freepascal and
console
> delphi pascal dialect 'Hello World!' cgi program :
>
> program cgi1;
> const nl = chr(13) + chr(10);
> begin
> write('Content-type: text/html',nl,nl);
> write('<html><body>');
> write('<p>Hello World!</p>');
> write('</body></html>');
> end.

I think you should use writeln instead of using constants
to specify end-of-line. Like so

program cgi1;
begin
writeln('Content-type: text/html');
writeln;
write('<html><body>');
write('<p>Hello World!</p>');
write('</body></html>');
end.

> With freepascal running on both Windows and Linux it is the way to go.

Have you considered using Irie Pascal?
Before I go any further I must admit that I am biased becuase I am
the author of Irie Pascal but I think it is worth considering.

The website is www.irietoools.com.

The current version of Irie Pascal has a problem with
Microsoft Personal Web Server and IIS. A fix for this problem
is ready but I want to test with Apache for Windows before
I release the fix.

If you are at all interested then you can contact me
through this forum or through the website and I will
provide you with more information and the fix when it
becomes available.

PS: Irie Pascal also runs on both Windows and Linux.

Stuart



Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cgi in turbo pascal or freepascal in windows 95
  2000-05-15  0:00   ` sking9999
@ 2000-05-15  0:00     ` Robert Dewar
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Dewar @ 2000-05-15  0:00 UTC (permalink / raw)


In article <8fo2aq$6ga$1@nnrp1.deja.com>,
  sking9999@my-deja.com wrote:

Please, for everyone posting in this thread, trim out
comp.lang.ada, since as far as I can tell this thread
has zero Ada content???


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-05-15  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <391BA598.A750AD0A@enztecNOS.PAMorg>
2000-05-13  0:00 ` cgi in turbo pascal or freepascal in windows 95 dbask
2000-05-15  0:00   ` sking9999
2000-05-15  0:00     ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox