| 1 | /*------------------------------------------------------------\ | 
|---|
| 2 | |                                                             | | 
|---|
| 3 | | Tool    :                  systemcass                       | | 
|---|
| 4 | |                                                             | | 
|---|
| 5 | | File    :                   sc_pat_trace.cc                 | | 
|---|
| 6 | |                                                             | | 
|---|
| 7 | | Author  :                 Kingbo Paul-Jerome                | | 
|---|
| 8 | |                           Buchmann Richard                  | | 
|---|
| 9 | |                                                             | | 
|---|
| 10 | | Date    :                   09_07_2004                      | | 
|---|
| 11 | |                                                             | | 
|---|
| 12 | \------------------------------------------------------------*/ | 
|---|
| 13 |  | 
|---|
| 14 | /*  | 
|---|
| 15 |  * This file is part of the Disydent Project | 
|---|
| 16 |  * Copyright (C) Laboratoire LIP6 - Département ASIM | 
|---|
| 17 |  * Universite Pierre et Marie Curie | 
|---|
| 18 |  *  | 
|---|
| 19 |  * Home page          : http://www-asim.lip6.fr/disydent | 
|---|
| 20 |  * E-mail             : mailto:richard.buchmann@lip6.fr | 
|---|
| 21 |  *  | 
|---|
| 22 |  * This library is free software; you  can redistribute it and/or modify it | 
|---|
| 23 |  * under the terms  of the GNU Library General Public  License as published | 
|---|
| 24 |  * by the Free Software Foundation; either version 2 of the License, or (at | 
|---|
| 25 |  * your option) any later version. | 
|---|
| 26 |  *  | 
|---|
| 27 |  * Disydent is distributed  in the hope  that it  will be | 
|---|
| 28 |  * useful, but WITHOUT  ANY WARRANTY; without even the  implied warranty of | 
|---|
| 29 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 
|---|
| 30 |  * Public License for more details. | 
|---|
| 31 |  *  | 
|---|
| 32 |  * You should have received a copy  of the GNU General Public License along | 
|---|
| 33 |  * with the GNU C Library; see the  file COPYING. If not, write to the Free | 
|---|
| 34 |  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
|---|
| 35 |  */ | 
|---|
| 36 |  | 
|---|
| 37 | #include <ctime> | 
|---|
| 38 |  | 
|---|
| 39 | #include "sc_trace.h" | 
|---|
| 40 | #include "sc_pat_trace.h" | 
|---|
| 41 | #include "sc_ver.h" | 
|---|
| 42 | #include "internal.h" // notrace | 
|---|
| 43 |  | 
|---|
| 44 | #ifdef HAVE_CONFIG_H | 
|---|
| 45 | #include "config.h" | 
|---|
| 46 | #endif | 
|---|
| 47 |  | 
|---|
| 48 | #ifdef CONFIG_PAT_TRACE_FORMAT | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | extern "C" { | 
|---|
| 53 | #include "genpat.h" | 
|---|
| 54 | } | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | #include <cstdlib> | 
|---|
| 58 | #include <cstdio> | 
|---|
| 59 |  | 
|---|
| 60 |  | 
|---|
| 61 | using namespace std; | 
|---|
| 62 |  | 
|---|
| 63 | namespace sc_core { | 
|---|
| 64 |  | 
|---|
| 65 |  | 
|---|
| 66 | sc_trace_file * sc_create_pat_trace_file(const char * name) { | 
|---|
| 67 |     if (notrace) { | 
|---|
| 68 |         return NULL; | 
|---|
| 69 |     } | 
|---|
| 70 |     //création d'1 instance de la structure Sc_trace_file: | 
|---|
| 71 |     sc_trace_file * traceFic = new sc_trace_file(); | 
|---|
| 72 |     traceFic->flag = PAT_FORMAT; | 
|---|
| 73 |  | 
|---|
| 74 |     trace_file_list.push_back(traceFic); | 
|---|
| 75 |  | 
|---|
| 76 |     DEF_GENPAT((char *) name); | 
|---|
| 77 |  | 
|---|
| 78 |     return traceFic;  | 
|---|
| 79 |     //pointeur sur le sc_trace_file dontl'un des elts pointe sur le fichier.pat crée  | 
|---|
| 80 | } | 
|---|
| 81 |  | 
|---|
| 82 |  | 
|---|
| 83 | //************************************************************************* | 
|---|
| 84 |  | 
|---|
| 85 | void sc_close_pat_trace_file(sc_trace_file * traceFic ) { | 
|---|
| 86 |     if (notrace) { | 
|---|
| 87 |         return; | 
|---|
| 88 |     } | 
|---|
| 89 |  | 
|---|
| 90 |     trace(*traceFic, false); | 
|---|
| 91 |  | 
|---|
| 92 |     SAV_GENPAT(); | 
|---|
| 93 |  | 
|---|
| 94 |     //libération de l'instance de la structure en mémoire: | 
|---|
| 95 |     delete traceFic; | 
|---|
| 96 |  | 
|---|
| 97 |     vector<sc_trace_file *>::iterator i; | 
|---|
| 98 |     for (i = trace_file_list.begin (); i != trace_file_list.end(); ++i) { | 
|---|
| 99 |         if (*i == traceFic) { | 
|---|
| 100 |             trace_file_list.erase(i); | 
|---|
| 101 |             break; | 
|---|
| 102 |         } | 
|---|
| 103 |     } | 
|---|
| 104 | } | 
|---|
| 105 |  | 
|---|
| 106 | } // end of sc_core namespace | 
|---|
| 107 |  | 
|---|
| 108 | #endif | 
|---|
| 109 |  | 
|---|
| 110 | /* | 
|---|
| 111 | # Local Variables: | 
|---|
| 112 | # tab-width: 4; | 
|---|
| 113 | # c-basic-offset: 4; | 
|---|
| 114 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); | 
|---|
| 115 | # indent-tabs-mode: nil; | 
|---|
| 116 | # End: | 
|---|
| 117 | # | 
|---|
| 118 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|
| 119 | */ | 
|---|
| 120 |  | 
|---|