Re: [Seed7-users] Library search path
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
From: Milo M. <mm...@ym...> - 2011-03-19 15:52:11
|
This sounds great. I needed those details because I would like to make an Arch Linux User Repository (http://aur.archlinux.org) package of Seed7 and I needed to know where to put the library files. Now that I know how to specify where the interpreter should look for the standard library, I can start making the package. Thank you again for your help. -----Original Message----- From: "Thomas Mertes" <tho...@gm...> Date: Sat, 19 Mar 2011 09:29:45 To: <see...@li...> Cc: <mm...@ym...> Subject: Re: [Seed7-users] Library search path At 2011-03-18 20:43 "Thomas Mertes" <tho...@gm...> wrote: > ... The hardcoded > library directory described in paragraph 2 is determined in the > corresponding makefile and in "seed7/src/infile.c". To be more precise: The various makefiles write a line, which defines the preprocessor variable SEED7_LIBRARY, to the file "seed7/src/version.h". In my case the file "version.h" contains the line: #define SEED7_LIBRARY "/home/tm/seed7_5/lib" This preprocessor macro is used by the function init_lib_path() which is defined in the file "seed7/src/infile.c". The statements handling the hardcoded library directory start after the line #ifdef SEED7_LIBRARY The C string from SEED7_LIBRARY is converted to a Seed7 string with cstri_to_stri(). The function stri_to_path() converts the string to the standard path representation of Seed7. Finally the path is appended to the library search list (lib_path) with: append_to_lib_path(path, err_info) Note that there is also some debugging code written for the case that the macro SEED7_LIBRARY is not defined (after #else). Currently the macro SEED7_LIBRARY is always defined so this code is never executed. I plan to put there real code to handle the binary release of Seed7. The idea is: Use the path of the current executable to search for the library (include) directory. This is a little bit complex, because 3 cases must be taken into account: - The interpreter reads (analyses) a program: The absolute path of the 'hi' interpreter can be used to find the library (include) directory. - The compiler is interpeted and reads (analyses) a program: The absolute path of the 'hi' interpreter or the absolute path of the compiler source can be used to find the library (include) directory. - The compiler was compiled and reads (analyses) a program: The absolute path of the compiler executable can be used to find the library (include) directory. I wrote some functions to support getting the absolute path of an executable or Seed7 program: getProgramPath() (see: cmd_rtl.c) getArgv() (see: arr_rtl.c) getExecutablePath() (see: cmd_unx.c and cmd_win.c) examineSearchPath() (see: arr_rtl.c) What do you think about that? Greetings Thomas Mertes -- Seed7 Homepage: http://seed7.sourceforge.net Seed7 - The extensible programming language: User defined statements and operators, abstract data types, templates without special syntax, OO with interfaces and multiple dispatch, statically typed, interpreted or compiled, portable, runs under linux/unix/windows. -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl |