P3(1) User Commands P3(1) NAME p3 - Parallaxis-III User Interface SYNOPSIS p3 { _o_p_t_i_o_n_s } [ _f_i_l_e ] ... DESCRIPTION p3 is the user interface of the Parallaxis-III compiler sys- tem. The purpose of p3 is to provide a useful and familiar interface between the Parallaxis compiler p3c(1) itself and the user. The usage of p3 is very similar to the usage of other known compilers such as cc(1). The Parallaxis compiler p3c converts Parallaxis-III programs to an intermediate language, namely C and/or MPL (Maspar Parallel Application Language). To get an executable pro- gram, there also has to be called a backend compiler. p3 does this process automatically, so usually you just have to invoke p3 without knowing which compiler in fact is called. Nevertheless you can control the behaviour of p3 by giving additional options. Every argument beginning with `-' is treated as an option, probably with additional parameters. Every other argument is treated as a filename. First the given filenames are checked for their extension. If a filename has no extension, p3 tries to append `.pd' and `.pm' to it and checks, if files with the resulting filenames exist. If yes, these files are added to the list of filenames. Then every file with a name ending in `.pd' or `.pm' is com- piled with p3c, where every `.pd'-file is converted to a header file with extension `.h' and every `.pm'-file is con- verted to a C source file with extension `.c' and/or to an MPL source file with extension `.m'. These resulting files and the remaining unknown files are finally passed to the backend compiler. OPTIONS -c Don't call the linker. This option is passed to the backend compiler. No library paths or libraries are put on the command line of the backend compiler. Compare with option "-p". -C Use p3c as Parallaxis compiler. This should generate C-code for simulation on a workstation. -casts Let p3c generate additional casts to make the resulting SunOS 5.4 Last change: 15 August 1994 1 P3(1) User Commands P3(1) C-programs lint compliant. -cc _n_a_m_e Use backend compiler _n_a_m_e instead of the default one. This can also be achieved by setting the environment variable P3CC. -g Let p3c generate debugging information; that's addi- tional directives in the code and a crossreference file with filename extension `.px'. This file is used by the Parallaxis debugger. This option is also passed as "-g" to the backend com- piler. -h, -H, -help Print usage of p3. -headers Generate a `.h'-header-file for each imported defini- tion module. Usually the `.pd'-files are read and included in the compilation process, but no `.h'-file is generated unless you compile a `.pd'-file for itself. -I _p_a_t_h Add _p_a_t_h to the list of import paths. This path list is used when searching for `.pd'-files. Usually the Paral- laxis standard include paths are automatically appended to this list. If you don't want this, use also option -nop3inc or -nodefaults. The resulting path list is also passed to the backend compiler for finding the header files. If you don't like this behaviour, use option -P instead of -I. -indent _i Set code indentation of p3c to _i blanks. -k _o_p_t_i_o_n Pass _o_p_t_i_o_n directly to the backend compiler. In this way you can pass options to the backend compiler which would normally be misinterpreted by p3. Example: p3 -cc gcc -k -I- _f_i_l_e If you append the option to pass directly after -k, you must omit the `-' from it, e.g. p3 -cc gcc -kI- _f_i_l_e -L _p_a_t_h Add _p_a_t_h to the list of library paths. This list is only used by the backend compiler. Usually the SunOS 5.4 Last change: 15 August 1994 2 P3(1) User Commands P3(1) Parallaxis standard library paths are automatically appended to this list. If you don't want this behaviour, use option -nop3lib or -nodefaults in addi- tion. -m, -mem Let p3c print statistics about its memory usage during compilation. -mpl, -MPL Use p3c_MPL as Parallaxis compiler. This should gen- erate C- and/or MPL-code for the MasPar computer. -n, -nocompile Don't call compilers, just print the commandlines that would be used to do so. -nop3inc Don't append Parallaxis standard import paths to the path list built by options -I and -P. Usually these paths are automatically appended. -nop3lib Don't append Parallaxis standard library paths to the path list built by option -L. Usually these paths are automatically appended. -nodefaults Synonym for `-nop3inc -nop3lib'. -o _n_a_m_e Create executable with filename _n_a_m_e instead of `a.out'. This option is simply passed to the backend compiler. -p Don't call backend compiler, do only Parallaxis compi- lation. Compare with option "-c". -P _p_a_t_h Add _p_a_t_h to the list of import paths. This path list is used when searching for .pd files. Usually the Paral- laxis standard include paths are automatically appended to this list. If you don't want this behaviour, use also option -nop3inc or -nodefaults. In difference to option -I, the resulting path list is *not* passed to the backend compiler. -pvm, -PVM Use p3c_PVM as Parallaxis compiler. This should gen- erate C-code for simulation on several workstations or the Intel Paragon using PVM. SunOS 5.4 Last change: 15 August 1994 3 P3(1) User Commands P3(1) -r, -rchecks Don't let p3c generate code for runtime range checks. By default p3c generates code to check for ranges at assignments to subrange type variables, array index references, processor element references, etc. -t, -time Let p3c print statistics about the time consumption during the Parallaxis compilation process. -tt, -total Print statistics about the time consumption during the whole compilation process, including backend compila- tion. -v Print version of p3 and the commandlines of the result- ing compiler calls. -vv Like -v, but also passes "-v" to the backend compiler. -w Don't generate warnings during Parallaxis compilation process. The backend compiler may still give warnings. -ww Like -w, but also passes "-w" to the backend compiler. OPTIONS (available if MPL output possible) -s, -small Generate a small MPL-only model. The executable must be smaller than 128KB. Usually there's created an MPL- and a C-part. Every other option is passed to the backend compiler. Parameters usually can be appended directly to the option. p3 -Ipath is the same as p3 -I path As p3 can not decide if an unknown option has parameters or not, it assumes no parameters. So you probably have to quote such options together with their parameters. E.g. p3 "-xyz parameters" FILES *.pd Definition modules. These files are con- verted to `.h'-header-files, but not propagated to the backend compiler. *.pm Implementation or program modules. These files are converted to `.c'-files SunOS 5.4 Last change: 15 August 1994 4 P3(1) User Commands P3(1) (and/or `.m'-files respectively). They are passed to the backend compiler for further compilation. /usr/local/bv/lib.sun4/libp3.a Library holding the Parallaxis related stuff for C-version. /usr/local/bv/lib.sun4/libp3_MPL.a Library holding the Parallaxis related stuff for MPL-version. /usr/local/bv/lib.sun4/libp3_PVM.a Library holding the Parallaxis related stuff for PVM-version. /usr/local/bv/include/*.h Header files for precompiled Parallaxis modules. ENVIRONMENT Usually there are meaningful defaults compiled into p3 when installed at a site. But you can override some of them by setting some environment variables. P3OPT Default options to be set on every invocation of p3. These options are prepended to the options given on the commandline, thus giving the possi- bility to override default options of P3OPT on the commandline. Example: P3OPT set to "-PVM" and p3 called with option "-C". This results in an impli- cit call of p3 with options "-PVM -C" where "-C" overrides "-PVM". The compilation will take place for C. P3INC Parallaxis standard import paths. A list of paths where to find `.pd'-files. These are automatically appended to the import path list built by options -P and -I unless one of -nop3inc or -nodefaults is given. Defaults: C-version: /usr/local/bv/include MPL-version: /usr/local/bv/include PVM-version: /usr/local/bv/include,$PVM_ROOT/include P3LIB Parallaxis standard import paths. A list of paths where to find libraries to include. These are SunOS 5.4 Last change: 15 August 1994 5 P3(1) User Commands P3(1) automatically appended to the library path list built by option -L unless one of -nop3lib or -nodefaults is given. Defaults: C-version: /usr/local/bv/lib.sun4 MPL-version: /usr/local/bv/lib.sun4 PVM-version: /usr/local/bv/lib.sun4,$PVM_ROOT/lib/$PVM_ARCH P3CC Parallaxis standard backend compiler. This com- piler is used if no option -cc is given. Defaults: C-version: gcc MPL-version: mpl_cc PVM-version: gcc When setting P3INC or P3LIB you can also give lists of paths by seperating the paths with commas, blanks, semicolons or colons. In addition, you may include other environment vari- ables in your pathlists. Note: the environment variables replace the default paths. If you like to have the default paths in addition, you have to give a pseudo path "@" some- where in your environment variable's pathlist. The "@" will be replaced by the default paths compiled into p3. Example: P3LIB = $HOME/lib,@,$PVM_ROOT/lib/$PVM_ARCH EXAMPLES Suppose you have a module system with modules a and b, each consisting of a definition and implementation module (a.pd, a.pm, b.pd, b.pm) and a program module p (p.pm). p imports from a and b, a imports from b and b imports from a globally supplied module g which resides in a library (libg.a) found in the Parallaxis standard library paths. Then you can compile the whole system by typing p3 a b p -lg which creates an executable a.out. This is equivalent to typing p3 a.pd a.pm b.pd b.pm p.pm -lg Now you change something in a.pd and in b.pm. You know you have to change also something in p.pm but you like to com- pile a and b first to see if there are any errors. But the system is not consistent at the moment, so no executable should be created. Do this by SunOS 5.4 Last change: 15 August 1994 6 P3(1) User Commands P3(1) p3 a.pd b.pm -c Here "-c" is an option passed to the backend C-compiler and prevents it from linking. Though you don't need to mention the other modules. Let's assume everything went alright and you made the changes to p.pm. Now you want again an execut- able and call it `p'. As a and b may be large modules you don't want to compile them again, so you just type p3 a.o b.o p -o p -lg Now you've discovered that the supplied library g is not exactly what you need but builds a useful basis to start an own module g. As your site provides the source code g.pd and g.pm to module g, you copy it to a new directory $HOME/newg and start your own development. After lots of work you have finished and want to compile the whole system again, now using your own module g. p3 -I $HOME/newg a.o b.o p.o $HOME/newg/g -o p note that you no longer need -lg as you don't use the global library anymore. Instead you compile your own library. But you need to give the -I for the C-compiler to find the appropriate `.h'-file generated in the same p3 call. Now you've transferred your module g to a library libg.a in the known directory $HOME/newg. (This is usually done by "ar cr libg.a g.o; ranlib libg.a".) Now you want to compile your system all over again, from start to end, using this library: p3 -I $HOME/newg a b p -o p -L $HOME/newg -lg This does not use the global library because the standard paths are checked at the end, so your own library is found first. To be sure you could also add a "-nop3lib" to the p3-call above, but this may cause other problems because the Parallaxis standard library libp3 wouldn't be found anymore. Now as you've finished your own library you always like to include it instead of the global one. So you set the environment variable P3LIB and P3INC to the newg-path. Don't forget to include at least that standard path where the Parallaxis system library resides or else the linker won't find it. Then the compiler call from above reduces to p3 a b p -o p -lg which is exactly the same as when using the global library. For bigger projects the use of make and makefiles is SunOS 5.4 Last change: 15 August 1994 7 P3(1) User Commands P3(1) recommended. SEE ALSO p3c(1). BUGS p3 does not delete old `.px'-Files when compiling. Thus an old `.px'-File may exist even when compiling without option -g. p3 is still under development. Especially the MPL part is not implemented satisfactory, as there may be two backend compilers involved. Though the part about passing arguments to the backend compiler (option -k) as well as the naming of backend compilers (option -cc, environment variable P3CC) may be subject to modification. SunOS 5.4 Last change: 15 August 1994 8