From f621d3704bb7e98594e6322744fc1cf451692e10 Mon Sep 17 00:00:00 2001 From: dockes Date: Tue, 4 Dec 2007 10:16:52 +0000 Subject: [PATCH] *** empty log message *** --- src/qtgui/uiprefs_w.cpp | 5 ++--- src/utils/utf8iter.cpp | 50 ++++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index cee6e19e..85d4df2a 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.22 2007-09-08 17:25:49 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.23 2007-12-04 10:16:52 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -302,12 +302,11 @@ void UIPrefsDialog::showViewAction() { if (m_viewAction== 0) { m_viewAction = new ViewAction(0); - m_viewAction->show(); } else { // Close and reopen, in hope that makes us visible... m_viewAction->close(); - m_viewAction->show(); } + m_viewAction->show(); } //////////////////////////////////////////// diff --git a/src/utils/utf8iter.cpp b/src/utils/utf8iter.cpp index 9efb3390..4d6dbc21 100644 --- a/src/utils/utf8iter.cpp +++ b/src/utils/utf8iter.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: utf8iter.cpp,v 1.5 2006-11-20 11:16:54 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: utf8iter.cpp,v 1.6 2007-12-04 10:16:27 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -35,14 +35,43 @@ using namespace std; #include "utf8iter.h" #include "readfile.h" +const char *thisprog; +static char usage [] = + "utf8iter [opts] infile outfile\n" + " converts infile to 32 bits unicode (processor order), for testing\n" + "-v : print stuff as we go\n" + ; + +void Usage() { + fprintf(stderr, "%s:%s\n", thisprog, usage); + exit(1); +} +static int op_flags; +#define OPT_v 0x2 + int main(int argc, char **argv) { - if (argc != 3) { - cerr << "Usage: utf8iter infile outfile" << endl; - exit(1); + thisprog = argv[0]; + argc--; argv++; + + while (argc > 0 && **argv == '-') { + (*argv)++; + if (!(**argv)) + Usage(); + while (**argv) + switch (*(*argv)++) { + case 'v': op_flags |= OPT_v; break; + + default: Usage(); break; + } + argc--;argv++; } - const char *infile = argv[1]; - const char *outfile = argv[2]; + + if (argc != 2) { + Usage(); + } + const char *infile = *argv++;argc--; + const char *outfile = *argv++;argc--; string in; if (!file_to_string(infile, in)) { cerr << "Cant read file\n" << endl; @@ -62,9 +91,15 @@ int main(int argc, char **argv) for (;!it.eof(); it++) { unsigned int value = *it; if (value == (unsigned int)-1) { - fprintf(stderr, "Conversion error occurred\n"); + cerr << "Conversion error occurred\n" << endl; exit(1); } + if (op_flags & OPT_v) { + printf("Value: 0x%x", value); + if (value < 0x7f) + printf(" (%c) ", value); + printf("\n"); + } // UTF-32LE or BE array ucsout1.push_back(value); // UTF-32LE or BE file @@ -140,4 +175,3 @@ int main(int argc, char **argv) } exit(0); } -