cmd.sc
Next: color.sc
Up: SmacLib
Previous: SmacLib
This file contains some useful UNIX commands that you
can call within the editor.
- void cmd(char * cmdline);
executes (echo ""; cd current-dir; cmdline; echo done)
in a subshell and displays its result in a Shell window. As
cmd invokes a sub-prosess, you can come back to the editor
during its execution. Only one window is used for echoing your
cmd calls. After that, if the cmd was make
or grep, you can directly go to each indicated line
(compile error line for make or matching line for
grep) with the function go_next described bellow.
- void go_next() ; just after a cmd call, goes to the first line of its result then loads in a
new window the corresponding file and places the cursor to the
beginning of the indicated line. If this file is already loaded
in a window, works in that window. Next call of this function
will parse the next line in the Shell window. This function is
bound to Ctrl-x g with C/C++, Shell and default
modes or is global to all modes if you use the .xcoralrc
provided in this distribution.
You can also use the mouse to select a line in the Shell window.
In the given file, four functions are defined to locate
file pathnames and line numbers:
- void find_cmd_trace1(); locates lines starting by a
string within double quotes, following by any characters, a number and again
any characters. For instance:
"myfile.c" syntax error line 13
- void find_cmd_trace2(); locates lines starting by a
filename, following by a colon, a number and any characters. For
instance:
myfile.c:13 SearchMe
- void find_cmd_trace3(); locates lines starting by
any characters following by a colon, a string within double
quotes, a coma, the word line, a number, another coma and any
characters. For instance:
cc : "myfile.c", line 3, syntax error
- void find_cmd_trace4(); locates the same line as
find_cmd_trace3 except that the filename is not between
double quotes. For instance:
cc : myfile.c, line 3, syntax error
Add other functions to parse desired patterns.
- void make() ; calls cmd("make -k");.
- void Make(char *args) ; calls cmd("make
args"); (see §4.2 page
).
- void grep(char * args) ; calls cmd("grep
-n <args>"); (see §4.2 page
).
- void latex() ; runs latex on the
filename of the current buffer.
- void xdvi () ; if the current filename
suffix is .tex or .latex then it runs xdvi on the
corresponding .dvi file.
Next: color.sc
Up: SmacLib
Previous: SmacLib
Lionel Fournigault
Mon Mar 6 13:33:34 MET 1995