How to Install Free Pascal on a Mac OS X Computer
Note: if you find a problem with these instructions, please
send me an e-mail message at puketza@cs.ucdavis.edu
The first step is that you need to install something called Xcode.
Xcode is available on your OS X CD, so just insert that CD in
your computer, and then install Xcode.
Xcode is also available via the Internet:
http://developer.apple.com/tools/xcode/index.html
Just click on "Download Xcode 2.2" .
After installing Xcode:
* go to www.freepascal.org
* click on Download (on the left side of the window)
* click on Mac OS X
* click on ftp.freepascal.org
* click on fpc-2.0.2.powerpc-macosx.dmg
This should start the download.
After the download is complete, install the program.
Just click on the new icon to start the installation ...
and the installation should proceed automatically
[please let me know if I am wrong about this].
After the installation is complete:
* [Thanks to Daniel H. Steinberg for the next instructions.]
Start up a new "terminal" window.
You can find "terminal" in Mac OS X/Applications/Utilities/.
You may find it useful to drag Terminal to your dock. When
the terminal starts up you should see a prompt that looks
something like this:
[localhost:~] <user name>%
* please type this command in this new window, and press ENTER:
/usr/local/bin/fpc
* You should see a long message (which mentions Free Pascal).
In fact, the message should ask you to press the Enter key,
to display the rest of the message.
If that is the case, then the installation worked - success!
But: if the message says "command not found" .... that is not good.
--------------------------------------------------------------------------
Part 2: Using Free Pascal to Create Programs
--- The "bash profile" file ----
[Thanks to Daniel H. Steinberg -- I copied some of these instructions
from his Internet documents.] Open up the Terminal application. You can find this
in Mac OS X/Applications/Utilities/. You may find it useful to drag Terminal to
your dock. When Terminal starts up you should see a prompt that looks like this:
[localhost:~] <user name>%
Please carefully type this command:
vi .bash_profile
[please note the "dot" and the "underscore" in the command]
This starts up the "vi" editor program. "vi" is a weird program!
So, instead of explaining it completely, I'm just going to walk
you through a few commands.
Next, press "i". [You won't see an "i" on the screen -- that's OK.]
Next, please type this EXACTLY:
PATH=$PATH:/usr/local/bin:.
Next, press the Esc key.
Next, please type this:
:wq
... and then press ENTER.
That should cause "vi" to exit ... and you should see the "command prompt" again:
[localhost:~] <user name>%
Now, let's see if all this worked. Close the terminal window, and open up
a new terminal window. Of course, you should see the "command prompt".
Please type this command:
fpc
You should see a long message (which mentions Free Pascal).
In fact, the message should ask you to press the Enter key,
to display the rest of the message.
If that's the case, then please continue with the rest of this document.
But: if the message says "command not found" .... that is not good.
You may want to try this step one more time, from the beginning.
----------------------------------------------------------------------------
A New Folder: ECS15
In your terminal window, please enter this command:
mkdir ECS15
This creates a new ECS15 folder, under your "home" folder.
Change to that folder:
cd ECS15
----------------------------------------------------------------------------
Text Edit
[These instructions are a little rough, since I don't have a Mac,
and I'm just going from memory. If anyone would like to make
these instructions more precise, and then send them to me, that
would be great!]
Now, leave the terminal window open, but please start up a program
called "Text Edit". You'll find it in Mac OS X/Applications.
After it starts up, go to the Format Menu, and choose "Make Plain Text".
Next, please type in the following sample program (or cut and paste):
program hello;
begin
writeln('Hello, world.')
end.
Next, you want to save the file. Select "Save As" .... and
when the little window pops up, try to find your new ECS15
folder. You may have to click on some of the black arrows.
And you may have to click on your "home" folder, so that
you can see the ECS15 folder.
For the file name, please use "hello.pas". Whenever you create
a Pascal program, you'll need to use .pas in the file name.
After you click on Save, the computer may ask you if you
want a different extension. But the extension you want is .pas
---------------------------------------------------------------------------
Ready to Compile
Now, leave the Text Edit window open, but go back to the Terminal window.
There, please type this command: ls
The "ls" command lists all the files and folders in the current folder.
You should see your "hello.pas" file in the list.
Next, please type this command: fpc hello.pas
The "fpc" command invokes the Free Pascal Compiler, which translates
your Pascal program to a form that the computer can understand.
You should see some messages that look something like this:
Free Pascal Compiler version 2.0.0 [2005/08/17] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: OS X
Compiling hello.pas
Linking hello
4 Lines compiled, 0.6 sec
Now type this command: hello
That will *run* your new program, which should simply
print this message:
Hello, world.
That's all it does. If that worked, great -- so far, so good.
----------------------------------------------------------------------------
Another program
Use Text Edit to create another file. (Remember to use the Format
Menu and select "Make Plain Text").
program Sample;
var
n1, n2, sum: integer;
begin
writeln('Enter two numbers:');
readln(n1,n2);
sum := n1 + n2;
writeln('The sum is ', sum);
end.
Save this file in your ECS15 folder as well. Please name it "sum.pas".
Go back to the Terminal window, and try to compile the new file:
fpc sum.pas
* You should see several messages, like this:
Free Pascal Compiler version 2.0.0 [2005/05/08] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: OS X
Compiling sum.pas
Linking sum.exe
8 Lines compiled, 0.1 sec
* However, you might instead see some "error messages".
If so, then check your program (in the Text Edit window) for errors.
After you fix them, be sure to save your file again, and then
go back to the terminal window, and try to compile again using
the fpc command.
* Try to run the program (in the Terminal window).
Type this command: sum
Your program should print this message:
Enter two numbers:
Go ahead and enter 2 numbers (separated by a space), then press ENTER,
and then your program should report the sum of the numbers.
* If that works, great! You are done. Feel free to close
all
windows.
* Note: there is nothing to turn in for this exercise!
However, this exercise is excellent practice for
the first programming assignment.
Điều quan trọng trong quan hệ, nam giới cần cho dương vật đi vào bao cao su nữ. Một vài người nhận thấy cảm giác ở cậu bé có vẻ hoạt động tốt giả dụ xâm nhập sâu giữa bên ngoài bao cao su và thành âm...
Khuyến cáo cho bạn gái trước khi sử dụng bao cao su nữ