mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-18 00:45:47 +00:00
rename PI and E to M_PI and M_E
This commit is contained in:
parent
cb7f966f81
commit
ddff0b7e7b
13 changed files with 92 additions and 90 deletions
|
|
@ -20,6 +20,8 @@ for those times when you want integer overflow.
|
|||
an alias for `--nidx --fs tab`, and `mlr -t` is an alias for `mlr
|
||||
--tsvlite`.
|
||||
|
||||
* The mathematical constants pi and e have been renamed from `PI` and `E` to `M_PI` and `M_E`, respectively. (It's annoying to get a syntax error when you try to define a variable named `E` in the DSL, when `A` through `D` work just fine.) This is a backward incompatibility, but not enough of us to justify calling this release Miller 6.0.0.
|
||||
|
||||
## Documentation:
|
||||
|
||||
* As noted
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ void fmgr_function_usage(fmgr_t* pfmgr, FILE* output_stream, char* function_name
|
|||
fprintf(output_stream, "numbers of the form \"%s --seed 123456789\" or \"%s --seed 0xcafefeed\".\n",
|
||||
MLR_GLOBALS.bargv0, MLR_GLOBALS.bargv0);
|
||||
fprintf(output_stream, "Miller's built-in variables are NF, NR, FNR, FILENUM, and FILENAME (awk-like)\n");
|
||||
fprintf(output_stream, "along with the mathematical constants PI and E.\n");
|
||||
fprintf(output_stream, "along with the mathematical constants M_PI and M_E.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,20 @@
|
|||
// ----------------------------------------------------------------
|
||||
typedef void keyword_usage_func_t(FILE* ostream);
|
||||
|
||||
static keyword_usage_func_t mlr_dsl_ENV_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_FILENAME_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_FILENUM_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_FNR_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_IFS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_IPS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_IRS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_M_E_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_M_PI_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_NF_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_NR_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_OFS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_OPS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_ORS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_all_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_begin_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_bool_keyword_usage;
|
||||
|
|
@ -46,20 +60,6 @@ static keyword_usage_func_t mlr_dsl_true_keyword_usage;
|
|||
static keyword_usage_func_t mlr_dsl_unset_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_var_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_while_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_E_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_ENV_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_FILENAME_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_FILENUM_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_FNR_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_IFS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_IPS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_IRS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_NF_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_NR_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_OFS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_OPS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_ORS_keyword_usage;
|
||||
static keyword_usage_func_t mlr_dsl_PI_keyword_usage;
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
typedef struct _keyword_usage_entry_t {
|
||||
|
|
@ -108,7 +108,6 @@ static keyword_usage_entry_t KEYWORD_USAGE_TABLE[] = {
|
|||
{ "unset", mlr_dsl_unset_keyword_usage },
|
||||
{ "var", mlr_dsl_var_keyword_usage },
|
||||
{ "while", mlr_dsl_while_keyword_usage },
|
||||
{ "E", mlr_dsl_E_keyword_usage },
|
||||
{ "ENV", mlr_dsl_ENV_keyword_usage },
|
||||
{ "FILENAME", mlr_dsl_FILENAME_keyword_usage },
|
||||
{ "FILENUM", mlr_dsl_FILENUM_keyword_usage },
|
||||
|
|
@ -116,12 +115,13 @@ static keyword_usage_entry_t KEYWORD_USAGE_TABLE[] = {
|
|||
{ "IFS", mlr_dsl_IFS_keyword_usage },
|
||||
{ "IPS", mlr_dsl_IPS_keyword_usage },
|
||||
{ "IRS", mlr_dsl_IRS_keyword_usage },
|
||||
{ "M_E", mlr_dsl_M_E_keyword_usage },
|
||||
{ "M_PI", mlr_dsl_M_PI_keyword_usage },
|
||||
{ "NF", mlr_dsl_NF_keyword_usage },
|
||||
{ "NR", mlr_dsl_NR_keyword_usage },
|
||||
{ "OFS", mlr_dsl_OFS_keyword_usage },
|
||||
{ "OPS", mlr_dsl_OPS_keyword_usage },
|
||||
{ "ORS", mlr_dsl_ORS_keyword_usage },
|
||||
{ "PI", mlr_dsl_PI_keyword_usage },
|
||||
|
||||
};
|
||||
static int KEYWORD_USAGE_TABLE_SIZE = sizeof(KEYWORD_USAGE_TABLE)/sizeof(KEYWORD_USAGE_TABLE[0]);
|
||||
|
|
@ -562,12 +562,6 @@ static void mlr_dsl_while_keyword_usage(FILE* ostream) {
|
|||
);
|
||||
}
|
||||
|
||||
static void mlr_dsl_E_keyword_usage(FILE *ostream) {
|
||||
fprintf(ostream,
|
||||
"E: the mathematical constant.\n"
|
||||
);
|
||||
}
|
||||
|
||||
static void mlr_dsl_ENV_keyword_usage(FILE *ostream) {
|
||||
fprintf(ostream,
|
||||
"ENV: access to environment variables by name, e.g. '$home = ENV[\"HOME\"]'\n"
|
||||
|
|
@ -614,6 +608,18 @@ static void mlr_dsl_IRS_keyword_usage(FILE *ostream) {
|
|||
);
|
||||
}
|
||||
|
||||
static void mlr_dsl_M_E_keyword_usage(FILE *ostream) {
|
||||
fprintf(ostream,
|
||||
"M_E: the mathematical constant e.\n"
|
||||
);
|
||||
}
|
||||
|
||||
static void mlr_dsl_M_PI_keyword_usage(FILE *ostream) {
|
||||
fprintf(ostream,
|
||||
"M_PI: the mathematical constant pi.\n"
|
||||
);
|
||||
}
|
||||
|
||||
static void mlr_dsl_NF_keyword_usage(FILE *ostream) {
|
||||
fprintf(ostream,
|
||||
"NF: evaluates to the number of fields in the current record.\n"
|
||||
|
|
@ -647,9 +653,3 @@ static void mlr_dsl_ORS_keyword_usage(FILE *ostream) {
|
|||
);
|
||||
}
|
||||
|
||||
static void mlr_dsl_PI_keyword_usage(FILE *ostream) {
|
||||
fprintf(ostream,
|
||||
"PI: the mathematical constant.\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -771,7 +771,7 @@ mv_t rval_evaluator_PI_func(void* pvstate, variables_t* pvars) {
|
|||
static void rval_evaluator_PI_free(rval_evaluator_t* pevaluator) {
|
||||
free(pevaluator);
|
||||
}
|
||||
rval_evaluator_t* rval_evaluator_alloc_from_PI() {
|
||||
rval_evaluator_t* rval_evaluator_alloc_from_M_PI() {
|
||||
rval_evaluator_t* pevaluator = mlr_malloc_or_die(sizeof(rval_evaluator_t));
|
||||
pevaluator->pvstate = NULL;
|
||||
pevaluator->pprocess_func = rval_evaluator_PI_func;
|
||||
|
|
@ -786,7 +786,7 @@ mv_t rval_evaluator_E_func(void* pvstate, variables_t* pvars) {
|
|||
static void rval_evaluator_E_free(rval_evaluator_t* pevaluator) {
|
||||
free(pevaluator);
|
||||
}
|
||||
rval_evaluator_t* rval_evaluator_alloc_from_E() {
|
||||
rval_evaluator_t* rval_evaluator_alloc_from_M_E() {
|
||||
rval_evaluator_t* pevaluator = mlr_malloc_or_die(sizeof(rval_evaluator_t));
|
||||
pevaluator->pvstate = NULL;
|
||||
pevaluator->pprocess_func = rval_evaluator_E_func;
|
||||
|
|
@ -901,8 +901,8 @@ rval_evaluator_t* rval_evaluator_alloc_from_context_variable(char* variable_name
|
|||
} else if (streq(variable_name, "FNR")) { return rval_evaluator_alloc_from_FNR();
|
||||
} else if (streq(variable_name, "FILENAME")) { return rval_evaluator_alloc_from_FILENAME();
|
||||
} else if (streq(variable_name, "FILENUM")) { return rval_evaluator_alloc_from_FILENUM();
|
||||
} else if (streq(variable_name, "PI")) { return rval_evaluator_alloc_from_PI();
|
||||
} else if (streq(variable_name, "E")) { return rval_evaluator_alloc_from_E();
|
||||
} else if (streq(variable_name, "M_PI")) { return rval_evaluator_alloc_from_M_PI();
|
||||
} else if (streq(variable_name, "M_E")) { return rval_evaluator_alloc_from_M_E();
|
||||
} else if (streq(variable_name, "IPS")) { return rval_evaluator_alloc_from_IPS();
|
||||
} else if (streq(variable_name, "IFS")) { return rval_evaluator_alloc_from_IFS();
|
||||
} else if (streq(variable_name, "IRS")) { return rval_evaluator_alloc_from_IRS();
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ static void shared_usage(FILE* o, char* argv0, char* verb) {
|
|||
fprintf(o, "Please use a dollar sign for field names and double-quotes for string\n");
|
||||
fprintf(o, "literals. If field names have special characters such as \".\" then you might\n");
|
||||
fprintf(o, "use braces, e.g. '${field.name}'. Miller built-in variables are\n");
|
||||
fprintf(o, "NF NR FNR FILENUM FILENAME PI E, and ENV[\"namegoeshere\"] to access environment\n");
|
||||
fprintf(o, "NF NR FNR FILENUM FILENAME M_PI M_E, and ENV[\"namegoeshere\"] to access environment\n");
|
||||
fprintf(o, "variables. The environment-variable name may be an expression, e.g. a field\n");
|
||||
fprintf(o, "value.\n");
|
||||
fprintf(o, "\n");
|
||||
|
|
|
|||
|
|
@ -425,11 +425,11 @@ false {
|
|||
*yyextra = ex_ast_node_alloc(yytext, MD_AST_NODE_TYPE_CONTEXT_VARIABLE);
|
||||
return MD_TOKEN_CONTEXT_VARIABLE;
|
||||
}
|
||||
"PI" {
|
||||
"M_PI" {
|
||||
*yyextra = ex_ast_node_alloc(yytext, MD_AST_NODE_TYPE_CONTEXT_VARIABLE);
|
||||
return MD_TOKEN_CONTEXT_VARIABLE;
|
||||
}
|
||||
"E" {
|
||||
"M_E" {
|
||||
*yyextra = ex_ast_node_alloc(yytext, MD_AST_NODE_TYPE_CONTEXT_VARIABLE);
|
||||
return MD_TOKEN_CONTEXT_VARIABLE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -550,11 +550,11 @@
|
|||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MD_AST_NODE_TYPE_CONTEXT_VARIABLE);
|
||||
return MD_TOKEN_CONTEXT_VARIABLE;
|
||||
}
|
||||
"PI" {
|
||||
"M_PI" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MD_AST_NODE_TYPE_CONTEXT_VARIABLE);
|
||||
return MD_TOKEN_CONTEXT_VARIABLE;
|
||||
}
|
||||
"E" {
|
||||
"M_E" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MD_AST_NODE_TYPE_CONTEXT_VARIABLE);
|
||||
return MD_TOKEN_CONTEXT_VARIABLE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ POKI_CARDIFY{{mlr put 'if ($x == 1) { }' # This no-op is syntactically acceptabl
|
|||
<p/>Miller has the following kinds of variables:
|
||||
|
||||
<p/> <b>Built-in variables</b> such as <tt>NF</tt>, <tt>NF</tt>,
|
||||
<tt>FILENAME</tt>, <tt>PI</tt>, and <tt>E</tt>. These are all capital letters
|
||||
<tt>FILENAME</tt>, <tt>M_PI</tt>, and <tt>M_E</tt>. These are all capital letters
|
||||
and are read-only (although some of them change value from one record to
|
||||
another).
|
||||
|
||||
|
|
@ -209,8 +209,8 @@ defined by Miller.
|
|||
<p/>Namely, Miller supports the following five built-in variables for <a
|
||||
href="reference-verbs.html#filter"><tt>filter</tt></a> and <tt>put</tt>, all <tt>awk</tt>-inspired:
|
||||
<tt>NF</tt>, <tt>NR</tt>, <tt>FNR</tt>, <tt>FILENUM</tt>, and
|
||||
<tt>FILENAME</tt>, as well as the mathematical constants <tt>PI</tt> and
|
||||
<tt>E</tt>. Lastly, the <tt>ENV</tt> hashmap allows read access to environment
|
||||
<tt>FILENAME</tt>, as well as the mathematical constants <tt>M_PI</tt> and
|
||||
<tt>M_E</tt>. Lastly, the <tt>ENV</tt> hashmap allows read access to environment
|
||||
variables, e.g. <tt>ENV["HOME"]</tt> or <tt>ENV["foo_".$hostname]</tt>.
|
||||
|
||||
POKI_RUN_COMMAND{{mlr filter 'FNR == 2' data/small*}}HERE
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ VERBS
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
@ -1013,7 +1013,7 @@ VERBS
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
@ -2232,9 +2232,6 @@ KEYWORDS FOR PUT AND FILTER
|
|||
while: introduces a while loop, or with "do", introduces a do-while loop.
|
||||
The body statements must be wrapped in curly braces.
|
||||
|
||||
E
|
||||
E: the mathematical constant.
|
||||
|
||||
ENV
|
||||
ENV: access to environment variables by name, e.g. '$home = ENV["HOME"]'
|
||||
|
||||
|
|
@ -2260,6 +2257,12 @@ KEYWORDS FOR PUT AND FILTER
|
|||
or to LF or CRLF from the input data if in autodetect mode (which is
|
||||
the default).
|
||||
|
||||
M_E
|
||||
M_E: the mathematical constant e.
|
||||
|
||||
M_PI
|
||||
M_PI: the mathematical constant pi.
|
||||
|
||||
NF
|
||||
NF: evaluates to the number of fields in the current record.
|
||||
|
||||
|
|
@ -2278,9 +2281,6 @@ KEYWORDS FOR PUT AND FILTER
|
|||
or to LF or CRLF from the input data if in autodetect mode (which is
|
||||
the default).
|
||||
|
||||
PI
|
||||
PI: the mathematical constant.
|
||||
|
||||
AUTHOR
|
||||
Miller is written by John Kerl <kerl.john.r@gmail.com>.
|
||||
|
||||
|
|
@ -2294,7 +2294,7 @@ SEE ALSO
|
|||
|
||||
|
||||
|
||||
2017-11-18 MILLER(1)
|
||||
2017-12-19 MILLER(1)
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ VERBS
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
@ -819,7 +819,7 @@ VERBS
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
@ -2038,9 +2038,6 @@ KEYWORDS FOR PUT AND FILTER
|
|||
while: introduces a while loop, or with "do", introduces a do-while loop.
|
||||
The body statements must be wrapped in curly braces.
|
||||
|
||||
E
|
||||
E: the mathematical constant.
|
||||
|
||||
ENV
|
||||
ENV: access to environment variables by name, e.g. '$home = ENV["HOME"]'
|
||||
|
||||
|
|
@ -2066,6 +2063,12 @@ KEYWORDS FOR PUT AND FILTER
|
|||
or to LF or CRLF from the input data if in autodetect mode (which is
|
||||
the default).
|
||||
|
||||
M_E
|
||||
M_E: the mathematical constant e.
|
||||
|
||||
M_PI
|
||||
M_PI: the mathematical constant pi.
|
||||
|
||||
NF
|
||||
NF: evaluates to the number of fields in the current record.
|
||||
|
||||
|
|
@ -2084,9 +2087,6 @@ KEYWORDS FOR PUT AND FILTER
|
|||
or to LF or CRLF from the input data if in autodetect mode (which is
|
||||
the default).
|
||||
|
||||
PI
|
||||
PI: the mathematical constant.
|
||||
|
||||
AUTHOR
|
||||
Miller is written by John Kerl <kerl.john.r@gmail.com>.
|
||||
|
||||
|
|
@ -2100,4 +2100,4 @@ SEE ALSO
|
|||
|
||||
|
||||
|
||||
2017-11-18 MILLER(1)
|
||||
2017-12-19 MILLER(1)
|
||||
|
|
|
|||
44
doc/mlr.1
44
doc/mlr.1
|
|
@ -2,12 +2,12 @@
|
|||
.\" Title: mlr
|
||||
.\" Author: [see the "AUTHOR" section]
|
||||
.\" Generator: ./mkman.rb
|
||||
.\" Date: 2017-11-18
|
||||
.\" Date: 2017-12-19
|
||||
.\" Manual: \ \&
|
||||
.\" Source: \ \&
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "MILLER" "1" "2017-11-18" "\ \&" "\ \&"
|
||||
.TH "MILLER" "1" "2017-12-19" "\ \&" "\ \&"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Portability definitions
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -642,7 +642,7 @@ Other options:
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
@ -1068,7 +1068,7 @@ Other options:
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
@ -3538,15 +3538,6 @@ The body statements must be wrapped in curly braces.
|
|||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "E"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
.\}
|
||||
.nf
|
||||
E: the mathematical constant.
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "ENV"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
|
|
@ -3614,6 +3605,24 @@ the default).
|
|||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "M_E"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
.\}
|
||||
.nf
|
||||
M_E: the mathematical constant e.
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "M_PI"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
.\}
|
||||
.nf
|
||||
M_PI: the mathematical constant pi.
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "NF"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
|
|
@ -3662,15 +3671,6 @@ the default).
|
|||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SS "PI"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
.\}
|
||||
.nf
|
||||
PI: the mathematical constant.
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SH "AUTHOR"
|
||||
.sp
|
||||
Miller is written by John Kerl <kerl.john.r@gmail.com>.
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ mlr put 'if ($x == 1) { }' # This no-op is syntactically acceptable
|
|||
<p/>Miller has the following kinds of variables:
|
||||
|
||||
<p/> <b>Built-in variables</b> such as <tt>NF</tt>, <tt>NF</tt>,
|
||||
<tt>FILENAME</tt>, <tt>PI</tt>, and <tt>E</tt>. These are all capital letters
|
||||
<tt>FILENAME</tt>, <tt>M_PI</tt>, and <tt>M_E</tt>. These are all capital letters
|
||||
and are read-only (although some of them change value from one record to
|
||||
another).
|
||||
|
||||
|
|
@ -832,8 +832,8 @@ defined by Miller.
|
|||
<p/>Namely, Miller supports the following five built-in variables for <a
|
||||
href="reference-verbs.html#filter"><tt>filter</tt></a> and <tt>put</tt>, all <tt>awk</tt>-inspired:
|
||||
<tt>NF</tt>, <tt>NR</tt>, <tt>FNR</tt>, <tt>FILENUM</tt>, and
|
||||
<tt>FILENAME</tt>, as well as the mathematical constants <tt>PI</tt> and
|
||||
<tt>E</tt>. Lastly, the <tt>ENV</tt> hashmap allows read access to environment
|
||||
<tt>FILENAME</tt>, as well as the mathematical constants <tt>M_PI</tt> and
|
||||
<tt>M_E</tt>. Lastly, the <tt>ENV</tt> hashmap allows read access to environment
|
||||
variables, e.g. <tt>ENV["HOME"]</tt> or <tt>ENV["foo_".$hostname]</tt>.
|
||||
|
||||
<p/>
|
||||
|
|
@ -2007,8 +2007,6 @@ Examples: 'var a=1', 'var xyz=""'
|
|||
while: introduces a while loop, or with "do", introduces a do-while loop.
|
||||
The body statements must be wrapped in curly braces.
|
||||
|
||||
E: the mathematical constant.
|
||||
|
||||
ENV: access to environment variables by name, e.g. '$home = ENV["HOME"]'
|
||||
|
||||
FILENAME: evaluates to the name of the current file being processed.
|
||||
|
|
@ -2027,6 +2025,10 @@ IRS: evaluates to the input record separator from the command line,
|
|||
or to LF or CRLF from the input data if in autodetect mode (which is
|
||||
the default).
|
||||
|
||||
M_E: the mathematical constant e.
|
||||
|
||||
M_PI: the mathematical constant pi.
|
||||
|
||||
NF: evaluates to the number of fields in the current record.
|
||||
|
||||
NR: evaluates to the number of the current record over all files
|
||||
|
|
@ -2039,8 +2041,6 @@ OPS: evaluates to the output pair separator from the command line.
|
|||
ORS: evaluates to the output record separator from the command line,
|
||||
or to LF or CRLF from the input data if in autodetect mode (which is
|
||||
the default).
|
||||
|
||||
PI: the mathematical constant.
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -980,7 +980,7 @@ Other options:
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
@ -2262,7 +2262,7 @@ Other options:
|
|||
Please use a dollar sign for field names and double-quotes for string
|
||||
literals. If field names have special characters such as "." then you might
|
||||
use braces, e.g. '${field.name}'. Miller built-in variables are
|
||||
NF NR FNR FILENUM FILENAME PI E, and ENV["namegoeshere"] to access environment
|
||||
NF NR FNR FILENUM FILENAME M_PI M_E, and ENV["namegoeshere"] to access environment
|
||||
variables. The environment-variable name may be an expression, e.g. a field
|
||||
value.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue