xref: /trunk/main/sal/rtl/source/tres.c (revision 78190a370f7d7129fed9a7e70ca122eaae71ce1d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include <stdio.h>
23 #include <rtl/tres.h>
24 #include <osl/diagnose.h>
25 #include <osl/time.h>
26 
27  /* force an assertion on false state */
28 #define TST_BOOM(c, m)  OSL_ENSURE(c, m)
29 
30 
31 typedef struct _rtl_CmpState
32 {
33     struct _rtl_CmpState*   m_next;
34     struct _rtl_CmpState*   m_prev;
35 
36     sal_Bool                m_stat;
37     rtl_String*             m_msg;
38 
39 } rtl_CmpState;
40 
41 typedef struct _rtl_FuncState
42 {
43     struct _rtl_FuncState*  m_next;
44     struct _rtl_FuncState*  m_prev;
45     rtl_String*             m_name;
46     sal_uInt32              m_flags;
47     sal_uInt32              m_start;
48     sal_uInt32              m_stop;
49     struct _rtl_CmpState*   m_cmp;
50 
51 } rtl_FuncState;
52 
53 
54 
55 typedef struct _rtl_TestResult_Data
56 {
57     rtl_TestResult_vtable*  m_funcs;
58     void*                   m_externaldata;
59 
60     rtl_FuncState*   m_state;
61 
62 } rtl_TestResult_Data;
63 
64 
65  /**
66   * internal helper functions
67   */
68 
69  /* ...to create, link, unlink and destroy allocated memory */
70 rtl_FuncState* SAL_CALL rtl_tres_create_funcstate( const sal_Char* meth );
71 rtl_FuncState* SAL_CALL rtl_tres_link_funcstate( rtl_FuncState* ptr,
72                                                     rtl_FuncState* plink );
73 rtl_FuncState* SAL_CALL rtl_tres_unlink_funcstate( rtl_FuncState* plink );
74 rtl_CmpState* SAL_CALL rtl_tres_create_cmpstate(
75                                                 sal_Bool state,
76                                                 const sal_Char* msg
77                                                 );
78 rtl_CmpState* SAL_CALL rtl_tres_link_cmpstate( rtl_CmpState* ptr,
79                                                     rtl_CmpState* plink );
80 rtl_CmpState* SAL_CALL rtl_tres_unlink_cmpstate( rtl_CmpState* plink );
81 sal_uInt32 SAL_CALL rtl_tres_timer();
82 void SAL_CALL rtl_tres_destroy_funcstate( rtl_FuncState* pState_ );
83 void SAL_CALL rtl_tres_destroy_funcstates( rtl_FuncState* pState_ );
84 void SAL_CALL rtl_tres_destroy_cmpstates( rtl_CmpState* pState_ );
85 void SAL_CALL rtl_tres_destroy_cmpstate( rtl_CmpState* pState_ );
86 
87 
88  /* set and clear single bits */
89 static void SAL_CALL rtl_tres_setbit( rtl_FuncState* pState_,
90                                                           sal_uInt32 flag  );
91 static void SAL_CALL rtl_tres_clearbit( rtl_FuncState* pState_,
92                                                           sal_uInt32 flag  );
93 
94  /**
95   * forward declarations of concrete function implementations overloadable
96   * and accessible via vtable
97   */
98 static sal_Bool SAL_CALL rtl_tres_state(
99                                         rtl_TestResult* pThis_,
100                                         sal_Bool state,
101                                         const sal_Char* msg,
102                                         const sal_Char* sub,
103                                         sal_Bool v
104                                         );
105 
106 static void SAL_CALL rtl_tres_end( rtl_TestResult* pThis_,
107                                                         const sal_Char* msg );
108 
109 static rtl_funcstate SAL_CALL rtl_tres_funcstate( rtl_TestResult* pThis_ );
110 
111 static sal_Bool SAL_CALL rtl_tres_ispassed( rtl_TestResult* pThis_ );
112 static sal_Bool SAL_CALL rtl_tres_isok( rtl_TestResult* pThis_ );
113 
114 static sal_Bool SAL_CALL rtl_tres_isbit( rtl_TestResult* pThis_,
115                                                         sal_uInt32 flag );
116 
117 static rtl_funcstate SAL_CALL rtl_tres_getnextfuncstate( rtl_funcstate );
118 static rtl_funcstate SAL_CALL rtl_tres_getprevfuncstate( rtl_funcstate );
119 static sal_uInt32 SAL_CALL rtl_tres_getflags( rtl_funcstate );
120 sal_uInt32 SAL_CALL rtl_tres_getstarttime( rtl_funcstate );
121 sal_uInt32 SAL_CALL rtl_tres_getstoptime( rtl_funcstate );
122 static rtl_cmpstate SAL_CALL rtl_tres_getcmpstate( rtl_funcstate );
123 
124 static sal_Bool SAL_CALL rtl_tres_getstat( rtl_cmpstate );
125 rtl_String* SAL_CALL rtl_tres_getname( rtl_funcstate );
126 rtl_String* SAL_CALL rtl_tres_getmsg( rtl_cmpstate );
127 static rtl_cmpstate SAL_CALL rtl_tres_getnextcmpstate( rtl_cmpstate );
128 
129 
130  /**
131  * initialize vtable with function pointers
132  */
133 static rtl_TestResult_vtable trVTable =
134 {
135     sizeof(rtl_TestResult_vtable),
136     rtl_tres_state,
137     rtl_tres_end,
138     rtl_tres_ispassed,
139     rtl_tres_isok,
140     rtl_tres_funcstate,
141     rtl_tres_isbit,
142     rtl_tres_getnextfuncstate,
143     rtl_tres_getprevfuncstate,
144     rtl_tres_getflags,
145     rtl_tres_getname,
146     rtl_tres_getstarttime,
147     rtl_tres_getstoptime,
148     rtl_tres_getcmpstate,
149     rtl_tres_getstat,
150     rtl_tres_getmsg,
151     rtl_tres_getnextcmpstate
152 };
153 
154  /**
155   * rtl_tres_create
156   * create and initialize data struct for TestResult
157   *
158   * @param const sal_Char* meth = name of the method (entryname)
159   * @param sal_uInt32 flags     = bitmap of commandline and status flags
160   *
161   * @return rtl_TestResult*     = pointer to a new allocated testresult struct
162   */
163 rtl_TestResult* rtl_tres_create( const sal_Char* meth, sal_uInt32 flags )
164 {
165     /* allocate memory for testresult data structure */
166     rtl_TestResult_Data* pData = (rtl_TestResult_Data*) malloc( sizeof(
167                                                     rtl_TestResult_Data ) );
168     /* initialize members... */
169     pData->m_funcs              = &trVTable;    /* ...vtableptr to vtbladr */
170     pData->m_externaldata       = NULL;            /* ...external data pointer */
171 
172     /* allocate memory for state structure and initialize members */
173     pData->m_state              = rtl_tres_create_funcstate( meth );
174     pData->m_state->m_flags     = flags;        /* ...option Bitmap */
175 
176     /* set OK flag initial */
177     rtl_tres_setbit( pData->m_state, rtl_tres_Flag_OK );
178 
179     return (rtl_TestResult*)pData ;
180 }
181 
182 /**
183  * rtl_tres_create_funcstate
184  * allocates and initializes a structure to represent the status of a test
185  * entry or its substates
186  *
187  * @param const sal_Char* meth = the name of the method (entry or sub entry)
188  *
189  * @return rtl_FuncState* = pointer to a new allocated funcstate struct
190  */
191 rtl_FuncState* SAL_CALL rtl_tres_create_funcstate( const sal_Char* meth )
192 {
193     rtl_FuncState* pStat = NULL;                   /* status structure */
194 
195     /* allocate memory for status structure */
196     pStat = (rtl_FuncState*) malloc( sizeof( struct _rtl_FuncState ) );
197 
198     if ( pStat )
199     {
200         pStat->m_next  = pStat;                 /* init ptr to next struct */
201         pStat->m_prev  = pStat;                 /* init ptr to prev struct */
202 
203         pStat->m_name  = NULL;                     /* init name */
204         pStat->m_flags = 0;                     /* init flags */
205         pStat->m_start = rtl_tres_timer();      /* init start milliseconds */
206         pStat->m_stop  = 0;                     /* init stop milliseconds */
207         pStat->m_cmp   = NULL;                     /* init ptr to msg struct */
208         rtl_string_newFromStr( &pStat->m_name, meth );/* copy meth to name */
209 
210         /* set ok flag initially */
211         rtl_tres_setbit(pStat, rtl_tres_Flag_OK);
212     }
213 
214     return ( pStat );
215 }
216  /**
217   * rtl_tres_link_funcstate
218   * link initialized funcstate structure to a circular double linked list
219   *
220   * @param rtl_FuncState* ptr   = pointer to a funcstate where to link in new
221   * @param rtl_FuncState* plink = pointer to a funcstate to link in list
222   *
223   * @return rtl_FuncState*      = pointer to structure linked in new
224   */
225 rtl_FuncState* SAL_CALL rtl_tres_link_funcstate( rtl_FuncState* ptr,
226                                                         rtl_FuncState* plink )
227 {
228     ptr->m_next->m_prev = plink;
229     ptr->m_next->m_prev->m_next = ptr->m_next;
230     ptr->m_next->m_prev->m_prev = ptr;
231     ptr->m_next = plink;
232     return ( plink );
233 }
234 
235  /**
236   * rtl_tres_unlink_funcstate
237   * unlink funcstate structure from a circular double linked list
238   *
239   * @param rtl_FuncState* plink = pointer to a funcstate to unlink from list
240   *
241   * @return rtl_FuncState*      = pointer to funcstate struct unlinked from
242   *                               list
243   */
244 rtl_FuncState* SAL_CALL rtl_tres_unlink_funcstate( rtl_FuncState* plink )
245 {
246     plink->m_next->m_prev = plink->m_prev;
247     plink->m_prev->m_next = plink->m_next;
248     plink->m_next = plink;
249     plink->m_prev = plink;
250     return ( plink );
251 }
252 
253  /**
254   * rtl_tres_link_cmpstate
255   * link initialized cmpstate structure to a circular double linked list
256   *
257   * @param rtl_CmpState* ptr   = pointer to a cmpstate where to link in new
258   * @param rtl_CmpState* plink = pointer to a cmpstate to link in list
259   *
260   * @return rtl_CmpState*      = pointer to cmpstate struct linked in new
261   */
262 rtl_CmpState* SAL_CALL rtl_tres_link_cmpstate( rtl_CmpState* ptr,
263                                                         rtl_CmpState* plink )
264 {
265     ptr->m_next->m_prev = plink;
266     ptr->m_next->m_prev->m_next = ptr->m_next;
267     ptr->m_next->m_prev->m_prev = ptr;
268     ptr->m_next = plink;
269     return ( plink );
270 }
271  /**
272   * rtl_tres_unlink_cmpstate
273   * unlink cmpstate structure from a circular double linked list
274   *
275   * @param rtl_CmpState* plink = pointer to a cmpstate to unlink from list
276   *
277   * @return rtl_CmpState*      = pointer to cmpstate struct unlinked from list
278   */
279 rtl_CmpState* SAL_CALL rtl_tres_unlink_cmpstate( rtl_CmpState* plink )
280 {
281     plink->m_next->m_prev = plink->m_prev;
282     plink->m_prev->m_next = plink->m_next;
283     plink->m_next = plink;
284     plink->m_prev = plink;
285     return ( plink );
286 }
287 
288  /**
289   * rtl_tres_create_cmpstate
290   * allocates and initializes a structure to represent the status of a test
291   * comparison
292   *
293   * @param sal_Bool state   = compare state
294   * @param sal_Char* msg    = message for logging and debug purposes
295   *
296   * @return rtl_CmpState*   = pointer to the new allocated struct
297   */
298 rtl_CmpState* SAL_CALL rtl_tres_create_cmpstate(
299                                                 sal_Bool state,
300                                                 const sal_Char* msg
301                                                 )
302 {
303     /* allocate memory for cmpstate struct */
304     rtl_CmpState* pStat = (rtl_CmpState*) malloc( sizeof( rtl_CmpState ) );
305 
306     /* initialize if memory could be allocated */
307     if ( pStat )
308     {
309         pStat->m_next   = pStat;                /* init next with this */
310         pStat->m_prev   = pStat;                /* init prev with this */
311         pStat->m_msg    = NULL;
312         pStat->m_stat   = state;                /* boolean state */
313         rtl_string_newFromStr( &pStat->m_msg, msg ); /* copy message */
314     }
315     return ( pStat );
316 }
317 
318  /**
319   * rtl_tres_destroy
320   * free allocated memory of testresult data struct
321   *
322   * @param rtl_TestResult* pThis_ = pointer to a valid testresult struct
323   */
324 void SAL_CALL rtl_tres_destroy( rtl_TestResult* pThis_ )
325 {
326     /* cast to implementation representation structure */
327     rtl_TestResult_Data* pData = (rtl_TestResult_Data*) pThis_;
328 
329     /* destroy all funcstates */
330     if ( pData->m_state )
331         rtl_tres_destroy_funcstates( pData->m_state );
332 
333     /* free allocated memory and reinitialize to zero */
334     /* to be able to prevent dangling pointer access*/
335     free( pData ); pData = NULL;
336 }
337 
338  /**
339   * rtl_tres_destroy_funcstates
340   * free allocated memory occupied by the list of funcstate data structs
341   * (iterates through next pointers)
342   *
343   * @param rtl_FuncState* pState_ = pointer to a valid funcstate struct
344   */
345 void SAL_CALL rtl_tres_destroy_funcstates( rtl_FuncState* pState_ )
346 {
347     rtl_FuncState* plink = pState_->m_next;
348     while ( plink != plink->m_next )
349     {
350         rtl_tres_destroy_funcstate( rtl_tres_unlink_funcstate( plink ) );
351         plink = pState_->m_next;
352     }
353     rtl_tres_destroy_funcstate( plink );
354 }
355 
356  /**
357   * rtl_tres_destroy_cmpstates
358   * free allocated memory occupied by the list of cmpstate data structs
359   * (iterates through next pointers)
360   *
361   * @param rtl_CmpState* pState_ = pointer to a valid cmpstate struct
362   */
363 void SAL_CALL rtl_tres_destroy_cmpstates( rtl_CmpState* pState_ )
364 {
365     rtl_CmpState* plink = pState_->m_next;
366     while ( plink != plink->m_next )
367     {
368         rtl_tres_destroy_cmpstate( rtl_tres_unlink_cmpstate( plink ) );
369         plink = pState_->m_next;
370     }
371     rtl_tres_destroy_cmpstate( plink );
372 }
373 
374 
375  /**
376   * rtl_tres_destroy_funcstate
377   * free allocated memory occupied by one funcstate and it's list
378   * of cmpstate data structs
379   *
380   * @param rtl_FuncState* pState_ = pointer to a valid funcstate struct
381   */
382 void SAL_CALL rtl_tres_destroy_funcstate( rtl_FuncState* pState_ )
383 {
384     rtl_FuncState* plink = pState_;
385 
386     if ( plink->m_cmp )
387         rtl_tres_destroy_cmpstates( plink->m_cmp );
388 
389     if ( plink->m_name )
390     {
391         rtl_string_release( plink->m_name );
392         plink->m_name = NULL;
393     }
394     plink->m_flags = 0;
395     free( plink );
396     plink = NULL;
397 }
398 
399  /**
400   * rtl_tres_destroy_cmpstate
401   * free allocated memory of a cmpstate data struct
402   *
403   * @param rtl_CmpState* pState_ = pointer to cmpstate struct to destroy
404   */
405 void SAL_CALL rtl_tres_destroy_cmpstate( rtl_CmpState* pState_ )
406 {
407 
408     rtl_CmpState* plink = pState_;
409 
410     if ( plink->m_msg )
411     {
412         rtl_string_release( plink->m_msg );
413         plink->m_msg = NULL;
414     }
415     free( plink );
416     plink = NULL;
417 }
418  /**
419  * central function to call in tests
420  *
421  * @param rtl_TestResult* pThis_    = self pointer to TestResult structure
422  * @param sal_Bool state            = boolean result of statement comparison
423  * @param const sal_Char* msg       = message for actual statementcomparison
424  * @param const sal_Char* sub       = name of sub testfunction
425  * @param sal_Bool v                = boolean verbose parameter
426  *
427  * @return sal_Bool                 = determines if statement comparison
428  *                                    was positive or not
429  */
430 static sal_Bool SAL_CALL rtl_tres_state(
431                                         rtl_TestResult* pThis_,
432                                         sal_Bool state,
433                                         const sal_Char* msg,
434                                         const sal_Char* sub,
435                                         sal_Bool v
436                                         )
437 {
438 
439     /* cast pointer to testresult data implementation struct*/
440     rtl_TestResult_Data* pData = (rtl_TestResult_Data*)pThis_;
441 
442     /* initialize funcstate pointer with masterstate */
443     rtl_FuncState* pFunc = pData->m_state;
444 
445     /* if substate required */
446     if ( sub )
447     {
448         /* link new created function state to last item */
449         pFunc = rtl_tres_link_funcstate( pFunc->m_prev,
450                                         rtl_tres_create_funcstate( sub ) );
451 
452         /* indicate this state as substate */
453         rtl_tres_setbit( pFunc, rtl_tres_Flag_SUB );
454 
455         /* indicate previous state as passed if no masterstate */
456         if ( pFunc->m_prev != pData->m_state )
457             rtl_tres_setbit( pFunc->m_prev, rtl_tres_Flag_PASSED );
458     }
459 
460 
461     /* test failed */
462     if( ! state )
463     {
464          /* determine if assertion should be thrown */
465         if ( rtl_tres_isbit( pThis_, rtl_tres_Flag_BOOM ) )
466         {
467             /* if message available */
468             if ( msg )
469                 TST_BOOM( state, msg );
470             else
471                 TST_BOOM( state, "no msg available" );
472         }
473 
474         /* clear this state ok flag and masterstate ok flag */
475         rtl_tres_clearbit( pFunc, rtl_tres_Flag_OK );
476         rtl_tres_clearbit( pData->m_state, rtl_tres_Flag_OK );
477     }
478     /* message available */
479     if( msg )
480     {
481         /* append a new comparison state */
482         if (! pFunc->m_cmp )
483             pFunc->m_cmp = rtl_tres_create_cmpstate( state, msg );
484         else
485             rtl_tres_link_cmpstate( pFunc->m_cmp,
486                             rtl_tres_create_cmpstate(state, msg ) );
487 
488         /* message to stderr required ? */
489         if ( v || ( pFunc->m_next->m_flags & rtl_tres_Flag_VERBOSE ) )
490             fprintf( stderr, "%s\n", msg );
491     }
492 
493     pFunc->m_stop = rtl_tres_timer();
494     return ( state );
495 }
496 
497  /**
498   * rtl_tres_timer
499   * function to get actual timevalue
500   * this has to be replaced by a high resolution timer
501   */
502 sal_uInt32 SAL_CALL rtl_tres_timer()
503 {
504     sal_uInt32 val = 0;
505     TimeValue* tmv = (TimeValue*)malloc( sizeof( TimeValue ) );
506     osl_getSystemTime( tmv );
507     val = tmv->Nanosec/1000L;
508     free( tmv );
509     return ( val );
510 }
511 
512 
513 static void SAL_CALL rtl_tres_end( rtl_TestResult* pThis_,
514                                                         const sal_Char* msg )
515 {
516     rtl_TestResult_Data* pData = (rtl_TestResult_Data*) pThis_;
517 
518     if( msg )
519     {
520         if (! pData->m_state->m_cmp )
521             pData->m_state->m_cmp = rtl_tres_create_cmpstate( sal_True, msg );
522         else
523             rtl_tres_link_cmpstate( pData->m_state->m_cmp,
524                             rtl_tres_create_cmpstate( sal_True, msg ) );
525     }
526     pData->m_state->m_prev->m_flags |= rtl_tres_Flag_PASSED;
527     pData->m_state->m_flags |= rtl_tres_Flag_PASSED;
528     pData->m_state->m_stop = rtl_tres_timer();
529 }
530 
531 
532 static sal_Bool SAL_CALL rtl_tres_ispassed( rtl_TestResult* pThis_ )
533 {
534     return rtl_tres_isbit( pThis_, rtl_tres_Flag_PASSED );
535 }
536 
537 static sal_Bool SAL_CALL rtl_tres_isok( rtl_TestResult* pThis_ )
538 {
539     return rtl_tres_isbit( pThis_, rtl_tres_Flag_OK );
540 }
541  /**
542  * return pointer to funcstate structure
543  */
544 static rtl_funcstate SAL_CALL rtl_tres_funcstate( rtl_TestResult* pThis_ )
545 {
546 
547     rtl_TestResult_Data* pThis = (rtl_TestResult_Data*) pThis_;
548     return (rtl_funcstate)pThis->m_state;
549 }
550 
551  /**
552  * determine if a flag is set or not
553  */
554 static sal_Bool SAL_CALL rtl_tres_isbit( rtl_TestResult* pThis_,
555                                                           sal_uInt32 flag  )
556 {
557     return (sal_Bool)
558         ((((rtl_TestResult_Data *) pThis_)->m_state->m_flags & flag) == flag);
559 }
560  /**
561   * set one single bit
562   */
563 static void SAL_CALL rtl_tres_setbit( rtl_FuncState* pState_,
564                                                           sal_uInt32 flag  )
565 {
566     pState_->m_flags |= flag;
567 }
568  /**
569   * clear one single bit
570   */
571 static void SAL_CALL rtl_tres_clearbit( rtl_FuncState* pState_,
572                                                           sal_uInt32 flag  )
573 {
574     pState_->m_flags = pState_->m_flags & ( ~flag );
575 }
576 
577  /**
578   * returns next pointer of passed funcstate structure
579   */
580 rtl_funcstate SAL_CALL rtl_tres_getnextfuncstate( rtl_funcstate fstate )
581 {
582     rtl_FuncState* fs = (rtl_FuncState*)fstate;
583     return( (rtl_funcstate)fs->m_next );
584 
585 }
586  /**
587   * returns previous pointer of passed funcstate structure
588   */
589 rtl_funcstate SAL_CALL rtl_tres_getprevfuncstate( rtl_funcstate fstate )
590 {
591     rtl_FuncState* fs = (rtl_FuncState*)fstate;
592     return( (rtl_funcstate)fs->m_prev );
593 
594 }
595  /**
596   * returns flag value of passed funcstate structure
597   */
598 sal_uInt32 SAL_CALL rtl_tres_getflags( rtl_funcstate fstate )
599 {
600     rtl_FuncState* fs = (rtl_FuncState*)fstate;
601     return( fs->m_flags );
602 }
603  /**
604   * returns name of passed funcstate structure
605   */
606 rtl_String* SAL_CALL rtl_tres_getname( rtl_funcstate fstate )
607 {
608     rtl_FuncState* fs = (rtl_FuncState*)fstate;
609     return( fs->m_name );
610 }
611  /**
612   * returns starttime of passed funcstate structure
613   */
614 sal_uInt32 SAL_CALL rtl_tres_getstarttime( rtl_funcstate fstate )
615 {
616     rtl_FuncState* fs = (rtl_FuncState*)fstate;
617     return( fs->m_start );
618 }
619 
620  /**
621   * returns stoptime of passed funcstate structure
622   */
623 sal_uInt32 SAL_CALL rtl_tres_getstoptime( rtl_funcstate fstate )
624 {
625     rtl_FuncState* fs = (rtl_FuncState*)fstate;
626     return( fs->m_stop );
627 }
628 
629  /**
630   * returns pointer to cmpstate of passed funcstate structure
631   */
632 rtl_cmpstate SAL_CALL rtl_tres_getcmpstate( rtl_funcstate fstate)
633 {
634     rtl_FuncState* fs = (rtl_FuncState*)fstate;
635     return( (rtl_cmpstate)fs->m_cmp );
636 
637 }
638  /**
639   * returns boolean state of passed cmpstate structure
640   */
641 sal_Bool SAL_CALL rtl_tres_getstat( rtl_cmpstate cstate)
642 {
643     rtl_CmpState* cs = (rtl_CmpState*)cstate;
644     return( cs->m_stat );
645 }
646  /**
647   * returns message of passed cmpstate structure
648   */
649 rtl_String* SAL_CALL rtl_tres_getmsg( rtl_cmpstate cstate)
650 {
651     rtl_CmpState* cs = (rtl_CmpState*)cstate;
652     return( cs->m_msg );
653 }
654  /**
655   * returns next pointer of passed cmpstate structure
656   */
657 rtl_cmpstate SAL_CALL rtl_tres_getnextcmpstate( rtl_cmpstate cstate)
658 {
659     rtl_CmpState* cs = (rtl_CmpState*)cstate;
660     return( (rtl_cmpstate)cs->m_next );
661 }
662 
663 /*
664 // <method_logPrintf>
665 //inline void logPrintf ( const sal_Bool   bTestCaseState,
666 //                            const char      *pFormatStr, ...
667 //                            )
668 //{
669 //    if( m_pFunctions && m_pFunctions->pLogPrintf )
670 //    {
671 //        va_list   vArgumentList;
672 //        va_start ( vArgumentList, pFormatStr );
673 
674 //        m_pFunctions->pLogPrintf( this, bTestCaseState, pFormatStr, vArgumentList );
675 
676 //        va_end ( vArgumentList );
677 //    }
678 //} // </method_logPrintf>
679  */
680