From e35ff8ccb29404f2098e6f2fccace1c99c61b7be Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 26 Apr 2005 23:58:16 +0000 Subject: [PATCH] Added the ECHO command. --- doc/ChangeLog | 4 ++++ doc/utilities.texi | 14 +++++++++++-- po/en_GB.po | 50 +++++++++++++++++++++++----------------------- po/pspp.pot | 50 +++++++++++++++++++++++----------------------- src/ChangeLog | 4 ++++ src/Makefile.am | 2 +- src/command.def | 1 + src/echo.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 121 insertions(+), 53 deletions(-) create mode 100644 src/echo.c diff --git a/doc/ChangeLog b/doc/ChangeLog index 3a6cdcdd..03e18cac 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +Wed Apr 27 07:44:57 WST 2005 John Darrington + + * utilities.texi: Added the ECHO command. + Fri Apr 15 18:35:42 2005 Ben Pfaff * pspp.texinfo: Change manual license to GNU FDL, pursuant to diff --git a/doc/utilities.texi b/doc/utilities.texi index e59e96fa..67035315 100644 --- a/doc/utilities.texi +++ b/doc/utilities.texi @@ -14,6 +14,7 @@ encountered in the input. * DISPLAY DOCUMENTS:: Display active file documents. * DISPLAY FILE LABEL:: Display the active file label. * DROP DOCUMENTS:: Remove documents from the active file. +* ECHO:: Write a string to the output stream. * ERASE:: Erase a file. * EXECUTE:: Execute pending transformations. * FILE LABEL:: Set the active file's label. @@ -88,7 +89,7 @@ DISPLAY FILE LABEL. active file, if any. @xref{FILE LABEL}. -@node DROP DOCUMENTS, ERASE, DISPLAY FILE LABEL, Utilities +@node DROP DOCUMENTS, ECHO, DISPLAY FILE LABEL, Utilities @section DROP DOCUMENTS @vindex DROP DOCUMENTS @@ -102,8 +103,17 @@ New documents can be added with @cmd{DOCUMENT} (@pxref{DOCUMENT}). @cmd{DROP DOCUMENTS} changes only the active file. It does not modify any system files stored on disk. +@node ECHO, ERASE, DROP DOCUMENTS, Utilities +@section ECHO +@vindex ECHO -@node ERASE, EXECUTE, DROP DOCUMENTS, Utilities +@display +ECHO 'arbitrary text' . +@end display + +Use @cmd{ECHO} to write arbitrary text to the output stream. The text should be enclosed in quotation marks following the normal rules for string tokens (@pxref{Tokens}). + +@node ERASE, EXECUTE, ECHO, Utilities @comment node-name, next, previous, up @section ERASE @vindex ERASE diff --git a/po/en_GB.po b/po/en_GB.po index c93f8656..6a7a0b06 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.3.1\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-04-25 22:30-0700\n" +"POT-Creation-Date: 2005-04-27 07:45+0800\n" "PO-Revision-Date: 2004-01-23 13:04+0800\n" "Last-Translator: John Darrington \n" "Language-Team: John Darrington \n" @@ -1227,6 +1227,25 @@ msgstr "" msgid "installation error" msgstr "" +#: src/filename.c:221 +#, c-format +msgid "Searching for `%s'..." +msgstr "" + +#: src/filename.c:229 src/filename.c:261 +msgid "Search unsuccessful!" +msgstr "" + +#: src/filename.c:254 +#, c-format +msgid "Found `%s'." +msgstr "" + +#: src/filename.c:686 +#, c-format +msgid "Not opening pipe file `%s' because SAFER option set." +msgstr "" + #: src/file-type.c:129 msgid "MIXED, GROUPED, or NESTED expected." msgstr "" @@ -1365,25 +1384,6 @@ msgstr "" msgid "Unknown record type %g." msgstr "" -#: src/filename.c:221 -#, c-format -msgid "Searching for `%s'..." -msgstr "" - -#: src/filename.c:229 src/filename.c:261 -msgid "Search unsuccessful!" -msgstr "" - -#: src/filename.c:254 -#, c-format -msgid "Found `%s'." -msgstr "" - -#: src/filename.c:686 -#, c-format -msgid "Not opening pipe file `%s' because SAFER option set." -msgstr "" - #: src/flip.c:82 msgid "" "FLIP ignores TEMPORARY. Temporary transformations will be made permanent." @@ -3564,26 +3564,26 @@ msgid "" "commands." msgstr "" -#: src/title.c:56 +#: src/title.c:57 #, c-format msgid "%s before: %s\n" msgstr "" -#: src/title.c:56 +#: src/title.c:57 msgid "" msgstr "" -#: src/title.c:68 +#: src/title.c:69 #, c-format msgid "%s: `.' expected after string." msgstr "" -#: src/title.c:84 +#: src/title.c:85 #, c-format msgid "%s after: %s\n" msgstr "" -#: src/title.c:140 +#: src/title.c:141 #, c-format msgid "Document entered %s %02d:%02d:%02d by %s (%s):" msgstr "" diff --git a/po/pspp.pot b/po/pspp.pot index f7d3a309..e2c23a7a 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-04-25 22:30-0700\n" +"POT-Creation-Date: 2005-04-27 07:45+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1228,6 +1228,25 @@ msgstr "" msgid "installation error" msgstr "" +#: src/filename.c:221 +#, c-format +msgid "Searching for `%s'..." +msgstr "" + +#: src/filename.c:229 src/filename.c:261 +msgid "Search unsuccessful!" +msgstr "" + +#: src/filename.c:254 +#, c-format +msgid "Found `%s'." +msgstr "" + +#: src/filename.c:686 +#, c-format +msgid "Not opening pipe file `%s' because SAFER option set." +msgstr "" + #: src/file-type.c:129 msgid "MIXED, GROUPED, or NESTED expected." msgstr "" @@ -1366,25 +1385,6 @@ msgstr "" msgid "Unknown record type %g." msgstr "" -#: src/filename.c:221 -#, c-format -msgid "Searching for `%s'..." -msgstr "" - -#: src/filename.c:229 src/filename.c:261 -msgid "Search unsuccessful!" -msgstr "" - -#: src/filename.c:254 -#, c-format -msgid "Found `%s'." -msgstr "" - -#: src/filename.c:686 -#, c-format -msgid "Not opening pipe file `%s' because SAFER option set." -msgstr "" - #: src/flip.c:82 msgid "" "FLIP ignores TEMPORARY. Temporary transformations will be made permanent." @@ -3565,26 +3565,26 @@ msgid "" "commands." msgstr "" -#: src/title.c:56 +#: src/title.c:57 #, c-format msgid "%s before: %s\n" msgstr "" -#: src/title.c:56 +#: src/title.c:57 msgid "" msgstr "" -#: src/title.c:68 +#: src/title.c:69 #, c-format msgid "%s: `.' expected after string." msgstr "" -#: src/title.c:84 +#: src/title.c:85 #, c-format msgid "%s after: %s\n" msgstr "" -#: src/title.c:140 +#: src/title.c:141 #, c-format msgid "Document entered %s %02d:%02d:%02d by %s (%s):" msgstr "" diff --git a/src/ChangeLog b/src/ChangeLog index e31bb4ae..4f65c2f9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Wed Apr 27 07:43:50 WST 2005 John Darrington + + * command.def echo.c: Added the ECHO command. + Mon Apr 25 22:55:59 2005 Ben Pfaff Finish fixing MATCH FILES (PR 11677). diff --git a/src/Makefile.am b/src/Makefile.am index d3297630..ec592100 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,7 +50,7 @@ chart.h cmdline.c cmdline.h command.c command.def \ command.h compute.c copyleft.c copyleft.h count.c data-in.c data-in.h \ data-list.c data-list.h data-out.c date.c debug-print.h descript.c \ devind.c devind.h dfm-read.c dfm-read.h dfm-write.c dfm-write.h \ -dictionary.c dictionary.h do-if.c do-ifP.h error.c \ +dictionary.c dictionary.h do-if.c do-ifP.h echo.c error.c \ error.h factor_stats.c factor_stats.h file-handle.h \ file-type.c filename.c filename.h flip.c font.h format.c format.def \ format.h formats.c get.c getline.c getline.h glob.c glob.h \ diff --git a/src/command.def b/src/command.def index 345b2c81..3aafdb57 100644 --- a/src/command.def +++ b/src/command.def @@ -62,6 +62,7 @@ SPCCMD ("DOCUMENT", ERRO, INPU, TRAN, TRAN, cmd_document) DEFCMD ("DO IF", ERRO, INPU, TRAN, TRAN, cmd_do_if) DEFCMD ("DO REPEAT", ERRO, INPU, TRAN, TRAN, cmd_do_repeat) DEFCMD ("DROP DOCUMENTS", INIT, INPU, TRAN, PROC, cmd_drop_documents) +DEFCMD ("ECHO", INIT, INPU, TRAN, PROC, cmd_echo) UNIMPL ("EDIT", ERRO, ERRO, ERRO, ERRO) DEFCMD ("ELSE", ERRO, INPU, TRAN, TRAN, cmd_else) DEFCMD ("ELSE IF", ERRO, INPU, TRAN, TRAN, cmd_else_if) diff --git a/src/echo.c b/src/echo.c new file mode 100644 index 00000000..a669a1ff --- /dev/null +++ b/src/echo.c @@ -0,0 +1,49 @@ +/* PSPP - computes sample statistics. -*-c-*- + + Copyright (C) 2005 Free Software Foundation, Inc. + Written by John Darrington 2005 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include +#include "error.h" +#include "alloc.h" +#include "str.h" +#include "lexer.h" +#include "command.h" +#include "tab.h" +#include "som.h" + +/* Echos a string to the output stream */ +int +cmd_echo(void) +{ + struct tab_table *tab; + + if (token != T_STRING) + return CMD_FAILURE; + + tab = tab_create(1, 1, 0); + + tab_dim (tab, tab_natural_dimensions); + tab_flags (tab, SOMF_NO_TITLE ); + + tab_text(tab, 0, 0, 0, tokstr.string); + + tab_submit(tab); + + return CMD_SUCCESS; +} -- 2.30.2