25.4 Compiling the library. 4tH 4tH Forth compiler
Реклама
Реклама
CHAPTER 25. COMPILING THE SOURCE 478
The 4th program is a do-all compiler. It compiles the source, executes it and if you made a programming error it will decompile whatever it could compile. You can also load existing objects or save new objects. It takes at least two arguments, which are the command string and the 4tH-program. In Linux, OS/X or other unices, entering: make su make install should do the trick. Most MS-DOS compilers contain a version of ‘make‘, but you probably have to recreate the makefile. Otherwise, compile it with: cc $(CFLAGS) -O -o 4th 4th.c open_4th.c comp_4th.c exec_4th.c
dump_4th.c load_4th.c save_4th.c errs_4th.c name_4th.c free_4th.c
cgen_4th.c str2cell.c
If your compiler does not support a command line interface, you have to include these files: free_4th.c
errs_4th.c
name_4th.c
dump_4th.c
exec_4th.c
load_4th.c
save_4th.c
comp_4th.c
open_4th.c
cgen_4th.c
str2cell.c
4th.c
25.4
Compiling the library
If you want to add the 4tH compiler to your own programs, I strongly advise you to create a library. As a matter of fact, I will assume that you have created the library later on. The library uses only a handful of functions, so it is feasible to create the library manually.
However, we advise you to use the Makefile
1
. Carefully check all macros. In Linux,
OS/X or other unices, entering: make su make install should do the trick. Most MS-DOS compilers contain a version of make, but you probably have to recreate the Makefile. The library consists of 11 functions: comp_4th() exec_4th() dump_4th() free_4th() save_4th() load_4th() errs_4th[] name_4th[] open_4th() cgen_4th() str2cell()
1
See section 25.5.
Завантажити
Реклама