|
From: Carlo W. <li...@us...> - 2002-01-20 16:25:23
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2002-00-20 16:25:22 UTC
Modified files:
libcwd/debug.cc libcwd/debugmalloc.cc
libcwd/documentation/styles/doxygen.css
libcwd/include/libcw/class_channel_set.h
libcwd/include/libcw/class_debug.h
libcwd/include/libcw/class_debug.inl
libcwd/include/libcw/class_debug_string.h
libcwd/include/libcw/struct_debug_tsd.h
libcwd/testsuite/libcwd.tst/do.cc
libcwd/testsuite/libcwd.tst/do.re
libcwd/testsuite/libcwd.tst/tst.exp libcwd/utils/exec_prog.cc
Log message:
Fixed bug in debug_string_ct::prepend, the length was not increased,
cutting off the last part of the resulting string.
Libcwd now compiles with --enable-libcwd-threading.
---------------------- diff included ----------------------
Index: src/libcwd/debug.cc
diff -u src/libcwd/debug.cc:1.55 src/libcwd/debug.cc:1.56
--- src/libcwd/debug.cc:1.55 Sat Jan 19 18:33:36 2002
+++ src/libcwd/debug.cc Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.55 2002/01/20 02:33:36 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.56 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -77,9 +77,9 @@
int curlen = rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out) - rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
if (curlen > 512 || !(buf = (char*)alloca(curlen)))
{
- set_alloc_checking_off();
+ set_alloc_checking_off(LIBCWD_TSD);
buf = (char*)malloc(curlen);
- set_alloc_checking_on();
+ set_alloc_checking_on(LIBCWD_TSD);
used_malloc = true;
}
rdbuf()->sgetn(buf, curlen);
@@ -98,9 +98,9 @@
#endif
if (used_malloc)
{
- set_alloc_checking_off();
+ set_alloc_checking_off(LIBCWD_TSD);
free(buf);
- set_alloc_checking_on();
+ set_alloc_checking_on(LIBCWD_TSD);
}
}
void store_position(void) {
@@ -446,13 +446,8 @@
size_t debug_string_ct::calculate_capacity(size_t size)
{
size_t capacity_plus_one = M_default_capacity + 1; // For the terminating zero.
- do
- {
- if (size < capacity_plus_one)
- return capacity_plus_one;
+ while(size >= capacity_plus_one)
capacity_plus_one *= 2;
- }
- while(1);
return capacity_plus_one - 1;
}
@@ -472,7 +467,7 @@
void debug_string_ct::internal_assign(char const* str, size_t len)
{
- if (len > M_capacity || (M_capacity >= M_default_capacity && len < M_default_capacity))
+ if (len > M_capacity || (M_capacity > M_default_capacity && len < M_default_capacity))
M_str = (char*)realloc(M_str, (M_capacity = calculate_capacity(len)) + 1);
strncpy(M_str, str, len);
M_size = len;
@@ -481,7 +476,7 @@
void debug_string_ct::internal_append(char const* str, size_t len)
{
- if (M_size + len > M_capacity || (M_capacity >= M_default_capacity && M_size + len < M_default_capacity))
+ if (M_size + len > M_capacity || (M_capacity > M_default_capacity && M_size + len < M_default_capacity))
M_str = (char*)realloc(M_str, (M_capacity = calculate_capacity(M_size + len)) + 1);
strncpy(M_str + M_size, str, len);
M_size += len;
@@ -490,10 +485,11 @@
void debug_string_ct::internal_prepend(char const* str, size_t len)
{
- if (M_size + len > M_capacity || (M_capacity >= M_default_capacity && M_size + len < M_default_capacity))
+ if (M_size + len > M_capacity || (M_capacity > M_default_capacity && M_size + len < M_default_capacity))
M_str = (char*)realloc(M_str, (M_capacity = calculate_capacity(M_size + len)) + 1);
memmove(M_str + len, M_str, M_size + 1);
strncpy(M_str, str, len);
+ M_size += len;
}
/**
@@ -532,7 +528,7 @@
debug_string_stack_element_ct* current_margin_stack = LIBCWD_TSD_MEMBER(M_margin_stack);
set_alloc_checking_off(LIBCWD_TSD);
void* new_debug_string = malloc(sizeof(debug_string_stack_element_ct));
- LIBCWD_TSD_MEMBER(M_margin_stack) = new (new_debug_string) debug_string_stack_element_ct(margin);
+ LIBCWD_TSD_MEMBER(M_margin_stack) = new (new_debug_string) debug_string_stack_element_ct(LIBCWD_TSD_MEMBER(margin));
set_alloc_checking_on(LIBCWD_TSD);
LIBCWD_TSD_MEMBER(M_margin_stack)->next = current_margin_stack;
}
@@ -547,7 +543,7 @@
DoutFatal(dc::core, "Calling `debug_ct::pop_margin' more often than `debug_ct::push_margin'.");
debug_string_stack_element_ct* next = LIBCWD_TSD_MEMBER(M_margin_stack)->next;
set_alloc_checking_off(LIBCWD_TSD);
- margin.internal_swallow(LIBCWD_TSD_MEMBER(M_margin_stack)->debug_string);
+ LIBCWD_TSD_MEMBER(margin).internal_swallow(LIBCWD_TSD_MEMBER(M_margin_stack)->debug_string);
free(LIBCWD_TSD_MEMBER(M_margin_stack));
set_alloc_checking_on(LIBCWD_TSD);
LIBCWD_TSD_MEMBER(M_margin_stack) = next;
@@ -562,7 +558,7 @@
debug_string_stack_element_ct* current_marker_stack = LIBCWD_TSD_MEMBER(M_marker_stack);
set_alloc_checking_off(LIBCWD_TSD);
void* new_debug_string = malloc(sizeof(debug_string_stack_element_ct));
- LIBCWD_TSD_MEMBER(M_marker_stack) = new (new_debug_string) debug_string_stack_element_ct(marker);
+ LIBCWD_TSD_MEMBER(M_marker_stack) = new (new_debug_string) debug_string_stack_element_ct(LIBCWD_TSD_MEMBER(marker));
LIBCWD_TSD_MEMBER(M_marker_stack)->next = current_marker_stack;
}
@@ -576,7 +572,7 @@
DoutFatal(dc::core, "Calling `debug_ct::pop_marker' more often than `debug_ct::push_marker'.");
debug_string_stack_element_ct* next = LIBCWD_TSD_MEMBER(M_marker_stack)->next;
set_alloc_checking_off(LIBCWD_TSD);
- marker.internal_swallow(LIBCWD_TSD_MEMBER(M_marker_stack)->debug_string);
+ LIBCWD_TSD_MEMBER(marker).internal_swallow(LIBCWD_TSD_MEMBER(M_marker_stack)->debug_string);
free(LIBCWD_TSD_MEMBER(M_marker_stack));
set_alloc_checking_on(LIBCWD_TSD);
LIBCWD_TSD_MEMBER(M_marker_stack) = next;
@@ -682,17 +678,17 @@
// Handle most common case first: no special flags set
if (!(channel_set.mask & (noprefix_cf|nolabel_cf|blank_margin_cf|blank_label_cf|blank_marker_cf)))
{
- current_oss->write(debug_object.margin.c_str(), debug_object.margin.size());
+ current_oss->write(margin.c_str(), margin.size());
current_oss->write(channel_set.label, WST_max_len);
- current_oss->write(debug_object.marker.c_str(), debug_object.marker.size());
+ current_oss->write(marker.c_str(), marker.size());
write_whitespace_to(*current_oss, indent);
}
else if (!(channel_set.mask & noprefix_cf))
{
if ((channel_set.mask & blank_margin_cf))
- write_whitespace_to(*current_oss, debug_object.margin.size());
+ write_whitespace_to(*current_oss, margin.size());
else
- current_oss->write(debug_object.margin.c_str(), debug_object.margin.size());
+ current_oss->write(margin.c_str(), margin.size());
#ifndef DEBUGDEBUGOUTPUT
if (!(channel_set.mask & nolabel_cf))
#endif
@@ -702,9 +698,9 @@
else
current_oss->write(channel_set.label, WST_max_len);
if ((channel_set.mask & blank_marker_cf))
- write_whitespace_to(*current_oss, debug_object.marker.size());
+ write_whitespace_to(*current_oss, marker.size());
else
- current_oss->write(debug_object.marker.c_str(), debug_object.marker.size());
+ current_oss->write(marker.c_str(), marker.size());
write_whitespace_to(*current_oss, indent);
}
}
@@ -876,8 +872,6 @@
#ifndef LIBCWD_THREAD_SAFE
tsd.init();
#endif
- margin.NS_internal_init("", 0);
- marker.NS_internal_init(": ", 2);
set_alloc_checking_on(LIBCWD_TSD);
// This set current_oss and must be called after tsd.init().
@@ -913,6 +907,10 @@
void debug_tsd_st::init(void)
{
+#ifdef DEBUGDEBUGMALLOC
+ LIBCWD_TSD_DECLARATION
+ LIBCWD_ASSERT( __libcwd_tsd.internal );
+#endif
_off = 0; // Turn off all debugging until initialization is completed.
DEBUGDEBUG_CERR( "In debug_tsd_st::NS_init(void), _off set to 0" );
@@ -943,6 +941,8 @@
#endif
laf_stack.init();
continued_stack.init();
+ margin.NS_internal_init("", 0);
+ marker.NS_internal_init(": ", 2);
#ifdef DEBUGDEBUGOUTPUT
_off = -1; // Print as much debug output as possible right away.
@@ -966,13 +966,11 @@
++_off; // Turn all debug output premanently off, otherwise we might re-initialize
// this object again when we try to write debug output to it!
DEBUGDEBUG_CERR( "debug_tsd_st destructed: _off became " << _off );
-#ifdef LIBCWD_THREAD_SAFE
LIBCWD_TSD_DECLARATION
set_alloc_checking_off(LIBCWD_TSD);
marker.ST_internal_deinit();
margin.ST_internal_deinit();
set_alloc_checking_on(LIBCWD_TSD);
-#endif
tsd_initialized = false;
}
@@ -987,10 +985,6 @@
#endif
LIBCWD_TSD_DECLARATION
set_alloc_checking_off(LIBCWD_TSD);
-#ifndef LIBCWD_THREAD_SAFE
- marker.ST_internal_deinit();
- margin.ST_internal_deinit();
-#endif
DEBUG_OBJECTS_ACQUIRE_WRITE_LOCK
{
_private_::debug_objects_ct::container_type& objects(_private_::debug_objects.write_locked());
@@ -1354,6 +1348,7 @@
void debug_ct::restore(debug_ct::OnOffState const& state)
{
+ LIBCWD_TSD_DECLARATION
#ifdef DEBUGDEBUGOUTPUT
if (state.first_time != LIBCWD_TSD_MEMBER(first_time)) // state.first_time && !first_time.
core_dump(); // on() was called without first a call to off().
Index: src/libcwd/debugmalloc.cc
diff -u src/libcwd/debugmalloc.cc:1.74 src/libcwd/debugmalloc.cc:1.75
--- src/libcwd/debugmalloc.cc:1.74 Fri Jan 18 21:08:54 2002
+++ src/libcwd/debugmalloc.cc Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.74 2002/01/19 05:08:54 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debugmalloc.cc,v 1.75 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -1793,7 +1793,7 @@
if ((*iter).second.a_alloc_node.get()->next_list())
{
libcw_do.push_margin();
- libcw_do.margin.append(" * ", 4);
+ libcw_do.margin().append(" * ", 4);
Dout( dc::warning, "Memory leak detected!" );
(*iter).second.a_alloc_node.get()->next_list()->show_alloc_list(1, channels::dc::warning);
libcw_do.pop_margin();
Index: src/libcwd/documentation/styles/doxygen.css
diff -u src/libcwd/documentation/styles/doxygen.css:1.2 src/libcwd/documentation/styles/doxygen.css:1.3
--- src/libcwd/documentation/styles/doxygen.css:1.2 Sat Dec 29 20:17:48 2001
+++ src/libcwd/documentation/styles/doxygen.css Sun Jan 20 08:25:11 2002
@@ -17,7 +17,7 @@
A.el {
text-decoration : none;
- font-weight : bold
+ font-weight : normal;
}
A.elRef {
Index: src/libcwd/include/libcw/class_channel_set.h
diff -u src/libcwd/include/libcw/class_channel_set.h:1.3 src/libcwd/include/libcw/class_channel_set.h:1.4
--- src/libcwd/include/libcw/class_channel_set.h:1.3 Fri Jan 18 21:08:54 2002
+++ src/libcwd/include/libcw/class_channel_set.h Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_channel_set.h,v 1.3 2002/01/19 05:08:54 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_channel_set.h,v 1.4 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -39,7 +39,7 @@
//===================================================================================================
// struct channel_set_data_st
//
-// The attributes of channel_set_st and continued_channel_set_st
+// The attributes of channel_set_bootstrap_st, channel_set_st and continued_channel_set_st
//
struct channel_set_data_st {
@@ -62,21 +62,50 @@
};
//===================================================================================================
-// struct continued_channel_set_st
+// struct channel_set_bootstrap_st
//
-// The debug output target; a combination of channels and control bits.
+// This is the left-most type of channel 'control' series
+// existing of <channel_set_bootstrap_st>|<one or more channels>|<optional control flags>.
+// It is used in macro LibcwdDoutScopeStart.
+//
+// LibcwDoutFatal uses operator& while LibcwDout uses operator|.
+//
+// The return type is a cast of this object to
+// either a channel_set_st (the normal case) or a
+// continued_channel_set_st in the case that the
+// special debug channel dc::continued was used.
//
-struct continued_channel_set_st : public channel_set_data_st {
+class channel_ct;
+class fatal_channel_ct;
+class continued_channel_ct;
+class always_channel_ct;
+struct channel_set_st;
+struct continued_channel_set_st;
+
+struct channel_set_bootstrap_st : public channel_set_data_st {
// Warning: This struct may not have attributes of its own!
public:
- continued_channel_set_st& operator|(control_flag_t cf);
+ channel_set_bootstrap_st(debug_tsd_st& do_tsd LIBCWD_COMMA_TSD_PARAM) { do_tsd_ptr = &do_tsd; }
+
+ //-------------------------------------------------------------------------------------------------
+ // Operators that combine channels/control bits.
+ //
+
+ channel_set_st& operator|(channel_ct const& dc);
+ channel_set_st& operator|(always_channel_ct const& adc);
+ channel_set_st& operator&(fatal_channel_ct const& fdc); // Using operator& just to detect that we indeed used LibcwDoutFatal!
+ continued_channel_set_st& operator|(continued_channel_ct const& cdc);
+ channel_set_st& operator|(fatal_channel_ct const&);
+ channel_set_st& operator&(channel_ct const&);
};
//===================================================================================================
// struct channel_set_st
//
// The debug output target; a combination of channels and control bits.
+// The final result of a series of <channel>|<control flag>|...
+// is passed to struct_debug_tsd_st::start().
//
struct channel_set_st : public channel_set_data_st {
@@ -89,31 +118,15 @@
};
//===================================================================================================
-// struct channel_set_bootstrap_st
+// struct continued_channel_set_st
//
-// The debug output target; a combination of channels and control bits.
+// The channel set type used for a series that starts with dc::continued.
//
-
-class channel_ct;
-class fatal_channel_ct;
-class continued_channel_ct;
-class always_channel_ct;
-struct channel_set_bootstrap_st : public channel_set_data_st {
+struct continued_channel_set_st : public channel_set_data_st {
// Warning: This struct may not have attributes of its own!
public:
- channel_set_bootstrap_st(debug_tsd_st& do_tsd LIBCWD_COMMA_TSD_PARAM) { do_tsd_ptr = &do_tsd; }
-
- //-------------------------------------------------------------------------------------------------
- // Operators that combine channels/control bits.
- //
-
- channel_set_st& operator|(channel_ct const& dc);
- channel_set_st& operator|(always_channel_ct const& adc);
- channel_set_st& operator&(fatal_channel_ct const& fdc); // Using operator& just to detect that we indeed used LibcwDoutFatal!
- continued_channel_set_st& operator|(continued_channel_ct const& cdc);
- channel_set_st& operator|(fatal_channel_ct const&);
- channel_set_st& operator&(channel_ct const&);
+ continued_channel_set_st& operator|(control_flag_t cf);
};
} // namespace debug
Index: src/libcwd/include/libcw/class_debug.h
diff -u src/libcwd/include/libcw/class_debug.h:1.5 src/libcwd/include/libcw/class_debug.h:1.6
--- src/libcwd/include/libcw/class_debug.h:1.5 Fri Jan 18 21:08:54 2002
+++ src/libcwd/include/libcw/class_debug.h Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_debug.h,v 1.5 2002/01/19 05:08:54 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_debug.h,v 1.6 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2000 - 2002, by
//
@@ -113,14 +113,8 @@
* \sa push_margin()
* \n pop_margin()
*/
-#if defined(LIBCWD_THREAD_SAFE) && !defined(LIBCW_DOXYGEN)
- struct TS_margin_st {
- __inline__ operator debug_string_ct& (void);
- __inline__ operator debug_string_ct const& (void) const;
- } margin;
-#else
- debug_string_ct margin;
-#endif
+ debug_string_ct& margin(void);
+ debug_string_ct const& margin(void) const;
/**
* \brief The marker
@@ -131,14 +125,8 @@
* \sa push_marker()
* \n pop_marker()
*/
-#if defined(LIBCWD_THREAD_SAFE) && !defined(LIBCW_DOXYGEN)
- struct TS_marker_st {
- __inline__ operator debug_string_ct& (void);
- __inline__ operator debug_string_ct const& (void) const;
- } marker;
-#else
- debug_string_ct marker;
-#endif
+ debug_string_ct& marker(void);
+ debug_string_ct const& marker(void) const;
/** \} */
Index: src/libcwd/include/libcw/class_debug.inl
diff -u src/libcwd/include/libcw/class_debug.inl:1.4 src/libcwd/include/libcw/class_debug.inl:1.5
--- src/libcwd/include/libcw/class_debug.inl:1.4 Sat Jan 19 18:33:36 2002
+++ src/libcwd/include/libcw/class_debug.inl Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_debug.inl,v 1.4 2002/01/20 02:33:36 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_debug.inl,v 1.5 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -39,22 +39,54 @@
/** \addtogroup group_formatting */
/* \{ */
+__inline__
+debug_string_ct&
+debug_ct::margin(void)
+{
+ LIBCWD_TSD_DECLARATION
+ return LIBCWD_TSD_MEMBER(margin);
+}
+
+__inline__
+debug_string_ct const&
+debug_ct::margin(void) const
+{
+ LIBCWD_TSD_DECLARATION
+ return LIBCWD_TSD_MEMBER(margin);
+}
+
+__inline__
+debug_string_ct&
+debug_ct::marker(void)
+{
+ LIBCWD_TSD_DECLARATION
+ return LIBCWD_TSD_MEMBER(marker);
+}
+
+__inline__
+debug_string_ct const&
+debug_ct::marker(void) const
+{
+ LIBCWD_TSD_DECLARATION
+ return LIBCWD_TSD_MEMBER(marker);
+}
+
// This is here only for backwards compatibility.
-// You should call margin.assign() directly.
+// You should call margin().assign(s) directly.
__inline__
void
debug_ct::set_margin(std::string const& s)
{
- margin.assign(s);
+ margin().assign(s);
}
// This is here only for backwards compatibility.
-// You should call marker.assign() directly.
+// You should call marker().assign(s) directly.
__inline__
void
debug_ct::set_marker(std::string const& s)
{
- marker.assign(s);
+ marker().assign(s);
}
/**
@@ -108,7 +140,7 @@
std::string
debug_ct::get_margin(void) const
{
- return std::string(margin.c_str(), margin.size());
+ return std::string(margin().c_str(), margin().size());
}
// This is here only for backwards compatibility.
@@ -117,7 +149,7 @@
std::string
debug_ct::get_marker(void) const
{
- return std::string(marker.c_str(), marker.size());
+ return std::string(marker().c_str(), marker().size());
}
/** \} */
Index: src/libcwd/include/libcw/class_debug_string.h
diff -u src/libcwd/include/libcw/class_debug_string.h:1.3 src/libcwd/include/libcw/class_debug_string.h:1.4
--- src/libcwd/include/libcw/class_debug_string.h:1.3 Fri Jan 18 21:08:54 2002
+++ src/libcwd/include/libcw/class_debug_string.h Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_debug_string.h,v 1.3 2002/01/19 05:08:54 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_debug_string.h,v 1.4 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -47,6 +47,8 @@
* This type is used for the public attributes debug_ct::margin and debug_ct::marker of the %debug object class.
*/
class debug_string_ct {
+ friend class debug_ct; // Needs access to the private functions.
+ friend struct debug_tsd_st;
private:
char* M_str; // Pointer to malloc-ed (zero terminated) string.
size_t M_size; // Size of string (exclusive terminating zero).
@@ -61,11 +63,6 @@
void internal_swallow(debug_string_ct const&);
private:
-#ifdef LIBCWD_THREAD_SAFE
- friend struct debug_tsd_st;
-#else
- friend class debug_ct;
-#endif
void NS_internal_init(char const* s, size_t l);
void ST_internal_deinit(void);
debug_string_ct(void) { }
Index: src/libcwd/include/libcw/struct_debug_tsd.h
diff -u src/libcwd/include/libcw/struct_debug_tsd.h:1.2 src/libcwd/include/libcw/struct_debug_tsd.h:1.3
--- src/libcwd/include/libcw/struct_debug_tsd.h:1.2 Sat Jan 19 18:33:36 2002
+++ src/libcwd/include/libcw/struct_debug_tsd.h Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/struct_debug_tsd.h,v 1.2 2002/01/20 02:33:36 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/struct_debug_tsd.h,v 1.3 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2002, by
//
@@ -86,10 +86,11 @@
_private_::debug_stack_tst<int> continued_stack;
// Stores the number of nested and switched off continued channels.
-#ifdef LIBCWD_THREAD_SAFE
debug_string_ct margin;
+ // The margin string.
+
debug_string_ct marker;
-#endif
+ // The marker string.
debug_string_stack_element_ct* M_margin_stack;
// Pointer to list of pushed margins.
Index: src/libcwd/testsuite/libcwd.tst/do.cc
diff -u src/libcwd/testsuite/libcwd.tst/do.cc:1.18 src/libcwd/testsuite/libcwd.tst/do.cc:1.19
--- src/libcwd/testsuite/libcwd.tst/do.cc:1.18 Wed Jan 9 21:04:34 2002
+++ src/libcwd/testsuite/libcwd.tst/do.cc Sun Jan 20 08:25:11 2002
@@ -89,13 +89,13 @@
// 1.1.2.2 Setting the prefix formatting attributes
- Debug( libcw_do.set_margin("***********libcw_do*") );
- Debug( my_own_do.set_margin("**********my_own_do*") );
- Debug( example::my_own_do.set_margin("*example::my_own_do*") );
-
- Debug( libcw_do.set_marker("|marker1|") );
- Debug( my_own_do.set_marker("|marker2|") );
- Debug( example::my_own_do.set_marker("|marker3|") );
+ Debug( libcw_do.margin().assign("***********libcw_do*", 20) );
+ Debug( my_own_do.margin().assign("**********my_own_do*", 20) );
+ Debug( example::my_own_do.margin().assign("*example::my_own_do*", 20) );
+
+ Debug( libcw_do.marker().assign("|marker1|", 9) );
+ Debug( my_own_do.marker().assign("|marker2|", 9) );
+ Debug( example::my_own_do.marker().assign("|marker3|", 9) );
Dout(dc::debug, "No indent");
Dout(dc::notice, "No indent");
@@ -107,9 +107,9 @@
// 1.1.2.3 Retrieving the prefix formatting attributes
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
// Manipulating the format strings.
@@ -117,75 +117,75 @@
Debug( my_own_do.push_margin() );
Debug( example::my_own_do.push_margin() );
- Debug( libcw_do.margin.append("1Alibcw_do1") );
- Debug( my_own_do.margin.append("1Amy_own_do1") );
- Debug( example::my_own_do.margin.append("1Aexample::my_own_do1") );
-
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
-
- Debug( libcw_do.margin.prepend("1Plibcw_do1") );
- Debug( my_own_do.margin.prepend("1Pmy_own_do1") );
- Debug( example::my_own_do.margin.prepend("1Pexample::my_own_do1") );
+ Debug( libcw_do.margin().append("1Alibcw_do1", 11) );
+ Debug( my_own_do.margin().append("1Amy_own_do1", 12) );
+ Debug( example::my_own_do.margin().append("1Aexample::my_own_do1", 21) );
+
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
+
+ Debug( libcw_do.margin().prepend("1Plibcw_do1", 11) );
+ Debug( my_own_do.margin().prepend("1Pmy_own_do1", 12) );
+ Debug( example::my_own_do.margin().prepend("1Pexample::my_own_do1", 21) );
Debug( libcw_do.push_margin() );
Debug( my_own_do.push_margin() );
Debug( example::my_own_do.push_margin() );
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
-
- Debug( libcw_do.margin.assign("", 0) );
- Debug( my_own_do.margin.assign("*", 1) );
- Debug( example::my_own_do.margin.assign("XYZ", 3) );
-
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
-
- Debug( libcw_do.margin.append("2Alibcw_do2") );
- Debug( my_own_do.margin.append("2Amy_own_do2") );
- Debug( example::my_own_do.margin.append("2Aexample::my_own_do2") );
-
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
+
+ Debug( libcw_do.margin().assign("", 0) );
+ Debug( my_own_do.margin().assign("*", 1) );
+ Debug( example::my_own_do.margin().assign("XYZ", 3) );
+
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
+
+ Debug( libcw_do.margin().append("2Alibcw_do2", 11) );
+ Debug( my_own_do.margin().append("2Amy_own_do2", 12) );
+ Debug( example::my_own_do.margin().append("2Aexample::my_own_do2", 21) );
+
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
Debug( libcw_do.pop_margin() );
Debug( my_own_do.pop_margin() );
Debug( example::my_own_do.pop_margin() );
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
-
- Debug( libcw_do.margin.append("3Alibcw_do3") );
- Debug( my_own_do.margin.append("3Amy_own_do3") );
- Debug( example::my_own_do.margin.append("3Aexample::my_own_do3") );
-
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
+
+ Debug( libcw_do.margin().append("3Alibcw_do3", 11) );
+ Debug( my_own_do.margin().append("3Amy_own_do3", 12) );
+ Debug( example::my_own_do.margin().append("3Aexample::my_own_do3", 21) );
+
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
Debug( libcw_do.pop_margin() );
Debug( my_own_do.pop_margin() );
Debug( example::my_own_do.pop_margin() );
- Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.get_margin() << "\", \"" << libcw::debug::libcw_do.get_marker() << "\".");
- MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.get_margin() << "\", \"" << my_own_do.get_marker() << "\".");
- ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.get_margin() << "\", \"" << example::my_own_do.get_marker() << "\".");
+ Dout(dc::warning, "Dout text " << libcw::debug::libcw_do.get_indent() << ", \"" << libcw::debug::libcw_do.margin().c_str() << "\", \"" << libcw::debug::libcw_do.marker().c_str() << "\".");
+ MyOwnDout(dc::warning, "MyOwnDout text " << my_own_do.get_indent() << ", \"" << my_own_do.margin().c_str() << "\", \"" << my_own_do.marker().c_str() << "\".");
+ ExampleDout(dc::warning, "ExampleDout text " << example::my_own_do.get_indent() << ", \"" << example::my_own_do.margin().c_str() << "\", \"" << example::my_own_do.marker().c_str() << "\".");
// 1.1.2.4 Setting and getting the output stream
- Debug( libcw_do.set_margin("> ") );
- Debug( my_own_do.set_margin("* ") );
- Debug( example::my_own_do.set_margin("- ") );
-
- Debug( libcw_do.set_marker(": ") );
- Debug( my_own_do.set_marker(": ") );
- Debug( example::my_own_do.set_marker(": ") );
+ Debug( libcw_do.margin().assign("> ", 2) );
+ Debug( my_own_do.margin().assign("* ", 2) );
+ Debug( example::my_own_do.margin().assign("- ", 2) );
+
+ Debug( libcw_do.marker().assign(": ", 2) );
+ Debug( my_own_do.marker().assign(": ", 2) );
+ Debug( example::my_own_do.marker().assign(": ", 2) );
Debug( libcw_do.set_indent(0) );
Debug( my_own_do.set_indent(0) );
Index: src/libcwd/testsuite/libcwd.tst/do.re
diff -u src/libcwd/testsuite/libcwd.tst/do.re:1.9 src/libcwd/testsuite/libcwd.tst/do.re:1.10
--- src/libcwd/testsuite/libcwd.tst/do.re:1.9 Tue Jan 8 18:20:52 2002
+++ src/libcwd/testsuite/libcwd.tst/do.re Sun Jan 20 08:25:11 2002
@@ -30,21 +30,21 @@
***********libcw_do*1Alibcw_do1WARNING |marker1| Dout text 8, "***********libcw_do*1Alibcw_do1", "|marker1|".
**********my_own_do*1Amy_own_do1WARNING |marker2| MyOwnDout text 11, "**********my_own_do*1Amy_own_do1", "|marker2|".
*example::my_own_do*1Aexample::my_own_do1WARNING |marker3| ExampleDout text 13, "*example::my_own_do*1Aexample::my_own_do1", "|marker3|".
-1Plibcw_do1***********libcw_do*WARNING |marker1| Dout text 8, "1Plibcw_do1***********libcw_do*", "|marker1|".
-1Pmy_own_do1**********my_own_do*WARNING |marker2| MyOwnDout text 11, "1Pmy_own_do1**********my_own_do*", "|marker2|".
-1Pexample::my_own_do1*example::my_own_do*WARNING |marker3| ExampleDout text 13, "1Pexample::my_own_do1*example::my_own_do*", "|marker3|".
+1Plibcw_do1***********libcw_do*1Alibcw_do1WARNING |marker1| Dout text 8, "1Plibcw_do1***********libcw_do*1Alibcw_do1", "|marker1|".
+1Pmy_own_do1**********my_own_do*1Amy_own_do1WARNING |marker2| MyOwnDout text 11, "1Pmy_own_do1**********my_own_do*1Amy_own_do1", "|marker2|".
+1Pexample::my_own_do1*example::my_own_do*1Aexample::my_own_do1WARNING |marker3| ExampleDout text 13, "1Pexample::my_own_do1*example::my_own_do*1Aexample::my_own_do1", "|marker3|".
WARNING |marker1| Dout text 8, "", "|marker1|".
*WARNING |marker2| MyOwnDout text 11, "*", "|marker2|".
XYZWARNING |marker3| ExampleDout text 13, "XYZ", "|marker3|".
2Alibcw_do2WARNING |marker1| Dout text 8, "2Alibcw_do2", "|marker1|".
*2Amy_own_do2WARNING |marker2| MyOwnDout text 11, "*2Amy_own_do2", "|marker2|".
XYZ2Aexample::my_own_do2WARNING |marker3| ExampleDout text 13, "XYZ2Aexample::my_own_do2", "|marker3|".
-1Plibcw_do1***********libcw_do*WARNING |marker1| Dout text 8, "1Plibcw_do1***********libcw_do*", "|marker1|".
-1Pmy_own_do1**********my_own_do*WARNING |marker2| MyOwnDout text 11, "1Pmy_own_do1**********my_own_do*", "|marker2|".
-1Pexample::my_own_do1*example::my_own_do*WARNING |marker3| ExampleDout text 13, "1Pexample::my_own_do1*example::my_own_do*", "|marker3|".
-1Plibcw_do1***********libcw_do*3Alibcw_do3WARNING |marker1| Dout text 8, "1Plibcw_do1***********libcw_do*3Alibcw_do3", "|marker1|".
-1Pmy_own_do1**********my_own_do*3Amy_own_do3WARNING |marker2| MyOwnDout text 11, "1Pmy_own_do1**********my_own_do*3Amy_own_do3", "|marker2|".
-1Pexample::my_own_do1*example::my_own_do*3Aexample::my_own_do3WARNING |marker3| ExampleDout text 13, "1Pexample::my_own_do1*example::my_own_do*3Aexample::my_own_do3", "|marker3|".
+1Plibcw_do1***********libcw_do*1Alibcw_do1WARNING |marker1| Dout text 8, "1Plibcw_do1***********libcw_do*1Alibcw_do1", "|marker1|".
+1Pmy_own_do1**********my_own_do*1Amy_own_do1WARNING |marker2| MyOwnDout text 11, "1Pmy_own_do1**********my_own_do*1Amy_own_do1", "|marker2|".
+1Pexample::my_own_do1*example::my_own_do*1Aexample::my_own_do1WARNING |marker3| ExampleDout text 13, "1Pexample::my_own_do1*example::my_own_do*1Aexample::my_own_do1", "|marker3|".
+1Plibcw_do1***********libcw_do*1Alibcw_do13Alibcw_do3WARNING |marker1| Dout text 8, "1Plibcw_do1***********libcw_do*1Alibcw_do13Alibcw_do3", "|marker1|".
+1Pmy_own_do1**********my_own_do*1Amy_own_do13Amy_own_do3WARNING |marker2| MyOwnDout text 11, "1Pmy_own_do1**********my_own_do*1Amy_own_do13Amy_own_do3", "|marker2|".
+1Pexample::my_own_do1*example::my_own_do*1Aexample::my_own_do13Aexample::my_own_do3WARNING |marker3| ExampleDout text 13, "1Pexample::my_own_do1*example::my_own_do*1Aexample::my_own_do13Aexample::my_own_do3", "|marker3|".
***********libcw_do*WARNING |marker1| Dout text 8, "***********libcw_do*", "|marker1|".
**********my_own_do*WARNING |marker2| MyOwnDout text 11, "**********my_own_do*", "|marker2|".
*example::my_own_do*WARNING |marker3| ExampleDout text 13, "*example::my_own_do*", "|marker3|".
Index: src/libcwd/testsuite/libcwd.tst/tst.exp
diff -u src/libcwd/testsuite/libcwd.tst/tst.exp:1.2 src/libcwd/testsuite/libcwd.tst/tst.exp:1.3
--- src/libcwd/testsuite/libcwd.tst/tst.exp:1.2 Fri Jan 18 21:08:54 2002
+++ src/libcwd/testsuite/libcwd.tst/tst.exp Sun Jan 20 08:25:11 2002
@@ -2,7 +2,7 @@
global SHAREDLIBS STATICLIBS
catch "glob -nocomplain $srcdir/$subdir/*.cc" srcfiles
-# set srcfiles $srcdir/$subdir/continued.cc
+# set srcfiles $srcdir/$subdir/do.cc
verbose "srcfiles are $srcfiles"
set prefix ""
Index: src/libcwd/utils/exec_prog.cc
diff -u src/libcwd/utils/exec_prog.cc:1.22 src/libcwd/utils/exec_prog.cc:1.23
--- src/libcwd/utils/exec_prog.cc:1.22 Fri Jan 18 21:08:54 2002
+++ src/libcwd/utils/exec_prog.cc Sun Jan 20 08:25:11 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/utils/exec_prog.cc,v 1.22 2002/01/19 05:08:54 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/utils/exec_prog.cc,v 1.23 2002/01/20 16:25:11 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -156,8 +156,8 @@
#else // !__GLIBCPP__
std::ofstream debug_stream(debug_filedes[1]);
#endif // !__GLIBCPP__
- Debug( libcw_do.margin.assign(prog_name, strlen(prog_name)) );
- Debug( libcw_do.margin.append(": ", 2) );
+ Debug( libcw_do.margin().assign(prog_name, strlen(prog_name)) );
+ Debug( libcw_do.margin().append(": ", 2) );
Debug( libcw_do.set_ostream(&debug_stream) );
#endif // CWDEBUG
// Child process
----------------------- End of diff -----------------------
|