Commit d75a1534 authored by Samuel Newbold's avatar Samuel Newbold

removing one excessively (in)convenient newline

parent e1013777
This diff is collapsed.
......@@ -438,9 +438,8 @@ int b_else(const Argm& argm, Error_list& exceptions) {
int b_internal_functions(const Argm& argm, Error_list& exceptions) {
if (argm.argc() != 1) throw Exception(Argm::Bad_argc, argm.argc()-1, 0, 0);
if (argm.argfunction()) throw Exception(Argm::Excess_argfunction);
argm.output <<Argm::exception_names[1];
for (int i = 2; i < Argm::Exception_count; ++i)
argm.output <<"\n" <<Argm::exception_names[i];
for (int i = 1; i < Argm::Exception_count; ++i)
argm.output <<Argm::exception_names[i] <<"\n";
return 0;}
// returns one if the input stream is not the default_stream
......@@ -474,7 +473,7 @@ int b_last_exception(const Argm& argm, Error_list& exceptions) {
Argm lookup(argm.subrange(1), argm.argfunction(), argm.parent_map());
Base_executable* focus = executable_map.find_second(lookup);
if (focus) {
argm.output <<focus->last_exception();
argm.output <<focus->last_exception() <<"\n";
argm.output.flush();
return 0;}
else throw Exception(Argm::Function_not_found, argm[1]);}
......@@ -923,10 +922,10 @@ int b_type(const Argm& argm, Error_list& exceptions) {
if (lookup[0] == ".argfunction") lookup[0] = ".mapped_argfunction";
Base_executable *e = executable_map.find_second(lookup);
if (!e) exceptions.add_error(Exception(Argm::Function_not_found, argm[1]));
else if (dynamic_cast<Function*>(e)) argm.output <<"function";
else if (dynamic_cast<Binary*>(e)) argm.output <<"file";
else if (dynamic_cast<Builtin*>(e)) argm.output <<"builtin";
else if (dynamic_cast<Command_block*>(e)) argm.output <<"argfunction";
else if (dynamic_cast<Function*>(e)) argm.output <<"function\n";
else if (dynamic_cast<Binary*>(e)) argm.output <<"file\n";
else if (dynamic_cast<Builtin*>(e)) argm.output <<"builtin\n";
else if (dynamic_cast<Command_block*>(e)) argm.output <<"argfunction\n";
else std::abort(); // successfully removed executable
return 0;}
......@@ -1100,7 +1099,7 @@ int b_whence_function(const Argm& argm, Error_list& exceptions) {
if (lookup[0] == ".argfunction") lookup[0] = ".mapped_argfunction";
Base_executable* focus = executable_map.find_second(lookup);
if (focus) {
argm.output <<focus->str();
argm.output <<focus->str() <<"\n";
argm.output.flush();}
else exceptions.add_error(Exception(Argm::Function_not_found, argm[1]));
return 0;}
......
......@@ -83,15 +83,11 @@ void internal_init(Error_list& exceptions) {
" .else {.echo .help not defined (\n)}}", exceptions));
executable_map.set(new Function(".internal_features",
empty_prototype.begin(), empty_prototype.end(), false,
"{.if .test_number_equal $# 1 {"
".echo .after_command .before_command .run_logic}; "
".else {.echo wrong argument count; .return -1}}", exceptions));
"{.echo (.after_command .before_command .run_logic\n)}", exceptions));
executable_map.set(new Builtin(".internal_functions", b_internal_functions));
executable_map.set(new Function(".internal_vars",
empty_prototype.begin(), empty_prototype.end(), false,
"{.if .test_number_equal $# 1 {"
".echo FIGNORE ?}; "
".else {.echo wrong argument count; .return -1}}", exceptions));
"{.echo (FIGNORE ?\n)}", exceptions));
executable_map.set(new Builtin(".is_default_input", b_is_default_input));
executable_map.set(new Builtin(".is_default_output", b_is_default_output));
executable_map.set(new Builtin(".is_default_error", b_is_default_error));
......
......@@ -288,10 +288,10 @@ fn type [-t] args ... {
.for $args$ {
.try_catch_recursive .function_not_found {
if_only_not .var_exists -t {.echo &&&1 is ()}
.combine &&&&{.type &&&1 {.argfunction}} $nl}}}
.type &&&1 {.argfunction}}}}
fn whence command {
.try_catch_recursive .function_not_found {
.combine ${.whence_function $command {.argfunction}} $nl}}
.whence_function $command {.argfunction}}}
fn whichp binary {.which_path $binary $PATH}
.function_all_flags while_and_one_more argv ... {
.try_catch_recursive .break {
......
......@@ -188,23 +188,22 @@ fn ret {.return $*}
echo for user ${.waiting_for_user}
echo for binary ${.waiting_for_binary}
echo for shell ${.waiting_for_shell}}
fn ist [-?] [-nc] {
fn st-core [-?] [-nc] binary filter {
if_only .var_exists -nc {.set -? $-?$ --suppress-common-lines}
.collect_errors_except .nop {
/bin/rwsh -to <test_main.sh >last.test.result
$binary -to <test_main.sh >last.test.result
.if .test_not_empty $-? {
&{whichp diff} $-?$ test.result last.test.result}
.else {&{whichp diff} -c test.result last.test.result}}}
fn st [-?] [-nc] {
if_only .var_exists -nc {.set -? $-?$ --suppress-common-lines}
.collect_errors_except .nop {
to <test_main.sh >last.test.result
.if .test_not_empty $-? {
&{whichp diff} $-?$ test.result last.test.result}
.else {&{whichp diff} -c test.result last.test.result}}}
fn bless-t {&{whichp cp} last.test.result test.result}
fn to {./rwsh -to}
&{whichp diff} $-?$ test.result last.test.result >last.test.result.diff}
.else {
&{whichp diff} -c test.result last.test.result >last.test.result.diff}
$filter$ last.test.result.diff}}
fn mst [-?] {make; st $-*$}
fn to {./rwsh -to}
fn st [-?] {st-core $-*$ ./rwsh /bin/cat}
fn ist [-?] {st-core $-*$ /bin/rwsh /bin/cat}
fn st-diffstat [-?] {st-core $-*$ ./rwsh &{whichp diffstat}}
fn st-vis [-?] {st-core $-*$ ./rwsh (/bin/cat -A)}
fn bless-t {&{whichp cp} last.test.result test.result}
fn ti [-?] [-nc] {
if_only .var_exists -nc {.set -? $-?$ --suppress-common-lines}
.collect_errors_except .nop {
......
This diff is collapsed.
......@@ -18,7 +18,7 @@ call stack .source .try_catch_recursive(body)
.function_all_flags .after_command -- args ... {
.nop $args
.set last_command_return $?
.combine $nl $last_command_return $nl}
.combine $last_command_return $nl}
.function_all_flags .prompt {.echo \$}
.function_all_flags .vars {.internal_vars}
.source /etc/rwshrc-basic
......@@ -312,10 +312,10 @@ fn type [-t] args ... {
.for $args$ {
.try_catch_recursive .function_not_found {
if_only_not .var_exists -t {.echo &&&1 is ()}
.combine &&&&{.type &&&1 {.argfunction}} $nl}}}
.type &&&1 {.argfunction}}}}
fn whence command {
.try_catch_recursive .function_not_found {
.combine ${.whence_function $command {.argfunction}} $nl}}
.whence_function $command {.argfunction}}}
fn whichp binary {.which_path $binary $PATH}
.function_all_flags while_and_one_more argv ... {
.try_catch_recursive .break {
......@@ -656,10 +656,10 @@ fn type [-t] args ... {
.for $args$ {
.try_catch_recursive .function_not_found {
if_only_not .var_exists -t {.echo &&&1 is ()}
.combine &&&&{.type &&&1 {.argfunction}} $nl}}}
.type &&&1 {.argfunction}}}}
fn whence command {
.try_catch_recursive .function_not_found {
.combine ${.whence_function $command {.argfunction}} $nl}}
.whence_function $command {.argfunction}}}
fn whichp binary {.which_path $binary $PATH}
.function_all_flags while_and_one_more argv ... {
.try_catch_recursive .break {
......@@ -691,22 +691,19 @@ fn polish -- operator builtin {
polish - .var_subtract
polish + .var_add
polish / .var_divide
0
$.global PATH /bin:/usr/bin
0
$.getpid
3386
$.scope () {.getpid; .echo $nl}
9071
0
$.getppid
$.scope () {.getppid; .echo $nl}
4926
0
$.function_all_flags timings focus {
.combine $focus (: last\() ${.last_execution_time $focus} \) \
.combine (total\() ${.total_execution_time $focus} \) \
.combine (count\() ${.execution_count $focus} \) $nl}
0
$.function_all_flags clock-watch {
.usleep 600
......@@ -716,37 +713,30 @@ $.function_all_flags clock-watch {
.combine (usleep overhead: ) ${.usleep_overhead} $nl
timings .usleep
timings /bin/true}
0
$clock-watch
timings: last(0.000000) total(0.000000) count(0)
clock-watch: last(0.000000) total(0.000000) count(0)
usleep overhead: 7.6e-05
.usleep: last(0.000676) total(0.000676) count(1)
/bin/true: last(0.001475) total(0.001475) count(1)
usleep overhead: 8.3e-05
.usleep: last(0.000683) total(0.000683) count(1)
/bin/true: last(0.001298) total(0.001298) count(1)
0
$clock-watch
timings: last(0.000116) total(0.000817) count(4)
clock-watch: last(0.003625) total(0.003625) count(1)
usleep overhead: 7.3e-05
.usleep: last(0.000670) total(0.001346) count(2)
/bin/true: last(0.001102) total(0.002577) count(2)
timings: last(0.000106) total(0.000586) count(4)
clock-watch: last(0.003109) total(0.003109) count(1)
usleep overhead: 8.65e-05
.usleep: last(0.000690) total(0.001373) count(2)
/bin/true: last(0.000833) total(0.002131) count(2)
0
$.mapped_argfunction {timings timings; timings clock-watch}
timings: last(0.000110) total(0.001335) count(8)
clock-watch: last(0.002396) total(0.006021) count(2)
timings: last(0.000107) total(0.001108) count(8)
clock-watch: last(0.002161) total(0.005270) count(2)
0
$.error a stderr print will come before the diff $nl
0
$.nop $A $FIGNORE
0
$
0
$
now terminating normally
.source /etc/rwshrc-basic
.global PATH /bin:/usr/bin
.getpid
.getppid
.scope () {.getpid; .echo $nl}
.scope () {.getppid; .echo $nl}
.function_all_flags timings focus {
.combine $focus (: last\() ${.last_execution_time $focus} \) \
.combine (total\() ${.total_execution_time $focus} \) \
......
......@@ -20,7 +20,7 @@
.function_all_flags .after_command -- args ... {
.nop $args
.set last_command_return $?
.combine $nl $last_command_return $nl}
.combine $last_command_return $nl}
.function_all_flags .prompt {.echo \$}
.function_all_flags .vars {.internal_vars}
.source /etc/rwshrc-basic
This diff is collapsed.
......@@ -18,7 +18,7 @@ call stack .source .try_catch_recursive(body)
.function_all_flags .after_command -- args ... {
.nop $args
.set last_command_return $?
.combine $nl $last_command_return $nl}
.combine $last_command_return $nl}
.function_all_flags .prompt {.echo \$}
.function_all_flags .vars {.internal_vars}
.source /etc/rwshrc-basic
......@@ -312,10 +312,10 @@ fn type [-t] args ... {
.for $args$ {
.try_catch_recursive .function_not_found {
if_only_not .var_exists -t {.echo &&&1 is ()}
.combine &&&&{.type &&&1 {.argfunction}} $nl}}}
.type &&&1 {.argfunction}}}}
fn whence command {
.try_catch_recursive .function_not_found {
.combine ${.whence_function $command {.argfunction}} $nl}}
.whence_function $command {.argfunction}}}
fn whichp binary {.which_path $binary $PATH}
.function_all_flags while_and_one_more argv ... {
.try_catch_recursive .break {
......@@ -366,15 +366,13 @@ polish / .var_divide
)
.source /etc/rwshrc-default}
$.function_all_flags a [-*] [-x b ...] c {
.for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }}
.for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }; .echo $nl}
0
$.nop $A $FIGNORE
0
$.whence_function a
.function_all_flags a [-?] [-x b ...] c {
.for &{.list_locals}$ {.combine $1 \( $$1 \) ( )}}
.for &{.list_locals}$ {.combine $1 \( $$1 \) ( )}; .echo $nl}
0
$a first
-*() -?() c(first)
......@@ -384,7 +382,6 @@ unacceptable arguments: for prototype [-?] [-x b ...] c,
assigned -*=(-x first) -?=() -x=(-x first) b=first ,
but needed (c),
( call) stack: a
-1
$a -x (fi rst) second
-*(-x (fi rst)) -?() -x(-x (fi rst)) b((fi rst)) c(second)
......@@ -403,7 +400,6 @@ $.function_all_flags a [-*] [-x ... b] c {
# if_only .var_exists b {c (b: ) $b$ $nl}
# if_only .var_exists c {c (c: ) $c$ $nl}
}
0
$.whence_function a
.function_all_flags a [-?] [-x ... b] c {
......@@ -417,26 +413,21 @@ $.whence_function a
0
$a first
-*() -?() c(first)
0
$a -x first
unacceptable arguments: for prototype [-?] [-x ... b] c,
assigned -*=(-x first) -?=() -x=(-x first) b=first ,
but needed (c),
( call) stack: a
-1
$a -x (fi rst) second
-*(-x (fi rst)) -?() -x(-x (fi rst)) b((fi rst)) c(second)
0
$a -x first (sec ond) third
-*(-x first (sec ond)) -?() -x(-x first (sec ond)) b((sec ond)) c(third)
0
$a -x (fi rst) (sec ond) third fourth
-*(-x (fi rst) (sec ond) third) -?() -x(-x (fi rst) (sec ond) third) b(third) c(fourth)
0
$
now terminating normally
.function_all_flags a [-*] [-x b ...] c {
.for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }}
.for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }; .echo $nl}
.nop $A $FIGNORE
.whence_function a
a first
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment