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