diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/utilities/nttools/tedit/edit.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/utilities/nttools/tedit/edit.x')
-rw-r--r-- | pkg/utilities/nttools/tedit/edit.x | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/tedit/edit.x b/pkg/utilities/nttools/tedit/edit.x new file mode 100644 index 00000000..8fe14a87 --- /dev/null +++ b/pkg/utilities/nttools/tedit/edit.x @@ -0,0 +1,70 @@ +include "command.h" + +# EDIT -- Main procedure of table editor + +procedure edit (table, columns, silent, rdonly, inplace) + +char table[ARB] # i: SDAS table name +char columns[ARB] # i: list of columns to edit +bool silent # i: don't ring bell when error occurs +bool rdonly # i: edit table read only +bool inplace # i: edit table in place +#-- +int nargs, code +pointer sp, scr, command, arglist + +begin + call smark (sp) + call salloc (command, SZ_LINE, TY_CHAR) + call salloc (arglist, SZ_LINE, TY_CHAR) + + call init_cmd (silent) + call init_screen (table, columns, rdonly, inplace, scr) + call help_prompt (scr, NO) + + repeat { + call edit_screen (scr) + call read_prompt ("Command:", Memc[command], SZ_LINE) + call parse_cmd (Memc[command], code, nargs, Memc[arglist], SZ_LINE) + + if (nargs > 0) { + switch (code) { + case TED_ADD: + call add_cmd (scr, nargs, Memc[arglist]) + case TED_COPY: + call copy_cmd (scr, nargs, Memc[arglist]) + case TED_DELETE: + call delete_cmd (scr, nargs, Memc[arglist]) + case TED_EXIT: + call exit_cmd (scr, nargs, Memc[arglist]) + break + case TED_FIND: + call find_cmd (scr, nargs, Memc[arglist]) + case TED_GOTO: + call goto_cmd (scr, nargs, Memc[arglist]) + case TED_HELP: + call help_cmd (scr, nargs, Memc[arglist]) + case TED_INSERT: + call insert_cmd (scr, nargs, Memc[arglist]) + case TED_LOWER: + call lower_cmd (scr, nargs, Memc[arglist]) + case TED_NEXT: + call next_cmd (scr, nargs, Memc[arglist]) + case TED_QUIT: + call quit_cmd (scr, nargs, Memc[arglist]) + break + case TED_SET: + call set_cmd (scr, nargs, Memc[arglist]) + case TED_SUBSTITUTE: + call sub_cmd (scr, nargs, Memc[arglist]) + case TED_UPPER: + call upper_cmd (scr, nargs, Memc[arglist]) + default: + call help_prompt (scr, YES) + } + } + } + + call end_screen + call sfree (sp) +end |