00001 /* --------------------------------------------------------------------------- 00002 00003 00004 This file is part of the ``utils'' package of NuSMV version 2. 00005 Copyright (C) 1998-2001 by CMU and FBK-irst. 00006 00007 NuSMV version 2 is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 NuSMV version 2 is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 00021 For more information on NuSMV see <http://nusmv.fbk.eu> 00022 or email to <nusmv-users@fbk.eu>. 00023 Please report bugs to <nusmv-users@fbk.eu>. 00024 00025 To contact the NuSMV development board, email to <nusmv@fbk.eu>. 00026 00027 -----------------------------------------------------------------------------*/ 00028 00039 #ifndef __NUSMV_CORE_UTILS_UCMD_H__ 00040 #define __NUSMV_CORE_UTILS_UCMD_H__ 00041 00042 #include <stdlib.h> /* for strtol */ 00043 #include "nusmv/core/utils/utils.h" 00044 #include "nusmv/core/opt/opt.h" /* for OPT_USER_POV_NULL_STRING */ 00045 00046 00047 /*---------------------------------------------------------------------------*/ 00048 /* Constant declarations */ 00049 /*---------------------------------------------------------------------------*/ 00050 00051 00052 /*---------------------------------------------------------------------------*/ 00053 /* Type declarations */ 00054 /*---------------------------------------------------------------------------*/ 00055 00061 typedef enum { sv_string, sv_integer, sv_floating, sv_pointer, sv_undef } 00062 SubstValueType; 00063 00064 00073 typedef struct SubstValue_TAG 00074 { 00075 SubstValueType type; 00076 union 00077 { 00078 const char* string; 00079 int integer; 00080 double floating; 00081 void* pointer; 00082 } assign; 00083 } SubstValue; 00084 00085 00097 typedef struct SubstString_TAG 00098 { 00099 const char* symbol; 00100 SubstValue value; 00101 const char* format; 00102 } SubstString; 00103 00104 00105 /*---------------------------------------------------------------------------*/ 00106 /* Structure declarations */ 00107 /*---------------------------------------------------------------------------*/ 00108 00109 00110 /*---------------------------------------------------------------------------*/ 00111 /* Variable declarations */ 00112 /*---------------------------------------------------------------------------*/ 00113 00114 00115 /*---------------------------------------------------------------------------*/ 00116 /* Macro declarations */ 00117 /*---------------------------------------------------------------------------*/ 00118 00128 #define SYMBOL_CREATE() \ 00129 { "\0", {sv_undef, {NULL}}, "" } 00130 00148 #define SYMBOL_ASSIGN(_subst, _symbol, _type, _format, _value) \ 00149 _subst.symbol = _symbol; \ 00150 _subst.value.type = sv_##_type; \ 00151 _subst.format = _format; \ 00152 _subst.value.assign._type = _value 00153 00154 00155 00158 /*---------------------------------------------------------------------------*/ 00159 /* Function prototypes */ 00160 /*---------------------------------------------------------------------------*/ 00161 00203 void 00204 apply_string_macro_expansion(const SubstString* const subst, 00205 char* string, size_t buf_len); 00206 00216 int util_str2int(const char* str, int* value); 00217 00227 int util_is_string_null(const char* string); 00228 00248 int util_str2int_incr(const char* str, char **endptr, int* out); 00251 #endif /* __NUSMV_CORE_UTILS_UCMD_H__ */