|
Lines 144-150
Link Here
|
| 144 |
for Visual Basic.</para> |
144 |
for Visual Basic.</para> |
| 145 |
|
145 |
|
| 146 |
<para>The <ulink |
146 |
<para>The <ulink |
| 147 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/bwbasic-2.10.tgz">Bywater |
147 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/bwbasic-2.20.tgz">Bywater |
| 148 |
Basic Interpreter</ulink> and the <ulink |
148 |
Basic Interpreter</ulink> and the <ulink |
| 149 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/pbasic-2.0.tgz">Phil |
149 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/pbasic-2.0.tgz">Phil |
| 150 |
Cockroft's Basic Interpreter</ulink> (formerly Rabbit |
150 |
Cockroft's Basic Interpreter</ulink> (formerly Rabbit |
|
Lines 163-169
Link Here
|
| 163 |
languages that were popular at the time. Instead of |
163 |
languages that were popular at the time. Instead of |
| 164 |
being based on numbers, Lisp is based on lists; in fact |
164 |
being based on numbers, Lisp is based on lists; in fact |
| 165 |
the name is short for <quote>List Processing</quote>. |
165 |
the name is short for <quote>List Processing</quote>. |
| 166 |
Very popular in AI (Artificial Intelligence) |
166 |
Very popular in <acronym>AI</acronym> (Artificial Intelligence) |
| 167 |
circles.</para> |
167 |
circles.</para> |
| 168 |
|
168 |
|
| 169 |
<para>Lisp is an extremely powerful and sophisticated |
169 |
<para>Lisp is an extremely powerful and sophisticated |
|
Lines 183-189
Link Here
|
| 183 |
scripts; also often used on World Wide Web servers for |
183 |
scripts; also often used on World Wide Web servers for |
| 184 |
writing <acronym>CGI</acronym> scripts.</para> |
184 |
writing <acronym>CGI</acronym> scripts.</para> |
| 185 |
|
185 |
|
| 186 |
<para>The latest version (version 5) comes with FreeBSD.</para> |
186 |
<para>Version 5.005_05 is supplied with FreeBSD.</para> |
| 187 |
</listitem> |
187 |
</listitem> |
| 188 |
</varlistentry> |
188 |
</varlistentry> |
| 189 |
|
189 |
|
|
Lines 198-208
Link Here
|
| 198 |
abstraction to be used in research work.</para> |
198 |
abstraction to be used in research work.</para> |
| 199 |
|
199 |
|
| 200 |
<para>FreeBSD has packages of the <ulink |
200 |
<para>FreeBSD has packages of the <ulink |
| 201 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/elk-3.0.tgz">Elk |
201 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/elk-3.0.3.tgz">Elk |
| 202 |
Scheme Interpreter</ulink>, the <ulink |
202 |
Scheme Interpreter</ulink>, the <ulink |
| 203 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/mit-scheme-7.3.tgz">MIT |
203 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/mit-scheme-7.6.0.tgz">MIT |
| 204 |
Scheme Interpreter</ulink> and the <ulink |
204 |
Scheme Interpreter</ulink> and the <ulink |
| 205 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/scm-4e1.tgz">SCM |
205 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/scm-5d4_1.tgz">SCM |
| 206 |
Scheme Interpreter</ulink>.</para> |
206 |
Scheme Interpreter</ulink>.</para> |
| 207 |
</listitem> |
207 |
</listitem> |
| 208 |
</varlistentry> |
208 |
</varlistentry> |
|
Lines 212-218
Link Here
|
| 212 |
|
212 |
|
| 213 |
<listitem> |
213 |
<listitem> |
| 214 |
<para><ulink |
214 |
<para><ulink |
| 215 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/icon-9.0.tgz">The |
215 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/icon-9.4.0.tgz">The |
| 216 |
Icon Programming Language</ulink>.</para> |
216 |
Icon Programming Language</ulink>.</para> |
| 217 |
</listitem> |
217 |
</listitem> |
| 218 |
</varlistentry> |
218 |
</varlistentry> |
|
Lines 222-228
Link Here
|
| 222 |
|
222 |
|
| 223 |
<listitem> |
223 |
<listitem> |
| 224 |
<para><ulink |
224 |
<para><ulink |
| 225 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/ucblogo-3.3.tgz">Brian |
225 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/ucblogo-4.6.tgz">Brian |
| 226 |
Harvey's LOGO Interpreter</ulink>.</para> |
226 |
Harvey's LOGO Interpreter</ulink>.</para> |
| 227 |
</listitem> |
227 |
</listitem> |
| 228 |
</varlistentry> |
228 |
</varlistentry> |
|
Lines 232-238
Link Here
|
| 232 |
|
232 |
|
| 233 |
<listitem> |
233 |
<listitem> |
| 234 |
<para><ulink |
234 |
<para><ulink |
| 235 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/python-1.2.tgz">The |
235 |
URL="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/lang/python-2.1.2.tgz">The |
| 236 |
Python Object-Oriented Programming |
236 |
Python Object-Oriented Programming |
| 237 |
Language</ulink></para> |
237 |
Language</ulink></para> |
| 238 |
</listitem> |
238 |
</listitem> |
|
Lines 373-385
Link Here
|
| 373 |
<command>cc</command> is a front end that manages calling all these |
373 |
<command>cc</command> is a front end that manages calling all these |
| 374 |
programs with the right arguments for you; simply typing</para> |
374 |
programs with the right arguments for you; simply typing</para> |
| 375 |
|
375 |
|
| 376 |
<screen>&prompt.user; <userinput>cc foobar.c</></screen> |
376 |
<screen>&prompt.user; <userinput>cc foobar.c</userinput></screen> |
| 377 |
|
377 |
|
| 378 |
<para>will cause <filename>foobar.c</filename> to be compiled by all the |
378 |
<para>will cause <filename>foobar.c</filename> to be compiled by all the |
| 379 |
steps above. If you have more than one file to compile, just do |
379 |
steps above. If you have more than one file to compile, just do |
| 380 |
something like</para> |
380 |
something like</para> |
| 381 |
|
381 |
|
| 382 |
<screen>&prompt.user; <userinput>cc foo.c bar.c</></screen> |
382 |
<screen>&prompt.user; <userinput>cc foo.c bar.c</userinput></screen> |
| 383 |
|
383 |
|
| 384 |
<para>Note that the syntax checking is just that—checking |
384 |
<para>Note that the syntax checking is just that—checking |
| 385 |
the syntax. It will not check for any logical mistakes you may |
385 |
the syntax. It will not check for any logical mistakes you may |
|
Lines 394-400
Link Here
|
| 394 |
</footnote></para> |
394 |
</footnote></para> |
| 395 |
|
395 |
|
| 396 |
<para>There are lots and lots of options for <command>cc</command>, which |
396 |
<para>There are lots and lots of options for <command>cc</command>, which |
| 397 |
are all in the man page. Here are a few of the most important |
397 |
are all in the manual page. Here are a few of the most important |
| 398 |
ones, with examples of how to use them.</para> |
398 |
ones, with examples of how to use them.</para> |
| 399 |
|
399 |
|
| 400 |
<variablelist> |
400 |
<variablelist> |
|
Lines 412-419
Link Here
|
| 412 |
</footnote></para> |
412 |
</footnote></para> |
| 413 |
|
413 |
|
| 414 |
<informalexample> |
414 |
<informalexample> |
| 415 |
<screen>&prompt.user; <userinput>cc foobar.c</> <lineannotation>executable is <filename>a.out</></> |
415 |
<screen>&prompt.user; <userinput>cc foobar.c</userinput> <lineannotation>executable is <filename>a.out</filename></lineannotation> |
| 416 |
&prompt.user; <userinput>cc -o foobar foobar.c</> <lineannotation>executable is <filename>foobar</></> |
416 |
&prompt.user; <userinput>cc -o foobar foobar.c</userinput> <lineannotation>executable is <filename>foobar</filename></lineannotation> |
| 417 |
</screen> |
417 |
</screen> |
| 418 |
</informalexample> |
418 |
</informalexample> |
| 419 |
</listitem> |
419 |
</listitem> |
|
Lines 552-558
Link Here
|
| 552 |
code</firstterm>.</para> |
552 |
code</firstterm>.</para> |
| 553 |
|
553 |
|
| 554 |
<para>Generally, you should try to make your code as portable as |
554 |
<para>Generally, you should try to make your code as portable as |
| 555 |
possible, as otherwise you may have to completely re-write the |
555 |
possible, as otherwise you may have to completely rewrite the |
| 556 |
program later to get it to work somewhere else—and who |
556 |
program later to get it to work somewhere else—and who |
| 557 |
knows what you may be using in a few years time?</para> |
557 |
knows what you may be using in a few years time?</para> |
| 558 |
|
558 |
|
|
Lines 607-614
Link Here
|
| 607 |
<command>g++</command> on FreeBSD.</para> |
607 |
<command>g++</command> on FreeBSD.</para> |
| 608 |
|
608 |
|
| 609 |
<informalexample> |
609 |
<informalexample> |
| 610 |
<screen>&prompt.user; <userinput>cc -o foobar foobar.cc -lg++</userinput> <lineannotation>For FreeBSD 2.1.6 and earlier</> |
610 |
<screen>&prompt.user; <userinput>cc -o foobar foobar.cc -lg++</userinput> <lineannotation>For FreeBSD 2.1.6 and earlier</lineannotation> |
| 611 |
&prompt.user; <userinput>cc -o foobar foobar.cc -lstdc++</userinput> <lineannotation>For FreeBSD 2.2 and later</> |
611 |
&prompt.user; <userinput>cc -o foobar foobar.cc -lstdc++</userinput> <lineannotation>For FreeBSD 2.2 and later</lineannotation> |
| 612 |
&prompt.user; <userinput>c++ -o foobar foobar.cc</userinput> |
612 |
&prompt.user; <userinput>c++ -o foobar foobar.cc</userinput> |
| 613 |
</screen> |
613 |
</screen> |
| 614 |
</informalexample> |
614 |
</informalexample> |
|
Lines 1377-1384
Link Here
|
| 1377 |
on a few of the basic commands.</para> |
1377 |
on a few of the basic commands.</para> |
| 1378 |
|
1378 |
|
| 1379 |
<para>Finally, if you find its text-based command-prompt style |
1379 |
<para>Finally, if you find its text-based command-prompt style |
| 1380 |
off-putting, there is a graphical front-end for it <ulink |
1380 |
off-putting, there is a graphical front-end for it (<ulink |
| 1381 |
URL="../../../../ports/devel.html">xxgdb</ulink> in the ports |
1381 |
URL="../../../../ports/devel.html">xxgdb</ulink>) in the ports |
| 1382 |
collection.</para> |
1382 |
collection.</para> |
| 1383 |
|
1383 |
|
| 1384 |
<para>This section is intended to be an introduction to using |
1384 |
<para>This section is intended to be an introduction to using |
|
Lines 1460-1475
Link Here
|
| 1460 |
under certain conditions; type "show copying" to see the conditions. |
1460 |
under certain conditions; type "show copying" to see the conditions. |
| 1461 |
There is absolutely no warranty for GDB; type "show warranty" for details. |
1461 |
There is absolutely no warranty for GDB; type "show warranty" for details. |
| 1462 |
GDB 4.13 (i386-unknown-freebsd), Copyright 1994 Free Software Foundation, Inc. |
1462 |
GDB 4.13 (i386-unknown-freebsd), Copyright 1994 Free Software Foundation, Inc. |
| 1463 |
(gdb) <userinput>break main</> <lineannotation>Skip the set-up code</> |
1463 |
(gdb) <userinput>break main</userinput> <lineannotation>Skip the set-up code</lineannotation> |
| 1464 |
Breakpoint 1 at 0x160f: file temp.c, line 9. <lineannotation><command>gdb</command> puts breakpoint at <function>main()</></> |
1464 |
Breakpoint 1 at 0x160f: file temp.c, line 9. <lineannotation><command>gdb</command> puts breakpoint at <function>main()</function></lineannotation> |
| 1465 |
(gdb) <userinput>run</> <lineannotation>Run as far as <function>main()</></> |
1465 |
(gdb) <userinput>run</userinput> <lineannotation>Run as far as <function>main()</function></lineannotation> |
| 1466 |
Starting program: /home/james/tmp/temp <lineannotation>Program starts running</> |
1466 |
Starting program: /home/james/tmp/temp <lineannotation>Program starts running</lineannotation> |
| 1467 |
|
1467 |
|
| 1468 |
Breakpoint 1, main () at temp.c:9 <lineannotation><command>gdb</command> stops at <function>main()</></> |
1468 |
Breakpoint 1, main () at temp.c:9 <lineannotation><command>gdb</command> stops at <function>main()</function></lineannotation> |
| 1469 |
(gdb) <userinput>n</> <lineannotation>Go to next line</> |
1469 |
(gdb) <userinput>n</userinput> <lineannotation>Go to next line</lineannotation> |
| 1470 |
This is my program <lineannotation>Program prints out</> |
1470 |
This is my program <lineannotation>Program prints out</lineannotation> |
| 1471 |
(gdb) <userinput>s</> <lineannotation>step into <function>bazz()</></> |
1471 |
(gdb) <userinput>s</userinput> <lineannotation>step into <function>bazz()</function></lineannotation> |
| 1472 |
bazz (anint=4231) at temp.c:17 <lineannotation><command>gdb</command> displays stack frame</> |
1472 |
bazz (anint=4231) at temp.c:17 <lineannotation><command>gdb</command> displays stack frame</lineannotation> |
| 1473 |
(gdb)</screen> |
1473 |
(gdb)</screen> |
| 1474 |
|
1474 |
|
| 1475 |
<para>Hang on a minute! How did <symbol>anint</symbol> get to be |
1475 |
<para>Hang on a minute! How did <symbol>anint</symbol> get to be |
|
Lines 1477-1497
Link Here
|
| 1477 |
<literal>5</literal> in <function>main()</function>? Let's |
1477 |
<literal>5</literal> in <function>main()</function>? Let's |
| 1478 |
move up to <function>main()</function> and have a look.</para> |
1478 |
move up to <function>main()</function> and have a look.</para> |
| 1479 |
|
1479 |
|
| 1480 |
<screen>(gdb) <userinput>up</> <lineannotation>Move up call stack</> |
1480 |
<screen>(gdb) <userinput>up</userinput> <lineannotation>Move up call stack</lineannotation> |
| 1481 |
#1 0x1625 in main () at temp.c:11 <lineannotation><command>gdb</command> displays stack frame</> |
1481 |
#1 0x1625 in main () at temp.c:11 <lineannotation><command>gdb</command> displays stack frame</lineannotation> |
| 1482 |
(gdb) <userinput>p i</> <lineannotation>Show us the value of <symbol>i</></> |
1482 |
(gdb) <userinput>p i</userinput> <lineannotation>Show us the value of <symbol>i</symbol></lineannotation> |
| 1483 |
$1 = 4231 <lineannotation><command>gdb</command> displays <literal>4231</></></screen> |
1483 |
$1 = 4231 <lineannotation><command>gdb</command> displays <literal>4231</literal></lineannotation></screen> |
| 1484 |
|
1484 |
|
| 1485 |
<para>Oh dear! Looking at the code, we forgot to initialise |
1485 |
<para>Oh dear! Looking at the code, we forgot to initialise |
| 1486 |
<symbol>i</symbol>. We meant to put</para> |
1486 |
<symbol>i</symbol>. We meant to put</para> |
| 1487 |
|
1487 |
|
| 1488 |
<programlisting><lineannotation>…</> |
1488 |
<programlisting><lineannotation>…</lineannotation> |
| 1489 |
main() { |
1489 |
main() { |
| 1490 |
int i; |
1490 |
int i; |
| 1491 |
|
1491 |
|
| 1492 |
i = 5; |
1492 |
i = 5; |
| 1493 |
printf("This is my program\n"); |
1493 |
printf("This is my program\n"); |
| 1494 |
<lineannotation>&hellip</></programlisting> |
1494 |
<lineannotation>&hellip</lineannotation></programlisting> |
| 1495 |
|
1495 |
|
| 1496 |
<para>but we left the <literal>i=5;</literal> line out. As we |
1496 |
<para>but we left the <literal>i=5;</literal> line out. As we |
| 1497 |
did not initialise <symbol>i</symbol>, it had whatever number |
1497 |
did not initialise <symbol>i</symbol>, it had whatever number |
|
Lines 1788-1794
Link Here
|
| 1788 |
quite big!).</para> |
1788 |
quite big!).</para> |
| 1789 |
|
1789 |
|
| 1790 |
<para>The best way to learn Emacs Lisp is to download the <ulink |
1790 |
<para>The best way to learn Emacs Lisp is to download the <ulink |
| 1791 |
URL="ftp://prep.ai.mit.edu/pub/gnu/elisp-manual-19-2.4.tar.gz">Emacs |
1791 |
URL="ftp://ftp.gnu.org/old-gnu/emacs/elisp-manual-19-2.4.tar.gz">Emacs |
| 1792 |
Tutorial</ulink></para> |
1792 |
Tutorial</ulink></para> |
| 1793 |
|
1793 |
|
| 1794 |
<para>However, there is no need to actually know any Lisp to get |
1794 |
<para>However, there is no need to actually know any Lisp to get |
|
Lines 2202-2212
Link Here
|
| 2202 |
<filename>.emacs</filename> and add a line for whizbang, such |
2202 |
<filename>.emacs</filename> and add a line for whizbang, such |
| 2203 |
as:</para> |
2203 |
as:</para> |
| 2204 |
|
2204 |
|
| 2205 |
<programlisting><lineannotation>…</> |
2205 |
<programlisting><lineannotation>…</lineannotation> |
| 2206 |
("\\.lsp$" . lisp-mode) |
2206 |
("\\.lsp$" . lisp-mode) |
| 2207 |
("\\.wiz$" . whizbang-mode) |
2207 |
("\\.wiz$" . whizbang-mode) |
| 2208 |
("\\.scm$" . scheme-mode) |
2208 |
("\\.scm$" . scheme-mode) |
| 2209 |
<lineannotation>…</></programlisting> |
2209 |
<lineannotation>…</lineannotation></programlisting> |
| 2210 |
|
2210 |
|
| 2211 |
<para>This means that Emacs will automatically go into |
2211 |
<para>This means that Emacs will automatically go into |
| 2212 |
<function>whizbang-mode</function> when you edit a file ending |
2212 |
<function>whizbang-mode</function> when you edit a file ending |