• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

POSIX.1 National Language Support API for MinGW


Commit MetaInfo

Revision182556be764e61e7d7eaa56ae9600300e82e8a65 (tree)
Zeit2007-05-18 03:45:08
AutorKeith Marshall <keithmarshall@user...>
CommiterKeith Marshall

Log Message

Correct mcsource.c r1.7 logic defect; tidy up DEBUG mode output formatting.

Ändern Zusammenfassung

Diff

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
1+2007-05-17 Keith Marshall <keithmarshall@users.sourceforge.net>
2+
3+ * mcsource.c (mc_source): Adjust block nesting to correct logic
4+ defect introduced in revision 1.7 (2007-05-14).
5+ [DEBUG]: Tidy up formatting of some ugly debugging messages.
6+
17 2007-05-14 Keith Marshall <keithmarshall@users.sourceforge.net>
28
39 * mcsource.c (mc_source): Close `input_fd' prior to every use
--- a/mcsource.c
+++ b/mcsource.c
@@ -206,6 +206,8 @@ struct msgdict *mc_source( const char *input )
206206 {
207207 # define CODESET_DECLARED codeset_decl_src, codeset_decl_lineno
208208
209+ dinvoke( int dtrace = 0; )
210+
209211 long accumulator;
210212 int fd, input_fd, count;
211213 char buf[BUFSIZ], keyword[64];
@@ -357,6 +359,7 @@ struct msgdict *mc_source( const char *input )
357359 else
358360 {
359361 xcount += skip;
362+ dinvoke(( dtrace = dtrace ? dtrace : fprintf( stderr, "\n%s:%u:scan input: ", input, linenum ) ));
360363 dfputc(( c, stderr ));
361364 }
362365 }
@@ -687,7 +690,7 @@ struct msgdict *mc_source( const char *input )
687690 */
688691 size_t len = 0;
689692 status &= ~ESCAPE;
690- dfprintf(( stderr, "%s:%u:", input, linenum ));
693+ dfprintf(( stderr, "\n%s:%u:", input, linenum ));
691694 switch( c )
692695 {
693696 /* Thus, for the standard escape sequences ...
@@ -781,6 +784,7 @@ struct msgdict *mc_source( const char *input )
781784 else
782785 {
783786 xcount += skip;
787+ dinvoke(( dtrace = dtrace ? dtrace : fprintf( stderr, "\n%s:%u:scan input: ", input, linenum ) ));
784788 dfputc(( c, stderr ));
785789 }
786790 }
@@ -790,40 +794,40 @@ struct msgdict *mc_source( const char *input )
790794 status |= FLUSH;
791795 }
792796 }
797+ }
793798
794- if( c == L'\n' )
795- {
796- /* Mark the end of the current input line,
797- * and schedule any pending message data from this line
798- * for flushing to the message collection buffer.
799- */
800- status |= NEWLINE | FLUSH;
799+ if( c == L'\n' )
800+ {
801+ /* Mark the end of the current input line,
802+ * and schedule flushing of any pending message data from this line
803+ * to the message collection buffer.
804+ */
805+ status |= NEWLINE | FLUSH;
801806
802- /* If "QUOTED" context remains active, at the end of this line,
803- * then we have an implicit continuation, so force it.
804- */
805- if( (status & QUOTED) == QUOTED )
806- status |= CONTINUED;
807+ /* If "QUOTED" context remains active, at the end of this line,
808+ * then we have an implicit continuation, so force it.
809+ */
810+ if( (status & QUOTED) == QUOTED )
811+ status |= CONTINUED;
807812
808- /* Clean up the context of any pending directive processing.
809- */
810- switch( status & CATEGORY )
811- {
812- case DEFQUOTE:
813- /*
814- * If we see end of line with a DEFQUOTE pending, then
815- * there was no defining character with the "quote" directive,
816- * so we must disable "quote" character recognition.
817- */
818- quote = L'\0';
819- dfprintf(( stderr, ": none assigned" ));
820- break;
821- }
813+ /* Clean up the context of any pending directive processing.
814+ */
815+ switch( status & CATEGORY )
816+ {
817+ case DEFQUOTE:
818+ /*
819+ * If we see end of line with a DEFQUOTE pending, then
820+ * there was no defining character with the "quote" directive,
821+ * so we must disable "quote" character recognition.
822+ */
823+ quote = L'\0';
824+ dfprintf(( stderr, ": none assigned" ));
825+ break;
826+ }
822827
823- if( (status & CONTINUED) == 0 )
824- {
825- status &= ~ENCODED;
826- }
828+ if( (status & CONTINUED) == 0 )
829+ {
830+ status &= ~ENCODED;
827831 }
828832 }
829833 }
@@ -834,10 +838,11 @@ struct msgdict *mc_source( const char *input )
834838 * which now needs to be flushed to the output queue,
835839 * BEFORE we proceed to the next cycle.
836840 */
841+ dinvoke(( dtrace = 0 ));
837842 while( headroom < (xcount + ICONV_MB_LEN_MAX) )
838843 {
839844 headroom += BUFSIZ;
840- dfprintf(( stderr, "<grow allocation to %u bytes>", (unsigned)(msgloc + headroom) ));
845+ dfprintf(( stderr, "\n%s:%u:insufficient workspace remaining; grow allocation to %u bytes", input, linenum, (unsigned)(msgloc + headroom) ));
841846 if( (messages = realloc( messages, msgloc + headroom )) == NULL )
842847 {
843848 gencat_errno = mc_errout( FATAL( MSG_OUT_OF_MEMORY ));
@@ -849,7 +854,7 @@ struct msgdict *mc_source( const char *input )
849854 dfprintf(( stderr, "\n%s:%u:", input, linenum ));
850855 msgloc = mc_update_workspace( messages + msgloc, p - xcount - skip, xcount )
851856 - messages;
852- dfprintf(( stderr, "; %u byte%s free\n", headroom, headroom == 1 ? "" : "s" ));
857+ dfprintf(( stderr, "; %u byte%s free", headroom, headroom == 1 ? "" : "s" ));
853858 if( (status & (MSGTEXT | NEWLINE | CONTINUED)) == (MSGTEXT | NEWLINE) )
854859 {
855860 wchar_t terminator = L'\0';
@@ -976,4 +981,4 @@ struct msgdict *mc_source( const char *input )
976981 return head;
977982 }
978983
979-/* $RCSfile$Revision: 1.6 $: end of file */
984+/* $RCSfile$Revision: 1.8 $: end of file */