|
Lines 1-10
Link Here
|
| 1 |
<!-- $FreeBSD: doc/en_US.ISO_8859-1/articles/programming-tools/article.sgml,v 1.7 1999/09/06 06:52:38 peter Exp $ --> |
1 |
<!-- $FreeBSD: doc/en_US.ISO_8859-1/articles/programming-tools/article.sgml,v 1.7 1999/09/06 06:52:38 peter Exp $ --> |
| 2 |
<!-- The FreeBSD Documentation Project --> |
2 |
<!-- The FreeBSD Documentation Project --> |
| 3 |
|
3 |
|
| 4 |
<!DOCTYPE BOOK PUBLIC "-//Davenport//DTD DocBook V3.0//EN"> |
4 |
<!DOCTYPE ARTICLE PUBLIC "-//FreeBSD//DTD DocBook V3.1-Based Extension//EN"> |
| 5 |
<book> |
5 |
<article> |
| 6 |
<bookinfo> |
6 |
|
| 7 |
<bookbiblio> |
7 |
<artheader> |
| 8 |
<title>A User's Guide to FreeBSD Programming Tools</title> |
8 |
<title>A User's Guide to FreeBSD Programming Tools</title> |
| 9 |
|
9 |
|
| 10 |
<authorgroup> |
10 |
<authorgroup> |
|
Lines 31-40
Link Here
|
| 31 |
coding in any detail. Most of the document assumes little or no |
31 |
coding in any detail. Most of the document assumes little or no |
| 32 |
previous programming knowledge, although it is hoped that most |
32 |
previous programming knowledge, although it is hoped that most |
| 33 |
programmers will find something of value in it</para></abstract> |
33 |
programmers will find something of value in it</para></abstract> |
| 34 |
</bookbiblio> |
34 |
</artheader> |
| 35 |
</bookinfo> |
|
|
| 36 |
|
35 |
|
| 37 |
<chapter> |
36 |
<sect1> |
| 38 |
<title>Introduction<anchor id=foo></title> |
37 |
<title>Introduction<anchor id=foo></title> |
| 39 |
|
38 |
|
| 40 |
<para>FreeBSD offers an excellent development environment. Compilers |
39 |
<para>FreeBSD offers an excellent development environment. Compilers |
|
Lines 58-66
Link Here
|
| 58 |
programming, although it does assume a basic competence with using |
57 |
programming, although it does assume a basic competence with using |
| 59 |
Unix and a willingness to learn!</para> |
58 |
Unix and a willingness to learn!</para> |
| 60 |
|
59 |
|
| 61 |
</chapter> |
60 |
</sect1> |
| 62 |
|
61 |
|
| 63 |
<chapter> |
62 |
<sect1> |
| 64 |
<title>Introduction to Programming</title> |
63 |
<title>Introduction to Programming</title> |
| 65 |
|
64 |
|
| 66 |
<para>A program is a set of instructions that tell the computer to do |
65 |
<para>A program is a set of instructions that tell the computer to do |
|
Lines 76-82
Link Here
|
| 76 |
|
75 |
|
| 77 |
|
76 |
|
| 78 |
|
77 |
|
| 79 |
<sect1> |
78 |
<sect2> |
| 80 |
<title>Interpreters</title> |
79 |
<title>Interpreters</title> |
| 81 |
|
80 |
|
| 82 |
<para>With an interpreter, the language comes as an environment, where you |
81 |
<para>With an interpreter, the language comes as an environment, where you |
|
Lines 107-115
Link Here
|
| 107 |
programs that could be linked together in shell scripts to perform |
106 |
programs that could be linked together in shell scripts to perform |
| 108 |
useful tasks.</para> |
107 |
useful tasks.</para> |
| 109 |
|
108 |
|
| 110 |
</sect1> |
109 |
</sect2> |
| 111 |
|
110 |
|
| 112 |
<sect1> |
111 |
<sect2> |
| 113 |
<title>Interpreters available with FreeBSD</title> |
112 |
<title>Interpreters available with FreeBSD</title> |
| 114 |
|
113 |
|
| 115 |
<para>Here is a list of interpreters that are available as <ulink |
114 |
<para>Here is a list of interpreters that are available as <ulink |
|
Lines 209-217
Link Here
|
| 209 |
</variablelist> |
208 |
</variablelist> |
| 210 |
</para> |
209 |
</para> |
| 211 |
|
210 |
|
| 212 |
</sect1> |
211 |
</sect2> |
| 213 |
|
212 |
|
| 214 |
<sect1> |
213 |
<sect2> |
| 215 |
<title>Compilers</title> |
214 |
<title>Compilers</title> |
| 216 |
|
215 |
|
| 217 |
<para>Compilers are rather different. First of all, you write your |
216 |
<para>Compilers are rather different. First of all, you write your |
|
Lines 248-257
Link Here
|
| 248 |
it is possible to use Emacs for this purpose. This is discussed in |
247 |
it is possible to use Emacs for this purpose. This is discussed in |
| 249 |
<xref linkend="emacs">.</para> |
248 |
<xref linkend="emacs">.</para> |
| 250 |
|
249 |
|
|
|
250 |
</sect2> |
| 251 |
</sect1> |
251 |
</sect1> |
| 252 |
</chapter> |
|
|
| 253 |
|
252 |
|
| 254 |
<chapter> |
253 |
<sect1> |
| 255 |
<title>Compiling with <command>cc</command></title> |
254 |
<title>Compiling with <command>cc</command></title> |
| 256 |
|
255 |
|
| 257 |
<para>This section deals only with the GNU compiler for C and C++, |
256 |
<para>This section deals only with the GNU compiler for C and C++, |
|
Lines 527-533
Link Here
|
| 527 |
</varlistentry> |
526 |
</varlistentry> |
| 528 |
</variablelist> |
527 |
</variablelist> |
| 529 |
|
528 |
|
| 530 |
<sect1> |
529 |
<sect2> |
| 531 |
<title>Common <command>cc</command> Queries and Problems</title> |
530 |
<title>Common <command>cc</command> Queries and Problems</title> |
| 532 |
|
531 |
|
| 533 |
<para>Q. I am trying to write a program which uses the |
532 |
<para>Q. I am trying to write a program which uses the |
|
Lines 740-753
Link Here
|
| 740 |
<symbol>SIGABRT</symbol>, there are several other signals which have |
739 |
<symbol>SIGABRT</symbol>, there are several other signals which have |
| 741 |
a similar effect.</para> |
740 |
a similar effect.</para> |
| 742 |
|
741 |
|
|
|
742 |
</sect2> |
| 743 |
</sect1> |
743 |
</sect1> |
| 744 |
</chapter> |
|
|
| 745 |
|
744 |
|
| 746 |
|
745 |
|
| 747 |
<chapter> |
746 |
<sect1> |
| 748 |
<title>Make</title> |
747 |
<title>Make</title> |
| 749 |
|
748 |
|
| 750 |
<sect1> |
749 |
<sect2> |
| 751 |
<title>What is <command>make</command>?</title> |
750 |
<title>What is <command>make</command>?</title> |
| 752 |
|
751 |
|
| 753 |
<para>When you're working on a simple program with only one or two source |
752 |
<para>When you're working on a simple program with only one or two source |
|
Lines 800-808
Link Here
|
| 800 |
are often used for documentation files like |
799 |
are often used for documentation files like |
| 801 |
<filename>README</filename>.</para></footnote></para> |
800 |
<filename>README</filename>.</para></footnote></para> |
| 802 |
|
801 |
|
| 803 |
</sect1> |
802 |
</sect2> |
| 804 |
|
803 |
|
| 805 |
<sect1> |
804 |
<sect2> |
| 806 |
<title>Example of using <command>make</command></title> |
805 |
<title>Example of using <command>make</command></title> |
| 807 |
|
806 |
|
| 808 |
<para>Here's a very simple make file: |
807 |
<para>Here's a very simple make file: |
|
Lines 878-886
Link Here
|
| 878 |
very useful here—it changes the date on a file without you |
877 |
very useful here—it changes the date on a file without you |
| 879 |
having to edit it.</para> |
878 |
having to edit it.</para> |
| 880 |
|
879 |
|
| 881 |
</sect1> |
880 |
</sect2> |
| 882 |
|
881 |
|
| 883 |
<sect1> |
882 |
<sect2> |
| 884 |
<title>FreeBSD Makefiles</title> |
883 |
<title>FreeBSD Makefiles</title> |
| 885 |
|
884 |
|
| 886 |
<para>Makefiles can be rather complicated to write. Fortunately, |
885 |
<para>Makefiles can be rather complicated to write. Fortunately, |
|
Lines 951-959
Link Here
|
| 951 |
complicated (and if you do look at them, make sure you have a flask |
950 |
complicated (and if you do look at them, make sure you have a flask |
| 952 |
of strong coffee handy!)</para> |
951 |
of strong coffee handy!)</para> |
| 953 |
|
952 |
|
| 954 |
</sect1> |
953 |
</sect2> |
| 955 |
|
954 |
|
| 956 |
<sect1> |
955 |
<sect2> |
| 957 |
<title>More advanced uses of <command>make</command></title> |
956 |
<title>More advanced uses of <command>make</command></title> |
| 958 |
|
957 |
|
| 959 |
<para><command>Make</command> is a very powerful tool, and can do much |
958 |
<para><command>Make</command> is a very powerful tool, and can do much |
|
Lines 987-999
Link Here
|
| 987 |
<application>Emacs</application>, do <userinput>C-h |
986 |
<application>Emacs</application>, do <userinput>C-h |
| 988 |
i</userinput>).</para> |
987 |
i</userinput>).</para> |
| 989 |
|
988 |
|
|
|
989 |
</sect2> |
| 990 |
</sect1> |
990 |
</sect1> |
| 991 |
</chapter> |
|
|
| 992 |
|
991 |
|
| 993 |
<chapter id="debugging"> |
992 |
<sect1 id="debugging"> |
| 994 |
<title>Debugging</title> |
993 |
<title>Debugging</title> |
| 995 |
|
994 |
|
| 996 |
<sect1> |
995 |
<sect2> |
| 997 |
<title>The Debugger</title> |
996 |
<title>The Debugger</title> |
| 998 |
|
997 |
|
| 999 |
<para>The debugger that comes with FreeBSD is called |
998 |
<para>The debugger that comes with FreeBSD is called |
|
Lines 1026-1034
Link Here
|
| 1026 |
<command>gdb</command> and does not cover specialised topics such as |
1025 |
<command>gdb</command> and does not cover specialised topics such as |
| 1027 |
debugging the kernel.</para> |
1026 |
debugging the kernel.</para> |
| 1028 |
|
1027 |
|
| 1029 |
</sect1> |
1028 |
</sect2> |
| 1030 |
|
1029 |
|
| 1031 |
<sect1> |
1030 |
<sect2> |
| 1032 |
<title>Running a program in the debugger</title> |
1031 |
<title>Running a program in the debugger</title> |
| 1033 |
|
1032 |
|
| 1034 |
<para>You'll need to have compiled the program with the |
1033 |
<para>You'll need to have compiled the program with the |
|
Lines 1138-1146
Link Here
|
| 1138 |
information about the arguments passed to functions and where to go |
1137 |
information about the arguments passed to functions and where to go |
| 1139 |
when it returns from a function call).</para></note> |
1138 |
when it returns from a function call).</para></note> |
| 1140 |
|
1139 |
|
| 1141 |
</sect1> |
1140 |
</sect2> |
| 1142 |
|
1141 |
|
| 1143 |
<sect1> |
1142 |
<sect2> |
| 1144 |
<title>Examining a core file</title> |
1143 |
<title>Examining a core file</title> |
| 1145 |
|
1144 |
|
| 1146 |
<para>A core file is basically a file which contains the complete |
1145 |
<para>A core file is basically a file which contains the complete |
|
Lines 1191-1199
Link Here
|
| 1191 |
a program crashes; in this case, the <function>bazz()</function> |
1190 |
a program crashes; in this case, the <function>bazz()</function> |
| 1192 |
function was called from <function>main()</function>.</para> |
1191 |
function was called from <function>main()</function>.</para> |
| 1193 |
|
1192 |
|
| 1194 |
</sect1> |
1193 |
</sect2> |
| 1195 |
|
1194 |
|
| 1196 |
<sect1> |
1195 |
<sect2> |
| 1197 |
<title>Attaching to a running program</title> |
1196 |
<title>Attaching to a running program</title> |
| 1198 |
|
1197 |
|
| 1199 |
<para>One of the neatest features about <command>gdb</command> is |
1198 |
<para>One of the neatest features about <command>gdb</command> is |
|
Lines 1227-1239
Link Here
|
| 1227 |
<symbol>PauseMode</symbol> to <literal>0</literal>, and |
1226 |
<symbol>PauseMode</symbol> to <literal>0</literal>, and |
| 1228 |
wait for the <function>sleep()</function> call to return!</para> |
1227 |
wait for the <function>sleep()</function> call to return!</para> |
| 1229 |
|
1228 |
|
|
|
1229 |
</sect2> |
| 1230 |
</sect1> |
1230 |
</sect1> |
| 1231 |
</chapter> |
|
|
| 1232 |
|
1231 |
|
| 1233 |
<chapter id="emacs"> |
1232 |
<sect1 id="emacs"> |
| 1234 |
<title>Using Emacs as a Development Environment</title> |
1233 |
<title>Using Emacs as a Development Environment</title> |
| 1235 |
|
1234 |
|
| 1236 |
<sect1> |
1235 |
<sect2> |
| 1237 |
<title>Emacs</title> |
1236 |
<title>Emacs</title> |
| 1238 |
|
1237 |
|
| 1239 |
<para>Unfortunately, Unix systems don't come with the kind of |
1238 |
<para>Unfortunately, Unix systems don't come with the kind of |
|
Lines 1354-1362
Link Here
|
| 1354 |
background, and is only really useful if you're on a system which |
1353 |
background, and is only really useful if you're on a system which |
| 1355 |
doesn't have virtual terminals).</para> |
1354 |
doesn't have virtual terminals).</para> |
| 1356 |
|
1355 |
|
| 1357 |
</sect1> |
1356 |
</sect2> |
| 1358 |
|
1357 |
|
| 1359 |
<sect1> |
1358 |
<sect2> |
| 1360 |
<title>Configuring Emacs</title> |
1359 |
<title>Configuring Emacs</title> |
| 1361 |
|
1360 |
|
| 1362 |
<para>Emacs does many wonderful things; some of them are built in, |
1361 |
<para>Emacs does many wonderful things; some of them are built in, |
|
Lines 1379-1387
Link Here
|
| 1379 |
it's already running; it will read the commands from the file and |
1378 |
it's already running; it will read the commands from the file and |
| 1380 |
(hopefully) give you a useful basic setup.</para> |
1379 |
(hopefully) give you a useful basic setup.</para> |
| 1381 |
|
1380 |
|
| 1382 |
</sect1> |
1381 |
</sect2> |
| 1383 |
|
1382 |
|
| 1384 |
<sect1> |
1383 |
<sect2> |
| 1385 |
<title>A sample <filename>.emacs</filename> file</title> |
1384 |
<title>A sample <filename>.emacs</filename> file</title> |
| 1386 |
|
1385 |
|
| 1387 |
<para>Unfortunately, there's far too much here to explain it in detail; |
1386 |
<para>Unfortunately, there's far too much here to explain it in detail; |
|
Lines 1720-1728
Link Here
|
| 1720 |
</screen> |
1719 |
</screen> |
| 1721 |
</example> |
1720 |
</example> |
| 1722 |
|
1721 |
|
| 1723 |
</sect1> |
1722 |
</sect2> |
| 1724 |
|
1723 |
|
| 1725 |
<sect1> |
1724 |
<sect2> |
| 1726 |
<title>Extending the Range of Languages Emacs Understands</title> |
1725 |
<title>Extending the Range of Languages Emacs Understands</title> |
| 1727 |
|
1726 |
|
| 1728 |
<para>Now, this is all very well if you only want to program in the |
1727 |
<para>Now, this is all very well if you only want to program in the |
|
Lines 1782-1791
Link Here
|
| 1782 |
<function>my-scheme-mode-hook</function> for a simple example that |
1781 |
<function>my-scheme-mode-hook</function> for a simple example that |
| 1783 |
adds <function>auto-indent</function>).</para> |
1782 |
adds <function>auto-indent</function>).</para> |
| 1784 |
|
1783 |
|
|
|
1784 |
</sect2> |
| 1785 |
</sect1> |
1785 |
</sect1> |
| 1786 |
</chapter> |
|
|
| 1787 |
|
1786 |
|
| 1788 |
<chapter> |
1787 |
<sect1> |
| 1789 |
<title>Further Reading</title> |
1788 |
<title>Further Reading</title> |
| 1790 |
|
1789 |
|
| 1791 |
<itemizedlist> |
1790 |
<itemizedlist> |
|
Lines 1831-1835
Link Here
|
| 1831 |
|
1830 |
|
| 1832 |
</itemizedlist> |
1831 |
</itemizedlist> |
| 1833 |
|
1832 |
|
| 1834 |
</chapter> |
1833 |
</sect1> |
| 1835 |
</book> |
1834 |
</article> |