Back to Express Pearl's Homepage

Using Emacs with Express

or How to Turbo Your V-Code Productivity

Editing Modes

I'm an emacs user (there I've already annoyed a lot of people) and since I bang away at v-code directly I've written some emacs modes to help with editing and compiling Express' v-code description language.

Version 3.8.6
v-code-mode.el
Is a major mode that provides highlighting and indenting of v-code. This will prettify your v-code like a Christmas tree and do the hard work of indenting for you. Also there are a growing number of functions to insert template code and search for objects. Setup instructions are at the top of the file. Please let be know if you have any requests for additional functionality.
History:
v3.5 more font-lock additions, fixed XEmacs C++ style comments
v3.6 fixed font-lock for fixed properties with hex values,
     objects defined in files eg "my.v" MINE;
v3.7 new user functions: additional v-code-strip-ne-XXX, v-code-insert-ref-to-top,
     v-code-find-object, v-code-get-object-path
     tweaked font-lock re's
v3.7.1 v-code-get-object-path now copes with '_' in names
v3.8 added menu and new functions v-code-insert-XXX
     extended keymap
     updated docs
v3.8.1 added func and virtual to font-lock
v3.8.2 easy-menu is failing under XEmacs and has been temporarily disabled for XEmacs
       altered default insert code and moved generic UI to UIobject    
v3.8.3 added menu and shortcuts to insert UIfield and UItext
       changed tidied up insert text
       added attributes [IO]Port[2]
v3.8.4 added menu support for XEmacs; easymenu is called auc-menu !?
v3.8.5 added NElink to datatype list
       set fill-paragraph (M-q) to use c-fill-paragraph function
v3.8.6 added data_method datatype list
       directive values highlighted in font-lock-variable-name-face
       NElink highlight was broke
Version 1.0
parse-v.el
Is a minor mode that allows you to parse the v-code for your current project, display any errors and then take you to them by clicking on the error in the same way as the compile minor mode works for C/C++, in fact its based on the compile.el source so check out the help for compile for information.
To get started, while editing a v file in your project type M-x parse-v, you will be presented with the command to run, usually base -sync-libs -exit. This will parse all the v in your current project, it does this by searching up the directory structure until it finds an avsenv file or reaches your home directory (either "~" or "$HOME"). This fails under Win32 if you are not using UN*X style paths currently. If you wish to parse a v file that isn't at some point referenced by your templ.v eg an application file, modify the command as so base -sync-libs <v_file> -exit.
History:
v1.0beta - first release
v1.0 - fixed silly bug in avsenv location code 
     - fixed inf loop bug in avsenv location code for UN*X style paths
    

Tag Generation for V code

Tags are bookmarks to pieces of useful information usually in a set of source files. Emacs uses the TAGS file to search for a given string. i.e., if you generate tags from a libXXX.h then in your source you can search for the declaration of function foobar by simply placing the cursor of foobar and press M-., the file will be loaded at the appropriate position. Tags are generated with an external program etags which knows about several programming languages but not v-code. Fortunately you can provide regular expressions to locate the items you wished to be tagged. Please refer to the Emacs Manual and etags man page for more information.

To generate v-code TAGS file we wish to locate the declaration of container objects such as macros and modules etc., below is what the regular expression searches for in English an case anyone can write a better regexp:

skip whitespace
match either app flibrary group library macro module
possibly follow by a + and then any alphanumeric characters or + or _
skip whitespace
match all up to whitespace, <, ( or { /* the actual object name */
skip whitespace

To generate a v-code TAGS file for a given set of files use:

etags --regex='/[ \t]*\(app\|flibrary\|group\|library\|m\(acro\|odule\)\)\+?[a-zA-Z0-9+_]*[ \t]*\([^<({ ]*[ \t]*\)/' <v-code files>

For the installed v-code files use:

find $XP_ROOT -name "*.v" -print |etags --regex='/[ \t]*\(app\|flibrary\|group\|library\|m\(acro\|odule\)\)\+?[a-zA-Z0-9+_]*[ \t]*\([^<({ ]*[ \t]*\)/' -

these will both write a file TAGS in the current directory, use -o <outfile> (before the "-") to place in another file.

Note i: some objects are contained in .vo files and so you can't look at their v-code definitions

Note ii: some objects are made up of combinations of others e.g. UIpanel+UImodule_init UImod_panel, one could add these to the search but you'd also get things like Mesh+Node_Data field_in which occur lots of times

Note iii: for Win32 platforms Cygwin provides an etags implementation

Note iv: you can also generate tags for vi using ctags instead of etags but I haven't tried