[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src data/ChangeLog data/file-handle-def.c ...
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src data/ChangeLog data/file-handle-def.c ... |
Date: |
Tue, 06 Nov 2007 06:23:27 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 07/11/06 06:23:26
Modified files:
src/data : ChangeLog file-handle-def.c por-file-reader.c
por-file-writer.c scratch-writer.c
sys-file-reader.c sys-file-writer.c
src/language : ChangeLog command.c
src/language/data-io: data-reader.c data-writer.c
Log message:
Patch #6258.
* command.c (report_state_mismatch): Replace code to construct an
error message from bits and pieces by a switch statement that
hard-codes each possible error. Makes i18n easier.
Suggested by Chusslove Illich <address@hidden>.
* file-handle-def.c (fh_lock): Add comment that TYPE should be
marked with N_() in the caller. Added these markings to each
caller too. Should make i18n easier.
Suggested by Chusslove Illich <address@hidden>.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.166&r2=1.167
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/file-handle-def.c?cvsroot=pspp&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/por-file-reader.c?cvsroot=pspp&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/por-file-writer.c?cvsroot=pspp&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/scratch-writer.c?cvsroot=pspp&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/sys-file-reader.c?cvsroot=pspp&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/sys-file-writer.c?cvsroot=pspp&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/ChangeLog?cvsroot=pspp&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/command.c?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/data-reader.c?cvsroot=pspp&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/data-writer.c?cvsroot=pspp&r1=1.12&r2=1.13
Patches:
Index: data/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -b -r1.166 -r1.167
--- data/ChangeLog 3 Nov 2007 22:00:03 -0000 1.166
+++ data/ChangeLog 6 Nov 2007 06:23:25 -0000 1.167
@@ -1,3 +1,12 @@
+2007-11-05 Ben Pfaff <address@hidden>
+
+ Patch #6258. Reviewed by John Darrington.
+
+ * file-handle-def.c (fh_lock): Add comment that TYPE should be
+ marked with N_() in the caller. Added these markings to each
+ caller too. Should make i18n easier.
+ Suggested by Chusslove Illich <address@hidden>.
+
2007-11-03 Ben Pfaff <address@hidden>
Allow output files to overwrite input files (bug #21280).
Index: data/file-handle-def.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/file-handle-def.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- data/file-handle-def.c 3 Nov 2007 22:00:03 -0000 1.13
+++ data/file-handle-def.c 6 Nov 2007 06:23:26 -0000 1.14
@@ -403,6 +403,10 @@
and similarly for writing. If successful, a reference to TYPE
is retained, so it should probably be a string literal.
+ TYPE should be marked with N_() in the caller: that is, the
+ caller should not translate it with gettext, but fh_lock will
+ do so.
+
ACCESS specifies whether the lock is for reading or writing.
EXCLUSIVE is true to require exclusive access, false to allow
sharing with other accessors. Exclusive read access precludes
Index: data/por-file-reader.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/por-file-reader.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- data/por-file-reader.c 3 Nov 2007 22:00:04 -0000 1.26
+++ data/por-file-reader.c 6 Nov 2007 06:23:26 -0000 1.27
@@ -46,6 +46,7 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
+#define N_(msgid) (msgid)
/* portable_to_local[PORTABLE] translates the given portable
character into the local character set. */
@@ -261,7 +262,9 @@
goto error;
/* Lock file. */
- r->lock = fh_lock (fh, FH_REF_FILE, "portable file", FH_ACC_READ, false);
+ /* TRANSLATORS: this fragment will be interpolated into
+ messages in fh_lock() that identify types of files. */
+ r->lock = fh_lock (fh, FH_REF_FILE, N_("portable file"), FH_ACC_READ, false);
if (r->lock == NULL)
goto error;
Index: data/por-file-writer.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/por-file-writer.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- data/por-file-writer.c 3 Nov 2007 22:00:04 -0000 1.21
+++ data/por-file-writer.c 6 Nov 2007 06:23:26 -0000 1.22
@@ -49,6 +49,7 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
+#define N_(msgid) (msgid)
/* Maximum width of a variable in a portable file. */
#define MAX_POR_WIDTH 255
@@ -142,7 +143,9 @@
}
/* Lock file. */
- w->lock = fh_lock (fh, FH_REF_FILE, "portable file", FH_ACC_WRITE, true);
+ /* TRANSLATORS: this fragment will be interpolated into
+ messages in fh_lock() that identify types of files. */
+ w->lock = fh_lock (fh, FH_REF_FILE, N_("portable file"), FH_ACC_WRITE, true);
if (w->lock == NULL)
goto error;
Index: data/scratch-writer.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/scratch-writer.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- data/scratch-writer.c 3 Nov 2007 22:00:04 -0000 1.11
+++ data/scratch-writer.c 6 Nov 2007 06:23:26 -0000 1.12
@@ -34,6 +34,8 @@
#include "xalloc.h"
+#define N_(msgid) (msgid)
+
/* A scratch file writer. */
struct scratch_writer
{
@@ -60,7 +62,9 @@
size_t dict_value_cnt;
/* Get exclusive write access to handle. */
- lock = fh_lock (fh, FH_REF_SCRATCH, "scratch file", FH_ACC_WRITE, true);
+ /* TRANSLATORS: this fragment will be interpolated into
+ messages in fh_lock() that identify types of files. */
+ lock = fh_lock (fh, FH_REF_SCRATCH, N_("scratch file"), FH_ACC_WRITE, true);
if (lock == NULL)
return NULL;
Index: data/sys-file-reader.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/sys-file-reader.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- data/sys-file-reader.c 3 Nov 2007 22:00:04 -0000 1.50
+++ data/sys-file-reader.c 6 Nov 2007 06:23:26 -0000 1.51
@@ -192,7 +192,9 @@
r->has_long_var_names = false;
r->opcode_idx = sizeof r->opcodes;
- r->lock = fh_lock (fh, FH_REF_FILE, "system file", FH_ACC_READ, false);
+ /* TRANSLATORS: this fragment will be interpolated into
+ messages in fh_lock() that identify types of files. */
+ r->lock = fh_lock (fh, FH_REF_FILE, N_("system file"), FH_ACC_READ, false);
if (r->lock == NULL)
goto error;
Index: data/sys-file-writer.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/sys-file-writer.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- data/sys-file-writer.c 3 Nov 2007 22:00:04 -0000 1.35
+++ data/sys-file-writer.c 6 Nov 2007 06:23:26 -0000 1.36
@@ -53,6 +53,7 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
+#define N_(msgid) (msgid)
/* Compression bias used by PSPP. Values between (1 -
COMPRESSION_BIAS) and (251 - COMPRESSION_BIAS) inclusive can be
@@ -184,7 +185,9 @@
&w->sfm_var_cnt);
/* Open file handle as an exclusive writer. */
- w->lock = fh_lock (fh, FH_REF_FILE, "system file", FH_ACC_WRITE, true);
+ /* TRANSLATORS: this fragment will be interpolated into
+ messages in fh_lock() that identify types of files. */
+ w->lock = fh_lock (fh, FH_REF_FILE, N_("system file"), FH_ACC_WRITE, true);
if (w->lock == NULL)
goto error;
Index: language/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/ChangeLog,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- language/ChangeLog 23 Sep 2007 05:59:02 -0000 1.25
+++ language/ChangeLog 6 Nov 2007 06:23:26 -0000 1.26
@@ -1,3 +1,12 @@
+2007-11-05 Ben Pfaff <address@hidden>
+
+ Patch #6258. Reviewed by John Darrington.
+
+ * command.c (report_state_mismatch): Replace code to construct an
+ error message from bits and pieces by a switch statement that
+ hard-codes each possible error. Makes i18n easier.
+ Suggested by Chusslove Illich <address@hidden>.
+
2007-09-22 Ben Pfaff <address@hidden>
Bug #21128. Reviewed by John Darrington.
Index: language/command.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/command.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- language/command.c 12 Oct 2007 04:54:46 -0000 1.29
+++ language/command.c 6 Nov 2007 06:23:26 -0000 1.30
@@ -621,32 +621,72 @@
assert (!in_correct_state (command, state));
if (state == CMD_STATE_INITIAL || state == CMD_STATE_DATA)
{
- const char *allowed[3];
- int allowed_cnt;
- char *s;
-
- allowed_cnt = 0;
- if (command->states & S_INITIAL)
- allowed[allowed_cnt++] = _("before the active file has been defined");
- else if (command->states & S_DATA)
- allowed[allowed_cnt++] = _("after the active file has been defined");
- if (command->states & S_INPUT_PROGRAM)
- allowed[allowed_cnt++] = _("inside INPUT PROGRAM");
- if (command->states & S_FILE_TYPE)
- allowed[allowed_cnt++] = _("inside FILE TYPE");
-
- if (allowed_cnt == 1)
- s = xstrdup (allowed[0]);
- else if (allowed_cnt == 2)
- s = xasprintf (_("%s or %s"), allowed[0], allowed[1]);
- else if (allowed_cnt == 3)
- s = xasprintf (_("%s, %s, or %s"), allowed[0], allowed[1], allowed[2]);
- else
+ switch (command->states)
+ {
+ /* One allowed state. */
+ case S_INITIAL:
+ msg (SE, _("%s is allowed only before the active file has "
+ "been defined."), command->name);
+ break;
+ case S_DATA:
+ msg (SE, _("%s is allowed only after the active file has "
+ "been defined."), command->name);
+ break;
+ case S_INPUT_PROGRAM:
+ msg (SE, _("%s is allowed only inside INPUT PROGRAM."),
+ command->name);
+ break;
+ case S_FILE_TYPE:
+ msg (SE, _("%s is allowed only inside FILE TYPE."), command->name);
+ break;
+
+ /* Two allowed states. */
+ case S_INITIAL | S_DATA:
+ NOT_REACHED ();
+ case S_INITIAL | S_INPUT_PROGRAM:
+ msg (SE, _("%s is allowed only before the active file has "
+ "been defined or inside INPUT PROGRAM."), command->name);
+ break;
+ case S_INITIAL | S_FILE_TYPE:
+ msg (SE, _("%s is allowed only before the active file has "
+ "been defined or inside FILE TYPE."), command->name);
+ break;
+ case S_DATA | S_INPUT_PROGRAM:
+ msg (SE, _("%s is allowed only after the active file has "
+ "been defined or inside INPUT PROGRAM."), command->name);
+ break;
+ case S_DATA | S_FILE_TYPE:
+ msg (SE, _("%s is allowed only after the active file has "
+ "been defined or inside FILE TYPE."), command->name);
+ break;
+ case S_INPUT_PROGRAM | S_FILE_TYPE:
+ msg (SE, _("%s is allowed only inside INPUT PROGRAM "
+ "or inside FILE TYPE."), command->name);
+ break;
+
+ /* Three allowed states. */
+ case S_DATA | S_INPUT_PROGRAM | S_FILE_TYPE:
+ msg (SE, _("%s is allowed only after the active file has "
+ "been defined, inside INPUT PROGRAM, or inside "
+ "FILE TYPE."), command->name);
+ break;
+ case S_INITIAL | S_INPUT_PROGRAM | S_FILE_TYPE:
+ msg (SE, _("%s is allowed only before the active file has "
+ "been defined, inside INPUT PROGRAM, or inside "
+ "FILE TYPE."), command->name);
+ break;
+ case S_INITIAL | S_DATA | S_FILE_TYPE:
+ NOT_REACHED ();
+ case S_INITIAL | S_DATA | S_INPUT_PROGRAM:
NOT_REACHED ();
- msg (SE, _("%s is allowed only %s."), command->name, s);
+ /* Four allowed states. */
+ case S_INITIAL | S_DATA | S_INPUT_PROGRAM | S_FILE_TYPE:
+ NOT_REACHED ();
- free (s);
+ default:
+ NOT_REACHED ();
+ }
}
else if (state == CMD_STATE_INPUT_PROGRAM)
msg (SE, _("%s is not allowed inside INPUT PROGRAM."), command->name);
Index: language/data-io/data-reader.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/data-io/data-reader.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- language/data-io/data-reader.c 3 Nov 2007 22:00:05 -0000 1.27
+++ language/data-io/data-reader.c 6 Nov 2007 06:23:26 -0000 1.28
@@ -41,6 +41,7 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
+#define N_(msgid) (msgid)
/* Flags for DFM readers. */
enum dfm_reader_flags
@@ -110,7 +111,9 @@
struct dfm_reader *r;
struct fh_lock *lock;
- lock = fh_lock (fh, FH_REF_FILE | FH_REF_INLINE, "data file",
+ /* TRANSLATORS: this fragment will be interpolated into
+ messages in fh_lock() that identify types of files. */
+ lock = fh_lock (fh, FH_REF_FILE | FH_REF_INLINE, N_("data file"),
FH_ACC_READ, false);
if (lock == NULL)
return NULL;
Index: language/data-io/data-writer.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/data-io/data-writer.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- language/data-io/data-writer.c 3 Nov 2007 22:00:05 -0000 1.12
+++ language/data-io/data-writer.c 6 Nov 2007 06:23:26 -0000 1.13
@@ -35,6 +35,7 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
+#define N_(msgid) (msgid)
/* Data file writer. */
struct dfm_writer
@@ -52,7 +53,7 @@
struct dfm_writer *w;
struct fh_lock *lock;
- lock = fh_lock (fh, FH_REF_FILE, "data file", FH_ACC_WRITE, false);
+ lock = fh_lock (fh, FH_REF_FILE, N_("data file"), FH_ACC_WRITE, false);
if (lock == NULL)
return NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src data/ChangeLog data/file-handle-def.c ...,
Ben Pfaff <=