| 1 | /* toltclInt.h - Declarations of things used internally by the |
|---|
| 2 | toltcl extension. |
|---|
| 3 | GNU/tolTcl Library |
|---|
| 4 | |
|---|
| 5 | Copyright (C) 2001, 2002, 2003 - Bayes Decisión, SL |
|---|
| 6 | |
|---|
| 7 | This program is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2, or (at your option) |
|---|
| 10 | any later version. |
|---|
| 11 | |
|---|
| 12 | This program is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with this program; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|---|
| 20 | USA. |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | #ifndef TOLTCLINT_H |
|---|
| 24 | #define TOLTCLINT_H 1 |
|---|
| 25 | |
|---|
| 26 | #include <tt_common.h> |
|---|
| 27 | #include <tcl.h> |
|---|
| 28 | |
|---|
| 29 | #ifndef __GNUC__ |
|---|
| 30 | #if !defined(strncasecmp) |
|---|
| 31 | # define strncasecmp _strnicmp |
|---|
| 32 | #endif |
|---|
| 33 | #if !defined(strcasecmp) |
|---|
| 34 | # define strcasecmp _stricmp |
|---|
| 35 | #endif |
|---|
| 36 | #if !defined(isinf) |
|---|
| 37 | # define isinf !_finite |
|---|
| 38 | #endif |
|---|
| 39 | #endif |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | BEGIN_C_DECLS |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | extern Tcl_Interp * TT_interp; |
|---|
| 46 | |
|---|
| 47 | /*! Fill in obj_result the version info corresponding to tol |
|---|
| 48 | * {major MajorNum minor MinorNum release ReleaseNum coment Comment} |
|---|
| 49 | */ |
|---|
| 50 | extern int Tol_InfoVersion _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 51 | Tcl_Obj * obj_result)); |
|---|
| 52 | |
|---|
| 53 | /*! Set the language to be used by TOL. Fill in obj_result the previous |
|---|
| 54 | * language. |
|---|
| 55 | */ |
|---|
| 56 | extern int Tol_SetLanguage _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * lang, |
|---|
| 57 | Tcl_Obj * obj_result)); |
|---|
| 58 | |
|---|
| 59 | /*! Return the language used by TOL. Fill in obj_result the current |
|---|
| 60 | * language. |
|---|
| 61 | */ |
|---|
| 62 | extern int Tol_GetLanguage _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 63 | Tcl_Obj * obj_result)); |
|---|
| 64 | |
|---|
| 65 | /*! Fill in obj_result the result of evaluating including the file |
|---|
| 66 | * given as argument: the absolute path. |
|---|
| 67 | */ |
|---|
| 68 | extern int Tol_IncludeFile _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 69 | Tcl_Obj * obj_file, |
|---|
| 70 | Tcl_Obj * obj_result)); |
|---|
| 71 | |
|---|
| 72 | extern int Tol_DecompileFile _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 73 | Tcl_Obj * obj_file, |
|---|
| 74 | Tcl_Obj * obj_result)); |
|---|
| 75 | |
|---|
| 76 | extern int Tol_InfoFile _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 77 | Tcl_Obj * file, |
|---|
| 78 | Tcl_Obj * obj_result)); |
|---|
| 79 | |
|---|
| 80 | /*! Fill in obj_result the result of evaluating in TOL the given |
|---|
| 81 | * string. |
|---|
| 82 | */ |
|---|
| 83 | extern int Tol_EvalExpr _ANSI_ARGS_((Tcl_Obj * obj_expr, |
|---|
| 84 | int hidden, |
|---|
| 85 | Tcl_Obj * obj_result)); |
|---|
| 86 | |
|---|
| 87 | /*! Fill in obj_result the content of the given tol object's names. The |
|---|
| 88 | * object are searched in the console's stack. |
|---|
| 89 | */ |
|---|
| 90 | extern int Tol_ListStack _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 91 | int objc, |
|---|
| 92 | Tcl_Obj *CONST objv[], |
|---|
| 93 | Tcl_Obj * obj_result)); |
|---|
| 94 | |
|---|
| 95 | /*! Release the given tol object's names. The object are searched in |
|---|
| 96 | * the console's stack. |
|---|
| 97 | */ |
|---|
| 98 | extern int Tol_ReleaseStack _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 99 | int objc, |
|---|
| 100 | Tcl_Obj *CONST objv[], |
|---|
| 101 | Tcl_Obj * obj_result)); |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | /*! Return the fields of a TOL structure. |
|---|
| 105 | * { name1 type1 ... namej typej } |
|---|
| 106 | * type could be the name of a grammar or {STRUCT struct-name} |
|---|
| 107 | */ |
|---|
| 108 | extern int Tol_GetStructure _ANSI_ARGS_(( Tcl_Interp * interp, |
|---|
| 109 | Tcl_Obj * name, Tcl_Obj * obj_result)); |
|---|
| 110 | |
|---|
| 111 | /*! Puts in obj_result the global reference of the given |
|---|
| 112 | * syntaxobject. The syntaxobject could be given as set member or as |
|---|
| 113 | * global variable. In case of error leave in obj_result the message. |
|---|
| 114 | * Returns TCL_OK if succesfull or TCL_ERROR in case of error. |
|---|
| 115 | */ |
|---|
| 116 | int Tol_GetReference(Tcl_Interp *interp, int objc, |
|---|
| 117 | Tcl_Obj *CONST objv[], Tcl_Obj * obj_result); |
|---|
| 118 | |
|---|
| 119 | /*! Return the path of a set if it is a file, trigger an error in other case |
|---|
| 120 | */ |
|---|
| 121 | extern int Tol_GetSetPath _ANSI_ARGS_(( Tcl_Interp * interp, |
|---|
| 122 | Tcl_Obj * name, Tcl_Obj * obj_result)); |
|---|
| 123 | |
|---|
| 124 | /*! Iterate over a first level's children of a given set. The set |
|---|
| 125 | * could be tolset if the indexes is empty or tolset[i1][i2]...[ik] |
|---|
| 126 | * for the given indexes {i1,i2,...,ik} |
|---|
| 127 | */ |
|---|
| 128 | extern int Tol_IterChildren _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 129 | int objc, |
|---|
| 130 | Tcl_Obj *CONST objv[], |
|---|
| 131 | Tcl_Obj * obj_result)); |
|---|
| 132 | |
|---|
| 133 | /*! Fill in obj_result the content of the matrix variable. |
|---|
| 134 | */ |
|---|
| 135 | extern int Tol_GetMatrixContent _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 136 | Tcl_Obj * obj_name, |
|---|
| 137 | Tcl_Obj * obj_result)); |
|---|
| 138 | |
|---|
| 139 | /*! Fill in obj_result the content of the serie variable. |
|---|
| 140 | */ |
|---|
| 141 | extern int Tol_GetSerieContent _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 142 | int objc, |
|---|
| 143 | Tcl_Obj *CONST objv[], |
|---|
| 144 | Tcl_Obj * obj_result)); |
|---|
| 145 | |
|---|
| 146 | /*! Create a new command to manipulate a group of series. |
|---|
| 147 | */ |
|---|
| 148 | extern int Tol_CreateSerieGrp _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 149 | int objc, |
|---|
| 150 | Tcl_Obj *CONST series[], |
|---|
| 151 | Tcl_Obj * obj_result)); |
|---|
| 152 | |
|---|
| 153 | /*! Create a new command to manipulate a group of series. |
|---|
| 154 | */ |
|---|
| 155 | extern int Tol_DestroySerieGrp _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 156 | int objc, |
|---|
| 157 | Tcl_Obj *CONST objv[], |
|---|
| 158 | Tcl_Obj * obj_result)); |
|---|
| 159 | |
|---|
| 160 | /*! Create a new command to manipulate a group of sets (only one set) |
|---|
| 161 | */ |
|---|
| 162 | extern int Tol_CreateTable _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 163 | Tcl_Obj * tblcmd, |
|---|
| 164 | Tcl_Obj * objref, |
|---|
| 165 | int ismat, |
|---|
| 166 | Tcl_Obj * obj_result)); |
|---|
| 167 | |
|---|
| 168 | /*! Create a new command to manipulate a group of sets (only one set) |
|---|
| 169 | */ |
|---|
| 170 | extern int Tol_DestroyTable _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 171 | int objc, |
|---|
| 172 | Tcl_Obj *CONST objv[], |
|---|
| 173 | Tcl_Obj * obj_result)); |
|---|
| 174 | |
|---|
| 175 | /*! Fill in obj_result the list of tol files included |
|---|
| 176 | */ |
|---|
| 177 | extern int Tol_InfoIncluded _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 178 | Tcl_Obj * obj_result)); |
|---|
| 179 | |
|---|
| 180 | /*! Fill in obj_result the list of grammars defined in TOL |
|---|
| 181 | */ |
|---|
| 182 | extern int Tol_SetGrammarsObj _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 183 | Tcl_Obj * obj_result)); |
|---|
| 184 | |
|---|
| 185 | /*! Fill in obj_result the description of gra_name. |
|---|
| 186 | */ |
|---|
| 187 | int Tol_SetGrammarDescObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * gra_name, |
|---|
| 188 | Tcl_Obj * obj_result)); |
|---|
| 189 | |
|---|
| 190 | /*! Fill in obj_result the functions defined for grammar gra_name. |
|---|
| 191 | */ |
|---|
| 192 | extern int Tol_SetFunctionsObj _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 193 | Tcl_Obj * gra_name, |
|---|
| 194 | Tcl_Obj * obj_result)); |
|---|
| 195 | |
|---|
| 196 | /*! Fill in obj_result the function's prototype and description |
|---|
| 197 | * for a given function in a given grammar. |
|---|
| 198 | */ |
|---|
| 199 | int Tol_SetFunctionInfoObj _ANSI_ARGS_((Tcl_Obj * gra_name, |
|---|
| 200 | Tcl_Obj * fun_name, |
|---|
| 201 | Tcl_Obj * obj_result)); |
|---|
| 202 | /*! Fill in obj_result the variables defined for grammar gra_name. |
|---|
| 203 | */ |
|---|
| 204 | extern |
|---|
| 205 | int Tol_SetVariablesObj _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 206 | Tcl_Obj * gra_name, |
|---|
| 207 | Tcl_Obj * obj_result)); |
|---|
| 208 | |
|---|
| 209 | /*! Fill in obj_result the variables's description for a given function |
|---|
| 210 | * in a given grammar. |
|---|
| 211 | */ |
|---|
| 212 | extern |
|---|
| 213 | int Tol_SetVariableInfoObj _ANSI_ARGS_((Tcl_Obj * gra_name, |
|---|
| 214 | Tcl_Obj * var_name, |
|---|
| 215 | Tcl_Obj * obj_result)); |
|---|
| 216 | |
|---|
| 217 | /*! Create a new command to access the given TOL timeset object name. |
|---|
| 218 | */ |
|---|
| 219 | extern |
|---|
| 220 | int Tol_CreateTMSCmd _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 221 | Tcl_Obj * tmscmd, |
|---|
| 222 | Tcl_Obj * tmsname, |
|---|
| 223 | Tcl_Obj * obj_result)); |
|---|
| 224 | |
|---|
| 225 | /*! Destroy the tcl tms commands given in objv. |
|---|
| 226 | */ |
|---|
| 227 | extern |
|---|
| 228 | int Tol_DestroyTMSCmd _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 229 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 230 | Tcl_Obj * obj_result)); |
|---|
| 231 | |
|---|
| 232 | /*! Implement tol::date |
|---|
| 233 | */ |
|---|
| 234 | extern |
|---|
| 235 | int Tol_DateOption _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 236 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 237 | Tcl_Obj * obj_result)); |
|---|
| 238 | |
|---|
| 239 | /*! Implement tol::autocorr |
|---|
| 240 | */ |
|---|
| 241 | extern |
|---|
| 242 | int Tol_GetAutoCorr _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 243 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 244 | Tcl_Obj * obj_result)); |
|---|
| 245 | |
|---|
| 246 | /*! Implement tol::seriestat |
|---|
| 247 | */ |
|---|
| 248 | extern |
|---|
| 249 | int Tol_ComputeSerieStat _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 250 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 251 | Tcl_Obj * obj_result)); |
|---|
| 252 | extern |
|---|
| 253 | int Tol_StopEvaluation _ANSI_ARGS_(()); |
|---|
| 254 | |
|---|
| 255 | extern |
|---|
| 256 | int Tol_LCFormat _ANSI_ARGS_((Tcl_Interp* interp, |
|---|
| 257 | Tcl_Obj*CONST value, |
|---|
| 258 | Tcl_Obj* obj_result)); |
|---|
| 259 | extern |
|---|
| 260 | void Tol_InstallHciWriter _ANSI_ARGS_(()); |
|---|
| 261 | |
|---|
| 262 | extern |
|---|
| 263 | void Tol_InstallMethodsHook _ANSI_ARGS_(()); |
|---|
| 264 | |
|---|
| 265 | END_C_DECLS |
|---|
| 266 | |
|---|
| 267 | //------------------------------------------------------------ |
|---|
| 268 | #ifdef __cplusplus |
|---|
| 269 | |
|---|
| 270 | //#define FINDVARIABLE FindVariable |
|---|
| 271 | #define FINDVARIABLE(name) FindOperand(name,true) |
|---|
| 272 | |
|---|
| 273 | class BSyntaxObject; |
|---|
| 274 | class BGrammar; |
|---|
| 275 | class BDate; |
|---|
| 276 | class BList; |
|---|
| 277 | |
|---|
| 278 | extern |
|---|
| 279 | int Tol_CreateSerieGrp _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 280 | char * sgrp_name, |
|---|
| 281 | BList * series, |
|---|
| 282 | Tcl_Obj * obj_result)); |
|---|
| 283 | |
|---|
| 284 | extern |
|---|
| 285 | int Tol_ParseDate(Tcl_Interp * interp, char * what, BDate & date); |
|---|
| 286 | |
|---|
| 287 | /*! return the set with name obj_name, in case of error return NULL |
|---|
| 288 | * and leave a description in obj_result. Also looks for files. |
|---|
| 289 | */ |
|---|
| 290 | extern |
|---|
| 291 | const BSyntaxObject * Tol_FindSet (Tcl_Obj * obj_name, |
|---|
| 292 | Tcl_Obj * obj_result); |
|---|
| 293 | |
|---|
| 294 | /*! overloaded version to be used in case we need to know if the Set |
|---|
| 295 | found is a SetFromFile or not */ |
|---|
| 296 | extern |
|---|
| 297 | const BSyntaxObject * Tol_FindSet (Tcl_Obj * obj_name, |
|---|
| 298 | Tcl_Obj * obj_result, int& is_file); |
|---|
| 299 | |
|---|
| 300 | /*! |
|---|
| 301 | * Tol_ResolveObject -- |
|---|
| 302 | * |
|---|
| 303 | * Resolve a SyntaxObject given a toltcl object reference. A reference is |
|---|
| 304 | * {setname i1 i2 ... in} or a global name |
|---|
| 305 | * setname is a global set name (including a file name) or, if empty, is |
|---|
| 306 | * stack's console. The grammar of the object found is matched to the |
|---|
| 307 | * given argument grammar. If the return value is NULL the corresponding |
|---|
| 308 | * message is left in interp. |
|---|
| 309 | */ |
|---|
| 310 | const BSyntaxObject * Tol_ResolveObject(Tcl_Interp * interp, |
|---|
| 311 | Tcl_Obj * obj_ref, |
|---|
| 312 | BGrammar * match_gra); |
|---|
| 313 | |
|---|
| 314 | /*! given a tol set in syn_obj, returns its child corresponding to |
|---|
| 315 | * the set of indexes indexes of size n. |
|---|
| 316 | * In case of error return NULL and leave a description in obj_result |
|---|
| 317 | */ |
|---|
| 318 | extern |
|---|
| 319 | const BSyntaxObject * Tol_FindChild ( Tcl_Interp * interp, |
|---|
| 320 | const BSyntaxObject * syn_obj, |
|---|
| 321 | Tcl_Obj ** indexes, int n, |
|---|
| 322 | Tcl_Obj * obj_result); |
|---|
| 323 | |
|---|
| 324 | extern |
|---|
| 325 | int Tol_ListToDate _ANSI_ARGS_(( Tcl_Interp * interp, Tcl_Obj * list, |
|---|
| 326 | BDate & date, Tcl_Obj * obj_result )); |
|---|
| 327 | |
|---|
| 328 | extern |
|---|
| 329 | int Tol_DateToList _ANSI_ARGS_(( BDate & date, Tcl_Obj * obj_result )); |
|---|
| 330 | |
|---|
| 331 | #endif /* __cplusplus */ |
|---|
| 332 | //------------------------------------------------------------ |
|---|
| 333 | |
|---|
| 334 | #endif /* TOLTCLINT_H */ |
|---|