aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/core-commands.c2
-rw-r--r--src/main.c36
-rwxr-xr-xsrc/symbols-extract.tes12
4 files changed, 25 insertions, 27 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f22802b..ff2e86b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -103,8 +103,6 @@ endif
CLEANFILES = $(BUILT_SOURCES) \
symbols-scintilla.c symbols-scilexer.c
-# FIXME: Perhaps symbols-extract.tes should work with --stdin/--stdout.
-# Requires changing the command-line argument passing first.
symbols-scintilla.c : @SCINTILLA_PATH@/include/Scintilla.h \
symbols-extract.tes
$(SCITECO_MINIMAL) -8m -- @srcdir@/symbols-extract.tes \
diff --git a/src/core-commands.c b/src/core-commands.c
index f384272..6d0a3dc 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -920,7 +920,7 @@ TECO_DEFINE_STATE_START(teco_state_start);
* Immediately jumps to the current loop's start.
* Also works from inside conditionals.
*
- * This command behaves exactly like \fB>\fP with regard to
+ * This command behaves exactly like \fB<\fP with regard to
* colon-modifiers.
*
* Outside of loops \(em or in a macro without
diff --git a/src/main.c b/src/main.c
index 2be81ea..3ad4333 100644
--- a/src/main.c
+++ b/src/main.c
@@ -476,30 +476,30 @@ main(int argc, char **argv)
* NOTE: The profile hasn't run yet, so it cannot guess the
* documents encoding. This should therefore be done by the profile
* for any preexisting unnamed buffer.
- *
- * FIXME: The unnamed buffer is also currently used for
- * command-line parameters.
- * Therefore you practically cannot pipe into SciTECO
- * while using opener.tes.
*/
- if (teco_stdin && !teco_view_load_from_stdin(teco_ring_current->view, TRUE, &error))
- goto cleanup;
+ if (teco_stdin) {
+ if (!teco_view_load_from_stdin(teco_ring_current->view, TRUE, &error))
+ goto cleanup;
+
+ if (teco_interface_ssm(SCI_GETLENGTH, 0, 0) > 0)
+ teco_ring_dirtify();
+ }
/*
- * Add remaining arguments to unnamed buffer.
- *
- * FIXME: This is not really robust since filenames may contain linefeeds.
- * Also, the Unnamed Buffer should be kept empty for piping.
- * Therefore, it would be best to store the arguments in Q-Regs, e.g. ^A0,^A1,^A2...
+ * Initialize the commandline-argument Q-registers (^Ax).
*/
- for (gint i = 1; argv_utf8[i]; i++) {
- teco_interface_ssm(SCI_APPENDTEXT, strlen(argv_utf8[i]), (sptr_t)argv_utf8[i]);
- teco_interface_ssm(SCI_APPENDTEXT, 1, (sptr_t)"\n");
+ for (guint i = 0; argv_utf8[i]; i++) {
+ gchar buf[32+1];
+ gint len = g_snprintf(buf, sizeof(buf), "\1%u", i);
+ g_assert(len < sizeof(buf));
+
+ teco_qreg_t *qreg = teco_qreg_plain_new(buf, len);
+ teco_qreg_table_insert_unique(&teco_qreg_table_globals, qreg);
+ if (!qreg->vtable->set_string(qreg, argv_utf8[i], strlen(argv_utf8[i]),
+ teco_default_codepage(), &error))
+ goto cleanup;
}
- if (teco_interface_ssm(SCI_GETLENGTH, 0, 0) > 0)
- teco_ring_dirtify();
-
/*
* Execute macro or mung file
*/
diff --git a/src/symbols-extract.tes b/src/symbols-extract.tes
index da9c207..6c7ef05 100755
--- a/src/symbols-extract.tes
+++ b/src/symbols-extract.tes
@@ -11,18 +11,18 @@ EIQ[$SCITECOPATH]/string.tes
!* read commandline arguments *!
[getopt.p]
-[optstring]p:n: M[getopt]"F (0/0) '
-LR 0X#ou 2LR 0X#in HK
+[optstring]p:n:
+M[getopt]U#ou Q#ou"< Invalid command-line^J 1 ' Q#ou+1U#in
!* copy all defines in input file beginning with prefix *!
-EBN#in <S#defineS[[Q[getopt.p]]M ]; 1:Xa 10:a> EF
+EBN[\#in] <S#defineS[[Q[getopt.p]]M ]; 1:Xa 10:a> EF
!* sort all defines *!
Ga ZJB 0,.M[qsort] J
!* format as C/C++ array *!
I/*
- * AUTOGENERATED FROM Q#in
+ * AUTOGENERATED FROM Q[\#in]
* DO NOT EDIT
*/
#ifdef HAVE_CONFIG_H
@@ -31,7 +31,7 @@ I/*
#include <glib.h>
-#include "Q#in"
+#include "Q[\#in]"
#include "sciteco.h"
#include "symbols.h"
@@ -56,6 +56,6 @@ teco_cmdline_cleanup(void)

!* write output file *!
-2EL EWQ#ou
+2EL EWQ[\#ou]
EX