about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xsubx/apps/surveybin41172 -> 41174 bytes
-rw-r--r--subx/apps/survey.subx10
-rwxr-xr-xsubx/test_apps10
3 files changed, 16 insertions, 4 deletions
diff --git a/subx/apps/survey b/subx/apps/survey
index ea50364a..6971e511 100755
--- a/subx/apps/survey
+++ b/subx/apps/survey
Binary files differdiff --git a/subx/apps/survey.subx b/subx/apps/survey.subx
index da01407b..bc96fe14 100644
--- a/subx/apps/survey.subx
+++ b/subx/apps/survey.subx
@@ -2753,11 +2753,13 @@ emit-elf-program-header-entry:  # out : (address buffered-file), curr-segment :
     # . if (EAX == 0) goto next check
     3d/compare-EAX-and  0/imm32
     74/jump-if-equal  $emit-elf-program-header-entry:data/disp8
-    # *Elf_p_flags = rw-
-    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           Elf_p_flags/disp32  6/imm32       # copy to *Elf_p_flags
-$emit-elf-program-header-entry:data:
-    # otherwise *Elf_p_flags = r-x
+    # *Elf_p_flags = r-x
     c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           Elf_p_flags/disp32  5/imm32       # copy to *Elf_p_flags
+    eb/jump  $emit-elf-program-header-entry:really-emit/disp8
+$emit-elf-program-header-entry:data:
+    # otherwise *Elf_p_flags = rw-
+    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           Elf_p_flags/disp32  6/imm32       # copy to *Elf_p_flags
+$emit-elf-program-header-entry:really-emit:
     # emit-hex-array(out, Elf_program_header_entry)
     # . . push args
     68/push  Elf_program_header_entry/imm32
diff --git a/subx/test_apps b/subx/test_apps
index 10b6869b..068712a7 100755
--- a/subx/test_apps
+++ b/subx/test_apps
@@ -10,6 +10,8 @@ test `uname` = 'Linux'  &&  echo 'testing native runs as well'
 
 CFLAGS=$CFLAGS ./build
 
+echo "== translating and running using C++"
+
 echo ex1
 ./subx translate examples/ex1.subx  -o examples/ex1
 [ "$1" != record ]  &&  git diff --exit-code examples/ex1
@@ -224,4 +226,12 @@ test `uname` = 'Linux'  &&  {
   echo
 }
 
+echo "== translating using SubX"
+
+echo ex1
+cat examples/ex1.subx |subx_bin run apps/dquotes |subx_bin run apps/assort |subx_bin run apps/pack |subx_bin run apps/survey |subx_bin run apps/hex |diff examples/ex1 -
+test `uname` = 'Linux'  &&  {
+  cat examples/ex1.subx |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex1 -
+}
+
 exit 0
} /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
=head1 NAME

rifle - ranger's file opener




=head1 SYNOPSIS

B<rifle> [B<--help>] [B<-f> I<FLAGS>] [B<-l>] [B<-p> I<KEYWORD>]
[B<-w> I<PROGRAM>] [B<-c> I<CONFIG_FILE>] I<files>




=head1 DESCRIPTION

rifle is a powerful file executor that allows for complex file type checking,
written to meet the needs of the file manager I<ranger>.  rifle's strength lies
in automatically determining file types, depending on which programs are
installed on the system, even without any user interaction.




=head1 OPTIONS

=over 14

=item B<-f> I<FLAGS>

Specify flags for opening the files.  Flags are letters that changes how the
program is executed.  Any combination of flags will work.  Writing uppercase
flags will negate the effect of all previously used lowercase flags of the same
letter.

Table of all flags:
 f   fork program to background
 r   run program as root, using sudo
 t   run program in a separate terminal, as specified by $TERMCMD

=item B<-l>

List all possible ways to open the specified files.  Each line will contain information in the format of I<id:label:flags:command>. I<id> is the identification number. I<label> is an arbitrary string that was specified for this command, I<flags> are the flags that are used by default, and I<command> is the command that is going to be executed.

=item B<-p> I<KEYWORD>

Pick a method to open the files.

I<KEYWORD> is either the ID number listed by C<rifle -l> or a string that matches a label in the configuration file.

=item B<-w> I<PROGRAM>

Open the files with the program I<PROGRAM>

=item B<-c> I<CONFIG_FILE>

Read configuration from I<CONFIG_FILE>, instead of the default.

=item B<-h>, B<--help>

Print a list of options and exit.

=back




=head1 FILES

rifle shares configuration files with ranger, though ranger is not required in
order to use rifle. The default configuration file F<rifle.conf> is expected
to be at F<~/.config/ranger/rifle.conf>. However, this can be overridden with
the B<-c> option.

This file specifies patterns for determining the commands to open files with.
The syntax is described in the comments of the default F<rifle.conf> that ships
with ranger.  To obtain it, you need to run: C<ranger --copy-config=rifle>




=head1 ENVIRONMENT

=over 8

=item EDITOR

Determines which editor to use for editing files (in the default F<rifle.conf>).

=item PAGER

Determines which pager to use for displaying files (in the default F<rifle.conf>).

=item TERMCMD

Determines the terminal emulator command for use with the I<t> flag.  It is required that the value is the path to an executable file which accepts the "-e COMMAND" argument.

=item XDG_CONFIG_HOME

Specifies the directory for configuration files. Defaults to F<$HOME/.config>.

=back




=head1 EXAMPLES

List all the different methods:

 $ rifle -l helloworld.py
 0:editor::"$EDITOR" -- "$@"
 1:pager::"$PAGER" -- "$@"
 2:::python -- "$1"

Display its content by opening it with "cat":

 $ rifle -w cat helloworld.py
 print("Hello World!")

Run it by picking the method 2, which calls 'python -- "$1"':

 $ rifle -p 2 helloworld.py
 Hello World!

Display the file in a pager inside a new terminal, run as root:

 $ rifle -p 1 -f tr helloworld.py