vimports - print the models imported directly and indirectly by a Vesta model
vimports [ -depth num ] [ -show name [ depth ] ]... [ -elide name ]... [ -plain ] [ model ]
vimports displays the names of all models directly and indirectly imported by model. If no model is specified, it defaults to ".main.ves".
The import relation on models forms a directed acyclic graph, or DAG. However, vimports flattens the DAG into a tree: the sub-DAG rooted at any model with multiple parents is printed multiple times, once for each visited parent. Indentation is used to indicated depth in the import tree.
The model argument is resolved according to the rules for import clauses as specified in The Vesta-2 Software Description Language. In particular, if model is not an absolute path, it is interpreted relative to the current working directory. If model names a directory, the string "/build.ves" is appended to it; otherwise, if it does not end in ".ves", that extension is appened to it.
- -depth num
- By default, the complete import tree is displayed. If -depth num is specified, only those models with depth at most num in the import tree are displayed. The depth of the root model is zero. When -depth is specified, elipses are printed after the names of those models at depth num that contain elided imports.
- -show name [ depth ]
- If the complete pathname of a model containing the string name is printed, the subtree rooted at that model is displayed to a depth of depth (where the subtree depth is counted relative to the subtree root); if depth is negative or omitted, the complete subtree is printed.
Multiple -show clauses may be specified. If two or more different -show clauses apply to the same model, the maximum elision depth over the matching clauses is used (where a negative or omitted depth is taken to mean infinity in the maximum calculation).
- -elide name
- All imports of any pathname containing the string name are elided. This is like "show name 0", except that if both -show and -elide clauses apply to the same model, the -elide clauses take precedence. Multiple -elide clauses may be specified.
- -plain
- With -plain, import paths will be printed without any decoration (i.e. no leading indentation to show the nesting level and no following "..."). Also, each path will be printed only once. This option is useful for getting a list of all the imported models. A common use is to then process the imported model files individually (e.g. search them for a string).
The following exit values are returned:
- 0 : Successful completion.
- 1 : Command line parsing error.
- 2 : A model file referred to by an import clause did not exist.
- 3 : Model file parsing error.
- 4 : Filesystem operation error (e.g. error reading a model file).
Here are examples of running vimports on its own control panel model with various depth thresholds.
$ vimports -depth 0 .main.ves /vesta-work/heydon/vimports/.main.ves... $ vimports -depth 1 .main.ves /vesta-work/heydon/vimports/.main.ves | /vesta-work/heydon/vimports/build.ves... | /vesta/src.dec.com/common/std_env/42/build.ves... $ vimports -depth 2 .main.ves /vesta-work/heydon/vimports/.main.ves | /vesta-work/heydon/vimports/build.ves | | /vesta-work/heydon/vimports/src/progs.ves... | | /vesta-work/heydon/vimports/src/docs.ves | /vesta/src.dec.com/common/std_env/42/build.ves | | /vesta/src.dec.com/common/bridge_generics/11/build.ves | | /vesta/src.dec.com/common/c/3/build.ves | | /vesta/src.dec.com/common/cxx/25/build.ves... | | /vesta/src.dec.com/common/m3/10/build.ves... | | /vesta/src.dec.com/common/lex/2/build.ves... | | /vesta/src.dec.com/common/yacc/3/build.ves... | | /vesta/src.dec.com/common/lim/6/build.ves... | | /vesta/src.dec.com/common/mtex/7/build.ves... | | /vesta/src.dec.com/common/etp/1/build.ves... | | /vesta/src.dec.com/common/std_env/39.backstop/3/build.ves... | | /vesta/src.dec.com/c/X11/1/build.ves... | | /vesta/src.dec.com/c/yacc/2/build.ves... | | /vesta/src.dec.com/c/lex/2/build.ves... | | /vesta/src.dec.com/c/gc/7/build.ves... | | /vesta/src.dec.com/c/math/5/build.ves... | | /vesta/src.dec.com/c/libcxx/2/build.ves... | | /vesta/src.dec.com/c/pthreads/5/build.ves... | | /vesta/src.dec.com/c/mach/5/build.ves... | | /vesta/src.dec.com/c/exc/2/build.ves... | | /vesta/src.dec.com/c/libc/6/build.ves... | | /vesta/src.dec.com/vesta/vesta_umb/28/build.ves... | | /vesta/src.dec.com/m3/libumb/2/build.ves... | | /vesta/src.dec.com/m3/juno-umbrella/3/build.ves...To see the direct imports for the "vesta_umb" model in the last listing, a -show clause can be used:$ vimports -depth 2 -show vesta_umb 1 .main.ves /vesta-work/heydon/vimports/.main.ves | /vesta-work/heydon/vimports/build.ves | | /vesta-work/heydon/vimports/src/progs.ves... | | /vesta-work/heydon/vimports/src/docs.ves | /vesta/src.dec.com/common/std_env/42/build.ves | | /vesta/src.dec.com/common/bridge_generics/11/build.ves | | /vesta/src.dec.com/common/c/3/build.ves | | /vesta/src.dec.com/common/cxx/25/build.ves... | | /vesta/src.dec.com/common/m3/10/build.ves... | | /vesta/src.dec.com/common/lex/2/build.ves... | | /vesta/src.dec.com/common/yacc/3/build.ves... | | /vesta/src.dec.com/common/lim/6/build.ves... | | /vesta/src.dec.com/common/mtex/7/build.ves... | | /vesta/src.dec.com/common/etp/1/build.ves... | | /vesta/src.dec.com/common/std_env/39.backstop/3/build.ves... | | /vesta/src.dec.com/c/X11/1/build.ves... | | /vesta/src.dec.com/c/yacc/2/build.ves... | | /vesta/src.dec.com/c/lex/2/build.ves... | | /vesta/src.dec.com/c/gc/7/build.ves... | | /vesta/src.dec.com/c/math/5/build.ves... | | /vesta/src.dec.com/c/libcxx/2/build.ves... | | /vesta/src.dec.com/c/pthreads/5/build.ves... | | /vesta/src.dec.com/c/mach/5/build.ves... | | /vesta/src.dec.com/c/exc/2/build.ves... | | /vesta/src.dec.com/c/libc/6/build.ves... | | /vesta/src.dec.com/vesta/vesta_umb/28/build.ves | | | /vesta/src.dec.com/vesta/run_tool/13/build.ves... | | | /vesta/src.dec.com/vesta/cache/28/build.ves... | | | /vesta/src.dec.com/vesta/repos/16/build.ves... | | | /vesta/src.dec.com/vesta/fp/12/build.ves... | | | /vesta/src.dec.com/vesta/log/15/build.ves... | | | /vesta/src.dec.com/vesta/srpc/12/build.ves... | | | /vesta/src.dec.com/vesta/config/11/build.ves... | | | /vesta/src.dec.com/vesta/basics/39/build.ves... | | /vesta/src.dec.com/m3/libumb/2/build.ves... | | /vesta/src.dec.com/m3/juno-umbrella/3/build.ves...To search the imported models for a string (e.g. where a particular bridge is used or where a message orginates) one can use -plain combined with the standard grep(1) utility:$ vimports -plain linux_i386.main.ves | xargs grep './lex/lex' /vesta/vestasys.org/bridges/lim/2/src/prog.ves: lex_res_c = ./lex/lex(lex_source, "llim");
This page was generated automatically by mtex software.Allan Heydon (caheydon@yahoo.com)
Created on Wed Jul 2 16:15:20 PDT 1997 by heydon