Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

PASCAL programming for Novice

18 messages · 10 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Aruna Goke

I am completely new to programming and I have been watching this list over some few months.

I would be glad, if i can get a link to where I can get a book to download in order to learn pascal.

Can someone tell me.... where i can get free pascal compiler for ms-windows

goksie

Reply by email

Daniël Mantione
to Aruna Goke

Op Sat, 9 Jun 2007, schreef Aruna Goke:

Show quoted text 5 lines
I am completely new to programming and I have been watching this list over some few months. I would be glad, if i can get a link to where I can get a book to download in order to learn pascal.

Here is an on-line tutorial: http://www.taoyue.com/tutorials/pascal

Can someone tell me.... where i can get free pascal compiler for ms-windows

?? Here: http://www.freepascal.org/download.var

Daniël

Reply by email

Leonardo M. Ram�
to Daniël Mantione

After reading the tutorial suggested by Daniel, you sould go to http://en.wikipedia.org/wiki/Delphi_(programming_language) and follow a link to "object pascal language guide" to learn Object Pascal.

--- Daniël Mantione wrote 11 lines
Op Sat, 9 Jun 2007, schreef Aruna Goke: > I am completely new to programming and I have been watching this list over > some few months. > > I would be glad, if i can get a link to where I can get a book to download in > order to learn pascal. Here is an on-line tutorial: http://www.taoyue.com/tutorials/pascal

____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/

Reply by email

Francisco Reyes
to Leonardo M. Ram�
Leonardo M. Ramé wrote
After reading the tutorial suggested by Daniel, you sould go to http://en.wikipedia.org/wiki/Delphi_(programming_language) and follow a link to "object pascal language guide" to learn Object Pascal.

Looking at http://en.wikipedia.org/wiki/Object_Pascal I see there are different syntax for objects.

Which one does FreePascal uses?

They list:
Apple's Object Pascal
Turbo Pascal's Object Pascal
Delphi's Object Pascal
Chrome's Object Pascal

Reply by email

Michael Van Canneyt
to Francisco Reyes
Francisco Reyes wrote 16 lines
Leonardo M. Ramé writes: > After reading the tutorial suggested by Daniel, you sould go to > http://en.wikipedia.org/wiki/Delphi_(programming_language) and follow a link > to "object pascal > language guide" to learn Object Pascal. Looking at http://en.wikipedia.org/wiki/Object_Pascal I see there are different syntax for objects. Which one does FreePascal uses? They list: Apple's Object Pascal Turbo Pascal's Object Pascal Delphi's Object Pascal

Both Turbo Pascal's Object Pascal and Delphi's object pascal are supported, depending on which mode you compile in.

Michael.

Reply by email

Rick Seiden
to Michael Van Canneyt

Any tutorials out there on using Event Driven programming with Free Pascal?

I'm hoping to create a server/client combo that will need to respond to both input from the client part, and input from the server part

my server/client combo app
+--------------------------+
User ---> | server part-->client part| --> another server +--------------------------+

So, when my user talks to my server, I need to be able to respond, and when the other server talks to my client, I need to be able to respond.

Anyway, just a simple event driven programming tutorial using some version of Pascal will probably help.

Thanks

Michael Van Canneyt wrote 31 lines
On Sat, 9 Jun 2007, Francisco Reyes wrote: > Leonardo M. Ramé writes: > > >> After reading the tutorial suggested by Daniel, you sould go to >> http://en.wikipedia.org/wiki/Delphi_(programming_language) and follow a link >> to "object pascal >> language guide" to learn Object Pascal. >> > Looking at http://en.wikipedia.org/wiki/Object_Pascal I see there are > different syntax for objects. > > Which one does FreePascal uses? > > They list: > Apple's Object Pascal > Turbo Pascal's Object Pascal > Delphi's Object Pascal > Both Turbo Pascal's Object Pascal and Delphi's object pascal are supported, depending on which mode you compile in. Michael. ------------------------------------------------------------------------ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
If you never have the courage to lose sight of the shore, You'll never know the utter terror of being forever lost at sea

Reply by email

Francisco Reyes
to Michael Van Canneyt: Both Turbo Pascal's Object Pascal and Delphi's object pascal are supported, depending on…
Michael Van Canneyt wrote
Both Turbo Pascal's Object Pascal and Delphi's object pascal are supported, depending on which mode you compile in.
If I have a class like:
program myclass;
 type
   THelloWorld = class
     procedure Put;
   end;
 var
   HelloWorld: THelloWorld;
 procedure THelloWorld.Put;
 begin
   WriteLn('Hello, World!');
 end;
 begin
   HelloWorld := THelloWorld.Create;
   HelloWorld.Put;
   HelloWorld.Free;
 end.

How do I use that class in another program?

Reply by email

Leonardo M. Ram�
to Rick Seiden: Any tutorials out there on using Event Driven programming with Free Pascal? I'm hoping to…

Are you trying to create a Peer-To-Peer architecture?, something like Windows Messenger?.

I don't know how to implement that type of architecture, you can do a simple google search to find examples, but since it uses socket communications you can implement it using lNet or Synapse libraries with FreePascal.

Leonardo M. Ramé
http://leonardorame.blogspot.com

--- Rick Seiden wrote 18 lines
Any tutorials out there on using Event Driven programming with Free Pascal? I'm hoping to create a server/client combo that will need to respond to both input from the client part, and input from the server part my server/client combo app +--------------------------+ User ---> | server part-->client part| --> another server +--------------------------+ So, when my user talks to my server, I need to be able to respond, and when the other server talks to my client, I need to be able to respond. Anyway, just a simple event driven programming tutorial using some version of Pascal will probably help. Thanks

____________________________________________________________________________________ Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/

Reply by email

Leonardo M. Ram�
to Francisco Reyes: If I have a class like: program myclass; type THelloWorld = class procedure Put; end; var…

Francisco, that's not only a class, it's a Program containing the THelloWorld class.

With Object Pascal (and Pascal), you can divide your program in units, then use those units in a program.

Example:

------------------------------------
Unit HelloWorld;
interface
type
  THelloWorld = class
    procedure Put;
  end;
implementation
procedure THelloWorld.Put;
begin
  WriteLn('Hello, World!');
end;

end.
------------------------------------
program MyProgram

uses
  HelloWorld; // this includes HelloWorld into your program
var
  myHelloWorl: THelloWorld;  // to declare a variable of type THelloWorld
begin
  myHelloWorld := THelloWorld.Create;  // to create an instance of THelloWorld.
  myHelloWorld.Put;                    // to execute Put method.
  myHelloWorld.Free;                   // to destroy the instance.
end.
-----------------------

Leonardo M. Ramé
http://leonardorame.blogspot.com

--- Francisco Reyes wrote 31 lines
Michael Van Canneyt writes: > Both Turbo Pascal's Object Pascal and Delphi's object pascal are > supported, depending on which mode you compile in. If I have a class like: program myclass; type THelloWorld = class procedure Put; end; var HelloWorld: THelloWorld; procedure THelloWorld.Put; begin WriteLn('Hello, World!'); end; begin HelloWorld := THelloWorld.Create; HelloWorld.Put; HelloWorld.Free; end. How do I use that class in another program? _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

____________________________________________________________________________________ Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/

Reply by email

Joao Morais
to Francisco Reyes: If I have a class like: program myclass; type THelloWorld = class procedure Put; end; var…
Francisco Reyes wrote 25 lines
Michael Van Canneyt writes: > Both Turbo Pascal's Object Pascal and Delphi's object pascal are > supported, depending on which mode you compile in. If I have a class like: program myclass; type THelloWorld = class procedure Put; end; var HelloWorld: THelloWorld; procedure THelloWorld.Put; begin WriteLn('Hello, World!'); end; begin HelloWorld := THelloWorld.Create; HelloWorld.Put; HelloWorld.Free; end. How do I use that class in another program?

You can:

uses
   UnitWithHello;

...

var
   VHello: THelloWorld;
begin
   VHello := THelloWorld.Create;
   try
     VHello.Put;
   finally
     VHello.Free;
   end;

or you can:

unit UnitWithHello;
type
   THelloWorldClass = class of HelloWorld;
   THelloWorld = class
     procedure Put; virtual; abstract;
   end;

...

unit AnotherUnit;
uses
   UnitWithHello;

...

procedure DoHello(AHelloClass: THelloWorldClass);
var
   VHello: THelloWorld;
begin
   VHello := AHelloClass.Create;
   try
     VHello.Put;
   finally
     VHello.Free;
   end;

or you can:

uses
   UnitWithHello;
type
   THelloWrapper = class
   private
     FHello: THelloWorld;
     function GetHello: THelloWorld;
   protected
     function InternalHelloClass: THelloWorldClass; virtual; abstract;
     property Hello: THelloWorld read GetHello;
   public
     destructor Destroy; override;
   end;

...

destructor THelloWrapper.Destroy;
begin
   FHello.Free;
   inherited;
end;
function THelloWrapper.GetHello: THelloWorld;
begin
   if not Assigned(FHello) then
     FHello := InternalHelloClass.Create;
   Result := FHello;
end;

or you can:

uses
   UnitWithHello;
type
   THelloWrapper = class
   private
     FHello: THelloWorld;
     FHelloClass: THelloWorldClass;
     function GetHello: THelloWorld;
  protected
     property Hello: THelloWorld read GetHello;
   public
     constructor Create(AHelloClass: THelloWorldClass);
     destructor Destroy; override;
   end;

...

constructor THelloWrapper.Create(AHelloClass; THelloWorldClass);
begin
   Assert(Assigned(AHelloClass), 'error');
   inherited Create;
   FHelloClass := AHelloClass;
end;
destructor THelloWrapper.Destroy;
begin
   FHello.Free;
   inherited;
end;
function THelloWrapper.GetHello: THelloWorld;
begin
   if not Assigned(FHello) then
     FHello := FHelloClass.Create;
   Result := FHello;
end;

And so on.

Joao Morais

Reply by email

Daniël Mantione
to Francisco Reyes

Op Sat, 9 Jun 2007, schreef Francisco Reyes:

FreePascal doesn't look in the current directory by default? I had to use uses HelloWorld in 'HelloWorld.p'; _______________________________________________

It doesn't look for .p by default. Rename to .pas or .pp.

Daniël

Reply by email

Rick Seiden
to Leonardo M. Ram�: Are you trying to create a Peer-To-Peer architecture?, something like Windows Messenger?.…

It's what I like to call a pass through server. My ISP won't let me send email unless I'm on their network (at home). So, I have a server I wrote in VB that listens for a connection on a non standard port. When connected, it connects to my ISP's SMTP server. Anything it gets from the email client, it passes to the server. Anything it gets from the server it passes to the email client. Works like a charm. Only problem is that it's in Windows. I'm working towards getting rid of that windows box and replacing it with linux. So, I need to re-write this app in Linux. It's really the event part of it that I'm concerned with.

Leonardo M. Ramé wrote 46 lines
Are you trying to create a Peer-To-Peer architecture?, something like Windows Messenger?. I don't know how to implement that type of architecture, you can do a simple google search to find examples, but since it uses socket communications you can implement it using lNet or Synapse libraries with FreePascal. Leonardo M. Ramé http://leonardorame.blogspot.com --- Rick Seiden wrote: > Any tutorials out there on using Event Driven programming with Free Pascal? > > I'm hoping to create a server/client combo that will need to respond to > both input from the client part, and input from the server part > > my server/client combo app > +--------------------------+ > User ---> | server part-->client part| --> another server > +--------------------------+ > > So, when my user talks to my server, I need to be able to respond, and > when the other server talks to my client, I need to be able to respond. > > Anyway, just a simple event driven programming tutorial using some > version of Pascal will probably help. > > Thanks > > ____________________________________________________________________________________ Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
If you never have the courage to lose sight of the shore, You'll never know the utter terror of being forever lost at sea

Reply by email

Luca Olivetti
to Rick Seiden

En/na Rick Seiden ha escrit:

Show quoted text 9 lines
It's what I like to call a pass through server. My ISP won't let me send email unless I'm on their network (at home). So, I have a server I wrote in VB that listens for a connection on a non standard port. When connected, it connects to my ISP's SMTP server. Anything it gets from the email client, it passes to the server. Anything it gets from the server it passes to the email client. Works like a charm. Only problem is that it's in Windows. I'm working towards getting rid of that windows box and replacing it with linux. So, I need to re-write this app in Linux. It's really the event part of it that I'm concerned with.

You don't need to rewrite the app (unless you want to do it as a learning exercise). sshd can tunnel connections this way right out of the box, or if you want to do it the exact way you're doing now, you can, e.g. configure xinetd to forwar one port to your server to another port to another server (but that's extremely dangerous)

Bye

Luca

Reply by email

Pete Cervasio
to Francisco Reyes
Francisco Reyes wrote 6 lines
Daniël Mantione writes: > It doesn't look for .p by default. Rename to .pas or .pp. Ok thanks. Using .p because that is what vim checks for. Will figure out how to change vim to look for .pp for the coloring.

Contents of $HOME/.vim/filetype.vim:

" my filetype file
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.pp setfiletype pascal augroup END

Best regards,
Pete C.

Reply by email

Micha Nelissen
to Francisco Reyes
Francisco Reyes wrote 7 lines
Pete Cervasio writes: > Contents of $HOME/.vim/filetype.vim: Thanks. Found that it also works with .pas Changed the programs to that since that is one of the extensiosn the compiler also checks for. _______________________________________________

If you google for "vim delphi syntax" you can easily find a delphi syntax highlight file for vim. You can then connect .pas/.pp/.inc to that one in a similar way.

Micha

Reply by email