Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
value.cpp
Go to the documentation of this file.
1
29// expand _TEST_EXPORT macros
30#define _RWSTD_TEST_SRC
31
32#include <ctype.h> // for isdigit()
33#include <stdarg.h> // for va_arg, va_list, ...
34#include <stdlib.h> // for strtol()
35#include <string.h> // for size_t, strlen()
36#include <wchar.h> // for wint_t
37
38
39#include <rw_value.h>
40#include <rw_char.h> // for rw_expand()
41#include <rw_printf.h>
42
43
44/* static */ size_t UserClass::count_;
45/* static */ int UserClass::id_gen_; // generates unique non-zero ids
46/* static */ int (*UserClass::gen_)(); // extern "C++" int (*)()
47
48/* static */ size_t UserClass::n_total_def_ctor_;
49/* static */ size_t UserClass::n_total_copy_ctor_;
50/* static */ size_t UserClass::n_total_dtor_;
51/* static */ size_t UserClass::n_total_op_assign_;
52/* static */ size_t UserClass::n_total_op_plus_assign_;
53/* static */ size_t UserClass::n_total_op_minus_assign_;
54/* static */ size_t UserClass::n_total_op_times_assign_;
55/* static */ size_t UserClass::n_total_op_div_assign_;
56/* static */ size_t UserClass::n_total_op_eq_;
57/* static */ size_t UserClass::n_total_op_lt_;
58
59// default values of pointers
60/* static */ size_t* UserClass::def_ctor_throw_ptr_ =
62/* static */ size_t* UserClass::copy_ctor_throw_ptr_ =
64/* static */ size_t* UserClass::dtor_throw_ptr_ =
66/* static */ size_t* UserClass::op_assign_throw_ptr_ =
68/* static */ size_t* UserClass::op_plus_assign_throw_ptr_ =
70/* static */ size_t* UserClass::op_minus_assign_throw_ptr_ =
72/* static */ size_t* UserClass::op_times_assign_throw_ptr_ =
74/* static */ size_t* UserClass::op_div_assign_throw_ptr_ =
76/* static */ size_t* UserClass::op_eq_throw_ptr_ =
78/* static */ size_t* UserClass::op_lt_throw_ptr_ =
80
81// exception throwing initially disabled
82/* static */ size_t UserClass::def_ctor_throw_count_ = size_t (-1);
83/* static */ size_t UserClass::copy_ctor_throw_count_ = size_t (-1);
84/* static */ size_t UserClass::dtor_throw_count_ = size_t (-1);
85/* static */ size_t UserClass::op_assign_throw_count_ = size_t (-1);
86/* static */ size_t UserClass::op_plus_assign_throw_count_ = size_t (-1);
87/* static */ size_t UserClass::op_minus_assign_throw_count_ = size_t (-1);
88/* static */ size_t UserClass::op_times_assign_throw_count_ = size_t (-1);
89/* static */ size_t UserClass::op_div_assign_throw_count_ = size_t (-1);
90/* static */ size_t UserClass::op_eq_throw_count_ = size_t (-1);
91/* static */ size_t UserClass::op_lt_throw_count_ = size_t (-1);
92
93
95 : data_ (), id_ (++id_gen_), origin_ (id_), src_id_ (id_),
96 n_copy_ctor_ (0), n_op_assign_ (0), n_op_eq_ (0), n_op_lt_ (0)
97{
98 // increment the total number of invocations of the default ctor
99 // (do so even if the function throws an exception below)
101
102#ifndef _RWSTD_NO_EXCEPTIONS
103
105 DefCtor ex;
106 ex.id_ = id_;
107 throw ex;
108 }
109
110#endif // _RWSTD_NO_EXCEPTIONS
111
112 // initialize the object's value
113 if (gen_)
114 data_.val_ = gen_ ();
115
116 // increment the number of successfully constructed objects
117 ++count_;
118}
119
120
122 : data_ (rhs.data_), id_ (++id_gen_), origin_ (rhs.origin_),
123 src_id_ (rhs.id_),
124 n_copy_ctor_ (0), n_op_assign_ (0), n_op_eq_ (0), n_op_lt_ (0)
125{
126 // verify id validity
127 RW_ASSERT (rhs.id_ && rhs.id_ < id_gen_);
128
129 // increment the number of times `rhs' has been copied
130 // (do so even if the function throws an exception below)
131 ++_RWSTD_CONST_CAST (UserClass*, &rhs)->n_copy_ctor_;
132
133 // increment the total number of invocations of the copy ctor
134 // (do so even if the function throws an exception below)
136
137#ifndef _RWSTD_NO_EXCEPTIONS
138
139 // throw an exception if the number of calls
140 // to the copy ctor reaches the given value
142 CopyCtor ex;
143 ex.id_ = id_;
144 throw ex;
145 }
146
147#endif // _RWSTD_NO_EXCEPTIONS
148
149 // increment the number of successfully constructed objects
150 ++count_;
151}
152
153
155{
156 // verify id validity
157 RW_ASSERT (id_ && id_ <= id_gen_);
158
159 // increment the total number of invocations of the dtor
160 // (do so even if the function throws an exception below)
162
163#ifndef _RWSTD_NO_EXCEPTIONS
164
165 // throw an exception if the number of calls
166 // to the class dtor reaches the given value
168 Dtor ex;
169 ex.id_ = id_;
170 throw ex;
171 }
172
173#endif // _RWSTD_NO_EXCEPTIONS
174
175 // decrement the number of objects in existence
176 --count_;
177
178 // invalidate id
179 _RWSTD_CONST_CAST (int&, this->id_) = 0;
180}
181
182
183void UserClass::
184assign (assign_op which, const UserClass &rhs)
185{
186 // verify id validity and uniqueness:
187 // a valid id is non-zero (dtor resets)
188 RW_ASSERT (id_ && id_ <= id_gen_);
189 RW_ASSERT (rhs.id_ && rhs.id_ <= id_gen_);
190
191 // no two id's have the same value
192 RW_ASSERT (this == &rhs || id_ != rhs.id_);
193
194 size_t *p_total_op = 0;
195 size_t *p_op = 0;
196 size_t *p_throw = 0;
197
198 Exception *pex = 0;
199
200 OpAssign ex_assign;
201 OpPlusAssign ex_plus_assign;
202 OpMinusAssign ex_minus_assign;
203 OpTimesAssign ex_times_assign;
204 OpDivAssign ex_div_assign;
205
206 int new_val;
207
208 switch (which) {
209 case op_assign:
210 p_total_op = &n_total_op_assign_;
211 p_op = &n_op_assign_;
212 p_throw = op_assign_throw_ptr_;
213 pex = &ex_assign;
214 new_val = rhs.data_.val_;
215 break;
216
217 case op_plus_assign:
218 p_total_op = &n_total_op_plus_assign_;
219 p_op = &n_op_plus_assign_;
221 pex = &ex_plus_assign;
222 new_val = data_.val_ + rhs.data_.val_;
223 break;
224
225 case op_minus_assign:
226 p_total_op = &n_total_op_minus_assign_;
227 p_op = &n_op_minus_assign_;
229 pex = &ex_minus_assign;
230 new_val = data_.val_ - rhs.data_.val_;
231 break;
232
233 case op_times_assign:
234 p_total_op = &n_total_op_times_assign_;
235 p_op = &n_op_times_assign_;
237 pex = &ex_times_assign;
238 new_val = data_.val_ * rhs.data_.val_;
239 break;
240
241 case op_div_assign:
242 p_total_op = &n_total_op_div_assign_;
243 p_op = &n_op_div_assign_;
244 p_throw = op_div_assign_throw_ptr_;
245 pex = &ex_div_assign;
246 new_val = data_.val_ / rhs.data_.val_;
247 break;
248
249 default:
250 // should never get here (silences bogus HP aCC/cadvise
251 // warning #20200-D: Potential null pointer dereference)
252 RW_ASSERT (!"unhandled case");
253 return;
254 }
255
256 // increment the number of invocations of the operator
257 // (do so even if the function throws an exception below)
258
259 ++*p_total_op;
260 ++*p_op;
261
262#ifndef _RWSTD_NO_EXCEPTIONS
263
264 // throw an exception if the number of calls to
265 // the assignment operator reaches the given value
266
267 if (p_throw && *p_throw == *p_total_op) {
268 pex->id_ = id_;
269 throw *pex;
270 }
271
272#endif // _RWSTD_NO_EXCEPTIONS
273
274 // overwrite value and source id only when the operation
275 // is successful (i.e., only when it doesn't throw)
276
277 origin_ = rhs.origin_;
278 src_id_ = rhs.id_;
279 data_.val_ = new_val;
280}
281
282
285{
286 assign (op_assign, rhs);
287
288 return *this;
289}
290
291
294{
295 assign (op_plus_assign, rhs);
296
297 return *this;
298}
299
300
303{
304 assign (op_minus_assign, rhs);
305
306 return *this;
307}
308
309
312{
313 assign (op_times_assign, rhs);
314
315 return *this;
316}
317
318
321{
322 assign (op_div_assign, rhs);
323
324 return *this;
325}
326
327
328bool
330{
331 // verify id validity and uniqueness
332 RW_ASSERT (id_ && id_ <= id_gen_);
333 RW_ASSERT (rhs.id_ && rhs.id_ <= id_gen_);
334 RW_ASSERT (this == &rhs || id_ != rhs.id_);
335
336 // increment the number of times each distinct object
337 // has been used as the argument to operator==
338 // (do so even if the function throws an exception below)
339 ++_RWSTD_CONST_CAST (UserClass*, this)->n_op_eq_;
340
341 if (this != &rhs)
342 ++_RWSTD_CONST_CAST (UserClass*, &rhs)->n_op_eq_;
343
344 // increment the total number of invocations of the operator
345 // (do so even if the function throws an exception below)
347
348#ifndef _RWSTD_NO_EXCEPTIONS
349
350 // throw an exception if the number of calls
351 // to operator== reaches the given value
352
354 OpEq ex;
355 ex.id_ = id_;
356 throw ex;
357 }
358
359#endif // _RWSTD_NO_EXCEPTIONS
360
361 return data_.val_ == rhs.data_.val_;
362}
363
364
365bool
367{
368 // verify id validity and uniqueness
369 RW_ASSERT (id_ && id_ <= id_gen_);
370 RW_ASSERT (rhs.id_ && rhs.id_ <= id_gen_);
371 RW_ASSERT (this == &rhs || id_ != rhs.id_);
372
373 // increment the number of times each distinct object
374 // has been used as the argument to operator<
375 // (do so even if the function throws an exception below)
376 ++_RWSTD_CONST_CAST (UserClass*, this)->n_op_lt_;
377
378 if (this != &rhs)
379 ++_RWSTD_CONST_CAST (UserClass*, &rhs)->n_op_lt_;
380
381 // increment the total number of invocations of the operator
382 // (do so even if the function throws an exception below)
384
385#ifndef _RWSTD_NO_EXCEPTIONS
386
387 // throw an exception if the number of calls
388 // to operator== reaches the given value
389
391 OpLt ex;
392 ex.id_ = id_;
393 throw ex;
394 }
395
396#endif // _RWSTD_NO_EXCEPTIONS
397
398 return data_.val_ < rhs.data_.val_;
399}
400
401
403is_count (size_t n_copy_ctor,
404 size_t n_op_assign,
405 size_t n_op_eq,
406 size_t n_op_lt) const
407{
408 // verify id validity
409 RW_ASSERT (id_ && id_ <= id_gen_);
410
411 return (size_t (-1) == n_copy_ctor || n_copy_ctor_ == n_copy_ctor)
412 && (size_t (-1) == n_op_assign || n_op_assign_ == n_op_assign)
413 && (size_t (-1) == n_op_eq || n_op_eq_ == n_op_eq)
414 && (size_t (-1) == n_op_lt || n_op_lt_ == n_op_lt);
415}
416
417
418/* static */ bool UserClass::
419is_total (size_t cnt,
420 size_t n_def_ctor,
421 size_t n_copy_ctor,
422 size_t n_op_assign,
423 size_t n_op_eq,
424 size_t n_op_lt)
425{
426 return (size_t (-1) == cnt || count_ == cnt)
427 && (size_t (-1) == n_def_ctor || n_total_def_ctor_ == n_def_ctor)
428 && (size_t (-1) == n_copy_ctor || n_total_copy_ctor_ == n_copy_ctor)
429 && (size_t (-1) == n_op_assign || n_total_op_assign_ == n_op_assign)
430 && (size_t (-1) == n_op_eq || n_total_op_eq_ == n_op_eq)
431 && (size_t (-1) == n_op_lt || n_total_op_lt_ == n_op_lt);
432}
433
434
435/* static */ const UserClass*
436UserClass::first_less (const UserClass *xarray, size_t nelems)
437{
438 size_t inx = nelems;
439
440 if (1 < nelems) {
441 for (inx = 1; inx != nelems; ++inx) {
442 if (xarray [inx] < xarray [inx - 1])
443 break;
444 }
445 }
446
447 return inx < nelems ? xarray + inx : 0;
448}
449
450
451/* static */ void
453{
459 n_total_op_lt_ = 0;
460}
461
462
463typedef unsigned char UChar;
464
465template <class T>
466static T*
467__rw_from_char (T*, const char *str, size_t len, bool sorted)
468{
469 // handle null pointers
470 if (!str)
471 return 0;
472
473 // expand source string
474 char str_buf_ [256];
475 size_t strlen_ = sizeof (str_buf_);
476 const char* const str_ = rw_expand (str_buf_, str, len, &strlen_);
477
478 if (sorted) {
479 // verify that the sequence is sorted
480 for (size_t i = 1; i < strlen_; ++i) {
481 if (str_ [i] < str_ [i - 1]) {
482 if (str_buf_ != str_)
483 delete[] str_;
484 return 0;
485 }
486 }
487 }
488
489 T*array = 0;
490
491 _TRY {
492 array = new T [strlen_];
493 }
494 _CATCH (...) {
495
496 if (str_buf_ != str_)
497 delete[] str_;
498
499 _RETHROW;
500 }
501
502 typedef unsigned char UChar;
503
504 // this should trivially hold given the above but the assert
505 // silences bogus HP aCC/cadvise warning #20200-D: Potential
506 // null pointer dereference
507 RW_ASSERT (0 != array);
508
509 for (size_t i = 0; i < strlen_; ++i)
510 array [i].data_.val_ = UChar (str_ [i]);
511
512 if (str_buf_ != str_)
513 delete[] str_;
514
515 return array;
516}
517
518
519template <class T>
520static const T*
521__rw_mismatch (const T *xarray, const char *str, size_t len)
522{
523 if (!str)
524 return xarray;
525
526 if (size_t (-1) == len)
527 len = strlen (str);
528
529 for (size_t i = 0; i != len; ++i) {
530
531 const int val = UChar (str [i]);
532
533 if (val != xarray [i].data_.val_)
534 return xarray + i;
535 }
536
537 return 0;
538}
539
540
541/* static */ UserClass*
542UserClass::from_char (const char *str, size_t len /* = -1 */,
543 bool sorted /* = false */)
544{
545 return __rw_from_char ((UserClass*)0, str, len, sorted);
546}
547
548
549/* static */ const UserClass*
550UserClass::mismatch (const UserClass *xarray, const char *str,
551 size_t len /* = -1 */)
552{
553 return __rw_mismatch (xarray, str, len);
554}
555
556
557/* static */ int
558UserClass::compare (const UserClass *xarray, const char *str,
559 size_t len /* = -1 */)
560{
561 const UserClass* const px = mismatch (xarray, str, len);
562
563 if (px) {
564 RW_ASSERT (size_t (px - xarray) < len);
565
566 return px->data_.val_ - int (UChar (str [px - xarray]));
567 }
568
569 return 0;
570}
571
572
573/* static */ int
574UserClass::compare (const char *str, const UserClass *xarray,
575 size_t len /* = -1 */)
576{
577 return -UserClass::compare (xarray, str, len);
578}
579
580
581/* static */ int
582UserClass::compare (const UserClass *x, const UserClass *y, size_t count)
583{
584 for (size_t i = 0; i != count; ++i) {
585 if (x [i].data_.val_ != y [i].data_.val_)
586 return x [i].data_.val_ - y [i].data_.val_;
587 }
588
589 return 0;
590}
591
592
593/* static */ UserPOD*
594UserPOD::from_char (const char *str, size_t len /* = -1 */,
595 bool sorted /* = false */)
596{
597 return __rw_from_char ((UserPOD*)0, str, len, sorted);
598}
599
600
601/* static */ const UserPOD*
602UserPOD::mismatch (const UserPOD *xarray, const char *str,
603 size_t len /* = -1 */)
604{
605 return __rw_mismatch (xarray, str, len);
606}
607
608
609/* static */ size_t UnaryPredicate::n_total_op_fcall_;
610
611
614{
615 // no-op
616}
617
618
621{
622 // no-op
623}
624
625
628{
629 return *this;
630}
631
632
634{
635 // no-op
636}
637
638
640operator()(const UserClass&) const
641{
643
644 return conv_to_bool::make (true);
645}
646
647
648/* static */ size_t BinaryPredicate::n_total_op_fcall_;
649
650
651BinaryPredicate::
652BinaryPredicate (binary_op op): op_ (op)
653{
654 // no-op
655}
656
657
659{
660 // no-op
661}
662
663
664/* virtual */ conv_to_bool BinaryPredicate::
665operator()(const UserClass &lhs, const UserClass &rhs) /* non-const */
666{
668
669 bool result;
670
671 switch (op_) {
672 case op_equals: result = lhs.data_.val_ == rhs.data_.val_; break;
673 case op_not_equals: result = !(lhs.data_.val_ == rhs.data_.val_); break;
674 case op_less: result = lhs.data_.val_ < rhs.data_.val_; break;
675 case op_less_equal: result = !(rhs.data_.val_ < lhs.data_.val_); break;
676 case op_greater: result = rhs.data_.val_ < lhs.data_.val_; break;
677 case op_greater_equal: result = !(rhs.data_.val_ < lhs.data_.val_); break;
678 }
679
680 return conv_to_bool::make (result);
681}
682
683
684static inline void
685_rw_advance (const void*& parray, int idx, bool is_class)
686{
687 if (is_class)
688 parray = _RWSTD_STATIC_CAST (const UserClass*, parray) + idx;
689 else
690 parray = _RWSTD_STATIC_CAST (const UserPOD*, parray) + idx;
691}
692
693static int
694_rw_fmtxarrayv (char **pbuf, size_t *pbufsize, const char *fmt, va_list va)
695{
696 RW_ASSERT (0 != pbuf);
697 RW_ASSERT (0 != pbufsize);
698 RW_ASSERT (0 != fmt);
699
700 bool fl_plus = false;
701 bool fl_pound = false;
702 int nelems = -1;
703 int cursor = -1;
704
705 const void* pelem = 0;
706
707 // directive syntax:
708 // "X=" [ '#' ] [ '+' ] [ '*' | <n> ] [ '.' [ '*' | '@' | <n> ] ]
709 // where
710 // '#' causes UserClass::id_ to be included in output
711 // ignored for UserPOD
712 // '+' forces UserClass::data_.val_ or UserPOD::data_.val to be
713 // formatted as an integer (otherwise it is formatted as an
714 // (optionally escaped) character '*' or <n> is the number
715 // of elements in the sequence (the first occurrence)
716 // '*', <n> is the offset of the cursor within the sequence
717 // (where the cursor is a pair of pointy brackets
718 // surrounding the element, e.g., >123<)
719 // '@' is the pointer to the element to be surrended by the
720 // pair of pointy brackets
721 // first rw_snprintfa's variable argument of int type should be
722 // sizeof(UserClass) or sizeof(UserPOD)
723
724 if ('X' != fmt [0] || '=' != fmt [1])
725 return _RWSTD_INT_MIN;
726
727 // extract the address of the caller's variable argument list
728 va_list* const pva = va_arg (va, va_list*);
729 RW_ASSERT (0 != pva);
730
731 // process element width
732 const int cwidth = va_arg (*pva, int);
733 RW_ASSERT (sizeof (UserClass) == cwidth || sizeof (UserPOD) == cwidth);
734
735 const bool is_class = (sizeof (UserClass) == cwidth);
736
737 fmt += 2;
738
739 if ('+' == *fmt) {
740 // use numerical formatting for data_.val_
741 fl_plus = true;
742 ++fmt;
743 }
744
745 if ('#' == *fmt) {
746 // include UserClass::id_ in output
747 fl_pound = is_class;
748 ++fmt;
749 }
750
751 if ('*' == *fmt) {
752 // process width
753 // extract the width from rw_snprintfa's variable argument
754 // list pass through to us by the caller
755 nelems = va_arg (*pva, int);
756 ++fmt;
757 }
758 else if (isdigit (*fmt)) {
759 // process positional parameter or width
760 char* end = 0;
761 const int arg = int (strtol (fmt, &end, 10));
762 if ('$' != *end)
763 nelems = arg;
764
765 fmt = end;
766 }
767
768 if ('.' == *fmt) {
769 // process precision (cursor)
770 if ('*' == *++fmt) {
771 // extract the cursor index from rw_snprintfa's variable
772 // argument list passed through to us by the caller
773 cursor = va_arg (*pva, int);
774 ++fmt;
775 }
776 else if ('@' == *fmt) {
777 // extract the pointer from rw_snprintfa's variable argument
778 // list passed through to us by the caller
779 pelem = va_arg (*pva, void*);
780 ++fmt;
781 }
782 else if (isdigit (*fmt)) {
783 char* end = 0;
784 cursor = int (strtol (fmt, &end, 10));
785 fmt = end;
786 }
787 }
788
789 RW_ASSERT ('\0' == *fmt);
790
791 // extract a pointer to UserClass or UserPOD from rw_snprintfa's
792 // variable argument list pass through to us by the caller
793 const void* const xbeg = va_arg (*pva, const void*);
794
795 if (-1 != cursor) {
796 RW_ASSERT (-1 < cursor);
797 RW_ASSERT (0 == pelem);
798
799 pelem = xbeg;
800 _rw_advance (pelem, cursor, is_class);
801 }
802
803 // extract the address where to store the extracted argument
804 // for use by any subsequent positional paramaters
805 const void** const pparam = va_arg (va, const void**);
806 RW_ASSERT (0 != pparam);
807
808 // store the extracted argument
809 *pparam = xbeg;
810
811 // compute the length of the buffer formatted so far
812 const size_t buflen_0 = *pbuf ? strlen (*pbuf) : 0;
813
814 int nbytes = 0;
815
817 // invoke rw_asnprintf() recursively to format our arguments
818 // and append the result to the end of the buffer; pass the
819 // value returned from rw_asnprintf() (i.e., the number of
820 // bytes appended) back to the caller
821
822 const char* pointer [2];
823 const void* px = xbeg;
824
825 for (int i = 0; i != nelems; ++i) {
826
827 if (px == pelem) {
828 pointer [0] = ">";
829 pointer [1] = "<";
830 }
831 else {
832 pointer [0] = "";
833 pointer [1] = "";
834 }
835
836 int id;
837 int val;
838
839 if (is_class) {
840 const UserClass* const pclass =
841 _RWSTD_STATIC_CAST (const UserClass*, px);
842 val = pclass->data_.val_;
843 id = pclass->id_;
844 }
845 else {
846 const UserPOD* const ppod =
847 _RWSTD_STATIC_CAST (const UserPOD*, px);
848 val = ppod->data_.val_;
849 id = 0;
850 }
851
852 const int n =
853 rw_asnprintf (pbuf, pbufsize,
854 "%{+}%s" // '>'
855 "%{?}%d:%{;}"
856 "%{?}%d%s%{?},%{;}%{:}%{lc}%s%{;}",
857 pointer [0], // ">" or ""
858 fl_pound, id, // "<id>:"
859 fl_plus, val, // <val>
860 pointer [1], // "<" or ""
861 i + 1 < nelems, // ','
862 wint_t (val), // <val>
863 pointer [1]); // "<" or ""
864 if (n < 0)
865 return n;
866
867 nbytes += n;
868
869 _rw_advance (px, 1, is_class);
870 }
871
873
874 // compute the new length of the buffer
875 const size_t buflen_1 = *pbuf ? strlen (*pbuf) : 0;
876
877 // assert that the function really appended as many characters
878 // as it said it did (assumes no NULs embedded in the output)
879 // and that it didn't write past the end of the buffer
880 RW_ASSERT (buflen_1 == buflen_0 + nbytes);
881 RW_ASSERT (buflen_1 < *pbufsize);
882
883 return nbytes;
884}
885
886
887static int
888_rw_fmtxarray (char **pbuf, size_t *pbufsize, const char *fmt, ...)
889{
890 va_list va;
891 va_start (va, fmt);
892
893 const int nbytes = _rw_fmtxarrayv (pbuf, pbufsize, fmt, va);
894
895 va_end (va);
896
897 return nbytes;
898}
899
900
901UserClassFmatInit::
902UserClassFmatInit ()
903{
904 // push a new formatter function on top of the stack
905 // of user-defined formatting callbacks invoked by
906 // rw_printf() at al to process extended directives
907 static int format_init = rw_printf ("%{+!}", _rw_fmtxarray);
908
909 _RWSTD_UNUSED (format_init);
910}
void count(T, T, const U &,...)
#define i
Definition 17.names.cpp:126
#define T
Definition 17.names.cpp:163
#define y
Definition 17.names.cpp:141
#define rhs
Definition 17.names.cpp:536
#define cnt
Definition 17.names.cpp:459
#define which
Definition 17.names.cpp:575
#define x
Definition 17.names.cpp:140
#define array
Definition 17.names.cpp:447
#define lhs
Definition 17.names.cpp:489
#define len
Definition 17.names.cpp:488
#define n
Definition 17.names.cpp:130
#define inx
Definition 17.names.cpp:484
#define val
Definition 17.names.cpp:570
volatile int result
void _rw_advance(InputIterator &it, Distance dist)
const int end
#define va_arg(va, T)
#define va_end(ignore)
#define va_start(va, name)
#define _RETHROW
Definition _defs.h:853
#define _RWSTD_UNUSED(arg)
Definition _defs.h:972
#define _RWSTD_STATIC_CAST(T, x)
Definition _defs.h:534
#define _TRY
Definition _defs.h:850
#define _CATCH(ex)
Definition _defs.h:851
#define _RWSTD_CONST_CAST(T, x)
Definition _defs.h:536
A TOML array.
Definition array.hpp:258
const char * str
Definition exec.cpp:170
_TEST_EXPORT char * rw_expand(char *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX, _RWSTD_SIZE_T *=0)
_TEST_EXPORT int rw_printf(const char *,...)
Definition printf.cpp:3412
_TEST_EXPORT int rw_asnprintf(char **pbuf, _RWSTD_SIZE_T *pbufsize, const char *fmt,...)
#define RW_ASSERT(expr)
unsigned char UChar
Definition collate.cpp:122
static _RWSTD_SIZE_T n_total_op_fcall_
Definition rw_value.h:288
virtual ~BinaryPredicate()
Definition value.cpp:658
const ExceptionId id_
virtual ~UnaryPredicate()
Definition value.cpp:633
UnaryPredicate & operator=(const UnaryPredicate &)
Definition value.cpp:627
virtual conv_to_bool operator()(const UserClass &) const
Definition value.cpp:640
static _RWSTD_SIZE_T n_total_op_fcall_
Definition rw_value.h:271
int origin_
Definition rw_value.h:82
_RWSTD_SIZE_T n_copy_ctor_
Definition rw_value.h:90
_RWSTD_SIZE_T n_op_minus_assign_
Definition rw_value.h:102
static _RWSTD_SIZE_T n_total_op_eq_
Definition rw_value.h:132
static _RWSTD_SIZE_T n_total_op_times_assign_
Definition rw_value.h:130
static _RWSTD_SIZE_T * op_minus_assign_throw_ptr_
Definition rw_value.h:156
static _RWSTD_SIZE_T * op_lt_throw_ptr_
Definition rw_value.h:160
static _RWSTD_SIZE_T n_total_dtor_
Definition rw_value.h:126
_RWSTD_SIZE_T n_op_eq_
Definition rw_value.h:114
static _RWSTD_SIZE_T dtor_throw_count_
Definition rw_value.h:165
static _RWSTD_SIZE_T * op_eq_throw_ptr_
Definition rw_value.h:159
~UserClass()
Definition value.cpp:154
static _RWSTD_SIZE_T n_total_op_assign_
Definition rw_value.h:127
bool is_count(_RWSTD_SIZE_T copy_ctor, _RWSTD_SIZE_T op_assign, _RWSTD_SIZE_T op_eq, _RWSTD_SIZE_T op_lt) const
Definition value.cpp:403
const int id_
Definition rw_value.h:81
static _RWSTD_SIZE_T * op_div_assign_throw_ptr_
Definition rw_value.h:158
static const UserClass * mismatch(const UserClass *, const char *, _RWSTD_SIZE_T)
Definition value.cpp:550
_RWSTD_SIZE_T n_op_times_assign_
Definition rw_value.h:106
_RWSTD_SIZE_T n_op_assign_
Definition rw_value.h:94
static _RWSTD_SIZE_T * def_ctor_throw_ptr_
Definition rw_value.h:151
static _RWSTD_SIZE_T * op_plus_assign_throw_ptr_
Definition rw_value.h:155
static UserClass from_char(char c)
Definition rw_value.h:221
static bool is_total(_RWSTD_SIZE_T count, _RWSTD_SIZE_T n_def_ctor, _RWSTD_SIZE_T n_copy_ctor, _RWSTD_SIZE_T n_op_assign, _RWSTD_SIZE_T n_op_eq, _RWSTD_SIZE_T n_op_lt)
Definition value.cpp:419
int src_id_
Definition rw_value.h:85
UserClass & operator-=(const UserClass &)
Definition value.cpp:302
UserClass & operator+=(const UserClass &)
Definition value.cpp:293
static _RWSTD_SIZE_T * copy_ctor_throw_ptr_
Definition rw_value.h:152
_RWSTD_SIZE_T n_op_lt_
Definition rw_value.h:118
UserClass()
Definition value.cpp:94
UserClass & operator=(const UserClass &)
Definition value.cpp:284
static _RWSTD_SIZE_T def_ctor_throw_count_
Definition rw_value.h:163
UserData data_
Definition rw_value.h:79
static _RWSTD_SIZE_T * dtor_throw_ptr_
Definition rw_value.h:153
static _RWSTD_SIZE_T copy_ctor_throw_count_
Definition rw_value.h:164
_RWSTD_SIZE_T n_op_div_assign_
Definition rw_value.h:110
static _RWSTD_SIZE_T n_total_op_minus_assign_
Definition rw_value.h:129
static _RWSTD_SIZE_T op_eq_throw_count_
Definition rw_value.h:171
static _RWSTD_SIZE_T op_times_assign_throw_count_
Definition rw_value.h:169
static _RWSTD_SIZE_T op_plus_assign_throw_count_
Definition rw_value.h:167
static _RWSTD_SIZE_T count_
Definition rw_value.h:120
static _RWSTD_SIZE_T n_total_op_div_assign_
Definition rw_value.h:131
static int id_gen_
Definition rw_value.h:121
UserClass & operator/=(const UserClass &)
Definition value.cpp:320
static _RWSTD_SIZE_T op_lt_throw_count_
Definition rw_value.h:172
static int(* gen_)()
Definition rw_value.h:122
bool operator<(const UserClass &) const
Definition value.cpp:366
UserClass & operator*=(const UserClass &)
Definition value.cpp:311
static _RWSTD_SIZE_T n_total_op_plus_assign_
Definition rw_value.h:128
static _RWSTD_SIZE_T n_total_op_lt_
Definition rw_value.h:133
bool operator==(const UserClass &) const
Definition value.cpp:329
_RWSTD_SIZE_T n_op_plus_assign_
Definition rw_value.h:98
static void reset_totals()
Definition value.cpp:452
static const UserClass * first_less(const UserClass *, _RWSTD_SIZE_T)
Definition value.cpp:436
static int compare(const UserClass *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX)
static _RWSTD_SIZE_T * op_assign_throw_ptr_
Definition rw_value.h:154
static _RWSTD_SIZE_T op_assign_throw_count_
Definition rw_value.h:166
static _RWSTD_SIZE_T op_minus_assign_throw_count_
Definition rw_value.h:168
static _RWSTD_SIZE_T * op_times_assign_throw_ptr_
Definition rw_value.h:157
static _RWSTD_SIZE_T n_total_def_ctor_
Definition rw_value.h:124
static _RWSTD_SIZE_T n_total_copy_ctor_
Definition rw_value.h:125
static _RWSTD_SIZE_T op_div_assign_throw_count_
Definition rw_value.h:170
int val_
Definition rw_value.h:39
static const UserPOD * mismatch(const UserPOD *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX)
Definition value.cpp:602
static UserPOD from_char(char c)
Definition rw_value.h:49
UserData data_
Definition rw_value.h:46
static conv_to_bool make(bool val)
int arg
Definition locale.cpp:2806
unsigned char UChar
Definition value.cpp:463