00001 /* 00002 Copyright (C) 2000-2003, Intel Corporation 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, 00006 are permitted provided that the following conditions are met: 00007 00008 Redistributions of source code must retain the above copyright notice, this list 00009 of conditions and the following disclaimer. 00010 00011 Redistributions in binary form must reproduce the above copyright notice, this list 00012 of conditions and the following disclaimer in the documentation and/or other materials 00013 provided with the distribution. 00014 00015 Neither the name of the owner nor the names of its contributors may be used to endorse or 00016 promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR 00021 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00022 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 00023 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00024 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 //-*-c++-*- 00029 //============================================================================= 00030 // 00031 // Module : gen_base.h 00032 // $Date : $ 00033 // $Author: marcel $ 00034 // $Source: /proj/osprey/CVS/open64/osprey1.0/common/ipfec_targ_info/gen/gen_base.h,v $ 00035 // 00036 // Description: 00037 // ============ 00038 // Aim : some general generate function 00039 //============================================================================= 00041 // 00042 // ENUM GEN_MODE 00043 // 00044 // To indicate Generation mode for easy debugging and reuse. 00045 // 00046 // 00047 #ifndef GEN_BASE_INCLUDED 00048 #define GEN_BASE_INCLUDED 00049 00050 #include "ekapi_ia64.h" 00051 00052 typedef enum { 00053 GEN_MODE_DEBUG, 00054 GEN_MODE_FILE, 00055 GEN_MODE_SCREEN 00056 }GEN_MODE; 00057 00058 typedef enum { 00059 ITM_TYPE, 00060 MCK_TYPE 00061 }MACHINE_TYPE; 00062 00063 /********************************************************** 00064 * Emit_Header 00065 * Write the common header of a header file 00066 * hfile: FILE pointer to the opened header file to write. 00067 * name: name of the module 00068 * interface_desc: comment on the description of the 00069 * interface provided in this header 00070 * file. 00071 */ 00072 extern void Emit_Header (FILE *hfile, 00073 const char *name, 00074 const char * const *interface_desc, 00075 bool cplusplus = false); 00076 00077 /********************************************************** 00078 * Emit_Tailer 00079 * Write the common header of a header file 00080 * hfile: FILE pointer to the opened header file to write. 00081 */ 00082 extern void Emit_Tailer(FILE *hfile, bool cplusplus = false); 00083 00084 /********************************************************** 00085 * Init_Module_Files 00086 * Creat the curresponding .c (.cxx), .h, .Exported file 00087 * to write 00088 */ 00089 00090 extern void Init_Module_Files(GEN_MODE mode, const char * module_name, 00091 FILE **c_file, FILE **h_file, FILE **export_file, 00092 bool cplusplus = false); 00093 00094 // only write to C file; 00095 extern void Init_Module_Files(GEN_MODE mode, const char * module_name, 00096 FILE **c_file, bool cplusplus = false); 00097 00098 /********************************************************** 00099 * Close_Module_Files 00100 * Close the curresponding .c (.cxx), .h, .Exported file 00101 */ 00102 extern void Close_Module_Files(GEN_MODE mode, 00103 FILE **c_file, FILE **h_file, FILE **export_file); 00104 00105 inline void Dot2Line(char *buf) 00106 { 00107 for (; *buf; buf++){ 00108 if (*buf == '.'){ 00109 *buf='_'; 00110 } 00111 } 00112 } 00113 inline void Line2Dot(char *buf) 00114 { 00115 if (buf==NULL) return; 00116 for (; *buf; buf++){ 00117 if (*buf == '_'){ 00118 *buf='.'; 00119 } 00120 } 00121 } 00122 00123 #endif /* INCLUDED */ 00124
1.5.6