summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés M <andmarti1424@users.noreply.github.com>2021-03-07 11:44:24 -0300
committerGitHub <noreply@github.com>2021-03-07 11:44:24 -0300
commitf942458ecfbb8014146af1825311adb1b1cbfec1 (patch)
tree79cb2c602048c563409f18a7bff2a1fc9761e312
parenta2dd8aa00b87f40a678c8e7ff04cd6178693d77a (diff)
parentfbba833dbb2dc65d41c8275d73ee2ca1cf9c6ddb (diff)
Merge pull request #390 from mipmip/pr-yacc-morescriptcommands
Pr yacc morescriptcommands
-rwxr-xr-xsrc/doc21
-rwxr-xr-xsrc/gram.y13
-rw-r--r--src/main.c10
3 files changed, 32 insertions, 12 deletions
diff --git a/src/doc b/src/doc
index 9574e7f..c53730c 100755
--- a/src/doc
+++ b/src/doc
@@ -1595,22 +1595,31 @@ Commands for handling cell content:
EXECUTE "load /tmp/test.csv"
RECALC
- Recalculates a formulas in all cells
+ Recalculates a formulas in all cells.
GETNUM {[COL][ROW]}
- Get numeric value from cell and print to STDOUT
+ Get numeric value from cell and print to STDOUT.
GETSTRING {[COL][ROW]}
- Get text value from cell and print to STDOUT
+ Get text value from cell and print to STDOUT.
GETEXP {[COL][ROW]}
- Get expression from cell and print to STDOUT
+ Get expression from cell and print to STDOUT.
GETFORMAT {COL}
- Get format from cell and print to STDOUT
+ Get format from cell and print to STDOUT.
GETFMT {[COL][ROW]}
- Get format from cell and print to STDOUT
+ Get format from cell and print to STDOUT.
+
+ DELETECOL {COL}
+ Delete column. Example: DELETECOL B
+
+ DELETEROW {NUMBER}
+ Delete row, starts at 0. Example: DELETEROW 2 (deletes third row)
+
+ VALUEIZEALL
+ Converts expressions to values in all cells.
QUIT
Quits SC-IM.
diff --git a/src/gram.y b/src/gram.y
index c8633af..4ec599a 100755
--- a/src/gram.y
+++ b/src/gram.y
@@ -90,9 +90,9 @@ int yylex();
/*
token S_INSERTCOL
token S_OPENCOL
-token S_DELETECOL
token S_YANKCOL
*/
+%token S_DELETECOL
%token S_DATEFMT
%token S_SUBTOTAL
%token S_RSUBTOTAL
@@ -163,7 +163,9 @@ token S_YANKCOL
token S_SELECT
token S_INSERTROW
token S_OPENROW
- token S_DELETEROW
+*/
+%token S_DELETEROW
+/*
token S_YANKROW
token S_PULL
token S_PULLMERGE
@@ -185,6 +187,7 @@ token S_YANKCOL
token S_PLUGIN
token S_PLUGOUT
*/
+%token S_VALUEIZEALL
%token S_SHIFT
%token S_GETNUM
%token S_GETSTRING
@@ -479,6 +482,11 @@ command:
| S_SHOW COL { show_col($2, 1); } // show de una unica columna
| S_SHOW NUMBER { show_row($2, 1); } // show de una unica fila
+/* more scripting commands */
+ | S_DELETECOL COL { deletecol($2, 1); }
+ | S_DELETEROW NUMBER { deleterow($2, 1); }
+
+
/* agregados para scim */
| S_HIDECOL COL {
hide_col($2, 1); } // hide de una unica columna
@@ -517,6 +525,7 @@ command:
currow = r < currow ? r : r < currow + arg ? currow : r - arg;
}
+ | S_VALUEIZEALL { valueize_area(0, 0, maxrow, maxcol); }
| S_SHIFT var_or_range STRING {
if (strlen($3) != 1 || ($3[0] != 'h' && $3[0] != 'j' && $3[0] != 'k' && $3[0] != 'l')) {
sc_error("wrong parameter for shift command");
diff --git a/src/main.c b/src/main.c
index f586e85..d73404b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -282,13 +282,13 @@ int main (int argc, char ** argv) {
// 2. loadrc
loadrc();
- // 3. check input from stdin (pipeline)
+ // 3. read sc file passed as argv
+ load_sc();
+
+ // 4. check input from stdin (pipeline)
// and send it to interp
read_stdin();
- // 4. read sc file passed as argv
- load_sc();
-
// change curmode to NORMAL_MODE
chg_mode('.');
@@ -576,6 +576,7 @@ void read_argv(int argc, char ** argv) {
void load_sc() {
char name[PATHLEN];
+ strcpy(name, ""); //force name to be empty
#ifdef NO_WORDEXP
size_t len;
#else
@@ -846,6 +847,7 @@ void show_usage_and_quit(){
\n --export_csv Export to csv without interaction\
\n --export_tab Export to tab without interaction\
\n --export_txt Export to txt without interaction\
+\n --export_mkd Export to markdown without interaction\
\n --external_functions Set variable 'external_functions'\
\n --half_page_scroll Set variable 'half_page_scroll'\
\n --ignorecase Set variable 'ignorecase'\