Revision: 50644
http://brlcad.svn.sourceforge.net/brlcad/?rev=50644&view=rev
Author: tbrowder2
Date: 2012-05-23 20:48:41 +0000 (Wed, 23 May 2012)
Log Message:
-----------
undoing bad commit rev 50643
Revision Links:
--------------
http://brlcad.svn.sourceforge.net/brlcad/?rev=50643&view=rev
Modified Paths:
--------------
brlcad/trunk/regress/vls.sh
brlcad/trunk/src/libbu/quote.c
brlcad/trunk/src/libbu/test_quote.c
brlcad/trunk/src/libbu/test_vls.c
brlcad/trunk/src/libbu/vls.c
brlcad/trunk/src/tclscripts/mged/openw.tcl
Modified: brlcad/trunk/regress/vls.sh
===================================================================
--- brlcad/trunk/regress/vls.sh 2012-05-23 20:10:33 UTC (rev 50643)
+++ brlcad/trunk/regress/vls.sh 2012-05-23 20:48:41 UTC (rev 50644)
@@ -100,8 +100,7 @@
echo "-> $TESTSCRIPT succeeded with no failures of any kind."
# but one more check
if [ $KNOWNEXP -ne 0 ] ; then
- echo " But SURPRISE! We expected $KNOWNEXP failed tests so"
- echo " something has changed!"
+ echo " But SURPRISE! We expected $KNOWNEXP failed tests so
something has changed!"
echo " See file './regress/$TESTLOG' for results and compare"
echo " with file './src/libbu/test_vls.c'."
else
@@ -111,8 +110,7 @@
fi
else
echo "-> $TESTSCRIPT unexpectedly FAILED $STATUS test(s)."
- echo " See files './regress/$TESTLOG' and"
- echo " './regress/$ERRLOG' for results."
+ echo " See file './regress/$TESTLOG' for results."
fi
exit $STATUS
Modified: brlcad/trunk/src/libbu/quote.c
===================================================================
--- brlcad/trunk/src/libbu/quote.c 2012-05-23 20:10:33 UTC (rev 50643)
+++ brlcad/trunk/src/libbu/quote.c 2012-05-23 20:48:41 UTC (rev 50644)
@@ -29,45 +29,7 @@
static const char DQUOTE = '"';
static const char ESCAPE = '\\';
-/* known failure cases (round trip):
-{\} -> {} [FAIL] (should be: {\})
-{\\} -> {\} [FAIL] (should be: {\\})
-{\hello} -> {hello} [FAIL] (should be: {\hello})
-{\hello"} -> {hello"} [FAIL] (should be: {\hello"})
-{hello\\} -> {hello\} [FAIL] (should be: {hello\\})
-
-*/
-
-/* current description from bu.h: */
-/**
- * given an input string, wrap the string in double quotes if there is
- * a space and append it to the provided bu_vls. escape any existing
- * double quotes.
- *
- * TODO: consider a specifiable quote character and octal encoding
- * instead of double quote wrapping. perhaps specifiable encode type:
- * BU_ENCODE_QUOTE
- * BU_ENCODE_OCTAL
- * BU_ENCODE_XML
- *
- * the behavior of this routine is subject to change but should remain
- * a reversible operation when used in conjunction with
- * bu_vls_decode().
- *
- * returns a pointer to the encoded string (i.e., the substring held
- * within the bu_vls)
- */
-
-/*
-
-I think the intent is to take a string and encode it so it can be used
-in a printf statement (except that doesn't explain why the space is
-escaped). If that is the case, then we would escape ''' and '"' and '\'
-characters but only if they.
-
-*/
-
const char *
bu_vls_encode(struct bu_vls *vp, const char *str)
{
@@ -95,11 +57,10 @@
for (; *str != '\0'; str++) {
if (*str == DQUOTE) {
bu_vls_putc(vp, ESCAPE);
- } else if (*str == SPACE) {
- bu_vls_putc(vp, ESCAPE);
}
bu_vls_putc(vp, *str);
}
+ bu_vls_putc(vp, DQUOTE);
}
return bu_vls_addr(vp) + skip;
Modified: brlcad/trunk/src/libbu/test_quote.c
===================================================================
--- brlcad/trunk/src/libbu/test_quote.c 2012-05-23 20:10:33 UTC (rev 50643)
+++ brlcad/trunk/src/libbu/test_quote.c 2012-05-23 20:48:41 UTC (rev 50644)
@@ -38,46 +38,39 @@
{
int status = 0;
int len_s = str ? strlen(str) : 0;
- int len_d = 0; /* for length of decoded */
- int len_e = 0; /* for length of encoded */
+ int len_d = 0; /* for length of decoded */
int f_wid = 28; /* desired total field width */
struct bu_vls encoded = BU_VLS_INIT_ZERO;
struct bu_vls decoded = BU_VLS_INIT_ZERO;
- (void)bu_vls_encode(&encoded, str);
- (void)bu_vls_decode(&decoded, bu_vls_addr(&encoded)); /* should be same as
input string */
+ bu_vls_encode(&encoded, str);
+ bu_vls_decode(&decoded, bu_vls_addr(&encoded)); /* should be same as input
string */
len_d = bu_vls_strlen(&decoded);
- len_e = bu_vls_strlen(&encoded);
-
if (f_wid < len_s)
f_wid = len_s + 1;
if (f_wid < len_d)
f_wid = len_d + 1;
- if (f_wid < len_e)
- f_wid = len_e + 1;
- /* a hack for str showing '(null)' in printf if zero length */
- if (len_s == 0)
- len_s = 6;
-
if (BU_STR_EQUAL(str, bu_vls_addr(&decoded))
/* && !BU_STR_EQUAL(str, bu_vls_addr(&encoded)) */
) {
+ /* a hack for str showing '(null)' in printf if zero length */
+ if (len_s == 0)
+ len_s = 6;
printf("{%*s}%*s -> {%*s}%*s [PASS]\n",
len_s, str, f_wid - len_s, " ",
len_d, bu_vls_addr(&decoded), f_wid - len_d, " "
);
} else {
+ /* a hack for str showing '(null)' in printf if zero length */
+ if (len_s == 0)
+ len_s = 6;
printf("{%*s}%*s -> {%*s}%*s [FAIL] (should be: {%s})\n",
len_s, str, f_wid - len_s, " ",
len_d, bu_vls_addr(&decoded), f_wid - len_d, " ",
str
);
- printf("{%*s}%*s -> {%*s}%*s <- encoded\n",
- len_s, " ", f_wid - len_s, " ",
- len_e, bu_vls_addr(&encoded), f_wid - len_d, " "
- );
status = 1;
}
Modified: brlcad/trunk/src/libbu/test_vls.c
===================================================================
--- brlcad/trunk/src/libbu/test_vls.c 2012-05-23 20:10:33 UTC (rev 50643)
+++ brlcad/trunk/src/libbu/test_vls.c 2012-05-23 20:48:41 UTC (rev 50644)
@@ -187,10 +187,10 @@
fails += test_vls("%f %F", 1.23, -3.21);
/* from "two-character length modifiers" */
- fails += test_vls("%ld %lld", 123, -123LL);
+ fails += test_vls("%ld %lld", 123, -123);
/* unsigned variant */
- fails += test_vls("%lu %llu", 123, 123LL);
+ fails += test_vls("%lu %llu", 123, 123);
/* ======================================================== */
/* EXPECTED FAILURES ONLY BELOW HERE */
Modified: brlcad/trunk/src/libbu/vls.c
===================================================================
--- brlcad/trunk/src/libbu/vls.c 2012-05-23 20:10:33 UTC (rev 50643)
+++ brlcad/trunk/src/libbu/vls.c 2012-05-23 20:48:41 UTC (rev 50644)
@@ -635,6 +635,7 @@
vp->vls_str[vp->vls_offset + vp->vls_len] = '\0'; /* force null
termination */
}
+
void
bu_vls_trimspace(struct bu_vls *vp)
{
@@ -675,11 +676,11 @@
#define PRECISION 0x0200
/* groups */
-#define SHORTINTMODS (SHORTINT & SHHRTINT)
-#define LONGINTMODS (LONG_INT & LLONGINT)
-#define ALL_INTMODS (SHORTINTMODS & LONGINTMODS)
-#define ALL_DOUBLEMODS (LONGDBLE)
-#define ALL_LENGTHMODS (ALL_INTMODS & ALL_DOUBLEMODS)
+#define SHORTINTMODS (SHORTINT & SHHRTINT)
+#define LONGINTMODS (LONG_INT & LLONGINT)
+#define ALL_INTMODS (SHORTINTMODS & LONGINTMODS)
+#define ALL_DOUBLEMODS (LONGDBLE)
+#define ALL_LENGTHMODS (ALL_INTMODS & ALL_DOUBLEMODS)
/* variables reset for each fmt specifier */
int flags;
@@ -692,7 +693,7 @@
char buf[BUFSIZ] = {0};
struct bu_vls fbuf = BU_VLS_INIT_ZERO; /* % format buffer */
- const char *fbufp = NULL;
+ const char *fbufp = NULL;
if (UNLIKELY(!vls || !fmt || fmt[0] == '\0')) {
/* nothing to print to or from */
@@ -753,6 +754,16 @@
} else {
left_justify = 1;
}
+ } else if (*ep == 'l' || *ep == 'U' || *ep == 'O') {
+ /* clear all length modifiers first */
+ flags ^= ALL_LENGTHMODS;
+ if (flags & LONG_INT) {
+ /* 'l' can be doubled, this step recognizes that */
+ flags |= LLONGINT;
+ } else {
+ /* set the new flag */
+ flags |= LONG_INT;
+ }
} else if (*ep == '*') {
/* the first occurrence is the field width, but the
second occurrence is the precision specifier */
@@ -764,34 +775,22 @@
precision = va_arg(ap, int);
flags |= PRECISION;
}
- } else if (*ep == 'j') {
- flags |= INTMAX_T;
- } else if (*ep == 't') {
- flags |= PTRDIFFT;
- } else if (*ep == 'z') {
- flags |= SIZETINT;
- /* all length or combined length-type modifiers below here */
- } else if (*ep == 'l') {
- /* 'l' can be doubled */
- /* clear all length modifiers AFTER we check for the first 'l'
*/
- if (flags & LONG_INT) {
- flags ^= ALL_LENGTHMODS;
- flags |= LLONGINT;
- assert(sizeof(long long) >= 8);
- } else {
- flags ^= ALL_LENGTHMODS;
- flags |= LONG_INT;
- }
} else if (*ep == 'h') {
- /* 'h' can be doubled */
- /* clear all length modifiers AFTER we check for the first 'h'
*/
+ /* clear all length modifiers first */
+ flags ^= ALL_LENGTHMODS;
if (flags & SHORTINT) {
- flags ^= ALL_LENGTHMODS;
+ /* 'h' can be doubled, this step recognizes that */
flags |= SHHRTINT;
} else {
- flags ^= ALL_LENGTHMODS;
+ /* set the new flag */
flags |= SHORTINT;
}
+ } else if (*ep == 'j') {
+ flags |= INTMAX_T;
+ } else if (*ep == 't') {
+ flags |= PTRDIFFT;
+ } else if (*ep == 'z') {
+ flags |= SIZETINT;
} else if (*ep == 'L') {
/* a length modifier for doubles */
/* clear all length modifiers first */
@@ -799,7 +798,7 @@
/* set the new flag */
flags |= LONGDBLE;
} else
- /* Anything else must be the end of the fmt specifier (the type
)*/
+ /* Anything else must be the end of the fmt specifier */
break;
}
@@ -866,7 +865,7 @@
}
#endif
- /* Grab type parameter from arg list, and print it */
+ /* Grab parameter from arg list, and print it */
switch (*ep) {
case 's':
{
@@ -936,7 +935,7 @@
bu_vls_vlscat(vls, &tmpstr);
bu_vls_free(&tmpstr);
- } else {
+ } else {
/* handle an empty string */
/* FIXME: should we trunc to precision if > fieldlen?
*/
if (flags & FIELDLEN) {
@@ -977,7 +976,7 @@
} else {
bu_vls_vlscat(vls, vp);
}
- } else {
+ } else {
if (flags & FIELDLEN)
bu_vls_strncat(vls, "(null)", (size_t)fieldlen);
else
@@ -1007,7 +1006,7 @@
case 'u':
case 'x':
case 'X':
- if (flags & LONG_INT) {
+ if (flags & LONG_INT) {
/* Unsigned long int */
unsigned long l;
@@ -1058,7 +1057,7 @@
/* Regular unsigned int */
unsigned int j;
- j = va_arg(ap, unsigned int);
+ j = (unsigned int)va_arg(ap, unsigned int);
if (flags & FIELDLEN)
snprintf(buf, BUFSIZ, fbufp, fieldlen, j);
else
@@ -1068,12 +1067,7 @@
break;
case 'd':
case 'i':
- if (1) {
- fprintf(stderr, "DEBUG:\n");
- fprintf(stderr, " ep = '%c'\n", *ep);
- fprintf(stderr, " fbufp = '%s'\n", fbufp);
- }
- if (flags & LONG_INT) {
+ if (flags & LONG_INT) {
/* Long int */
long l;
@@ -1084,17 +1078,16 @@
snprintf(buf, BUFSIZ, fbufp, l);
} else if (flags & LLONGINT) {
/* Long long int */
- long long ll;
+ long long ll;
ll = va_arg(ap, long long);
if (flags & FIELDLEN)
- snprintf(buf, BUFSIZ, fbufp, fieldlen, ll);
+ snprintf(buf, BUFSIZ, fbufp, fieldlen, ll);
else
snprintf(buf, BUFSIZ, fbufp, ll);
} else if (flags & SHORTINT || flags & SHHRTINT) {
/* short int */
short int sh;
-
sh = (short int)va_arg(ap, int);
if (flags & FIELDLEN)
snprintf(buf, BUFSIZ, fbufp, fieldlen, sh);
@@ -1102,7 +1095,6 @@
snprintf(buf, BUFSIZ, fbufp, sh);
} else if (flags & INTMAX_T) {
intmax_t im;
-
im = va_arg(ap, intmax_t);
if (flags & FIELDLEN)
snprintf(buf, BUFSIZ, fbufp, fieldlen, im);
@@ -1110,7 +1102,6 @@
snprintf(buf, BUFSIZ, fbufp, im);
} else if (flags & PTRDIFFT) {
ptrdiff_t pd;
-
pd = va_arg(ap, ptrdiff_t);
if (flags & FIELDLEN)
snprintf(buf, BUFSIZ, fbufp, fieldlen, pd);
@@ -1118,8 +1109,7 @@
snprintf(buf, BUFSIZ, fbufp, pd);
} else if (flags & SIZETINT) {
size_t st;
-
- st = va_arg(ap, size_t);
+ st = va_arg(ap, size_t);
if (flags & FIELDLEN)
snprintf(buf, BUFSIZ, fbufp, fieldlen, st);
else
@@ -1152,9 +1142,8 @@
case '%':
bu_vls_putc(vls, '%');
break;
- default:
- {
- /* Something weird, maybe %c */
+ default: /* Something weird, maybe %c */
+ {
int j;
/* We hope, whatever it is, it fits in an int and the
resulting
Modified: brlcad/trunk/src/tclscripts/mged/openw.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/openw.tcl 2012-05-23 20:10:33 UTC (rev
50643)
+++ brlcad/trunk/src/tclscripts/mged/openw.tcl 2012-05-23 20:48:41 UTC (rev
50644)
@@ -1000,7 +1000,6 @@
update_view_ring_entries $id d
- # the whole menu has either submenus or groups of radio button groups
menu .$id.menubar.settings -title "Settings" -tearoff
$mged_default(tearoff_menus)
.$id.menubar.settings add cascade -label "Mouse Behavior" -underline 0\
-menu .$id.menubar.settings.mouse_behavior
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits