| 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 | /* |
|---|
| 120 | * Fill in obj_result the result the string representation of the |
|---|
| 121 | * address of the object referenced in obj_ref. |
|---|
| 122 | */ |
|---|
| 123 | extern int Tol_GetAddressFromObject _ANSI_ARGS_( (Tcl_Interp * interp, |
|---|
| 124 | Tcl_Obj * obj_ref, |
|---|
| 125 | Tcl_Obj * obj_result)); |
|---|
| 126 | /*! Return the path of a set if it is a file, trigger an error in other case |
|---|
| 127 | */ |
|---|
| 128 | extern int Tol_GetSetPath _ANSI_ARGS_(( Tcl_Interp * interp, |
|---|
| 129 | Tcl_Obj * name, Tcl_Obj * obj_result)); |
|---|
| 130 | |
|---|
| 131 | /*! Iterate over a first level's children of a given set. The set |
|---|
| 132 | * could be tolset if the indexes is empty or tolset[i1][i2]...[ik] |
|---|
| 133 | * for the given indexes {i1,i2,...,ik} |
|---|
| 134 | */ |
|---|
| 135 | extern int Tol_IterChildren _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 136 | int objc, |
|---|
| 137 | Tcl_Obj *CONST objv[], |
|---|
| 138 | Tcl_Obj * obj_result)); |
|---|
| 139 | |
|---|
| 140 | /*! Implement a foreach proc similar to the one provided in Tcl except |
|---|
| 141 | * that instead of iterating over the list's items it iterates over |
|---|
| 142 | * the Set's items. The set could be tolset if the indexes is empty |
|---|
| 143 | * or tolset[i1][i2]...[ik] for the given indexes {i1,i2,...,ik} |
|---|
| 144 | */ |
|---|
| 145 | extern int Tol_ForEach _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 146 | int objc, |
|---|
| 147 | Tcl_Obj *CONST objv[], |
|---|
| 148 | Tcl_Obj * obj_result)); |
|---|
| 149 | |
|---|
| 150 | /*! Fill in obj_result the content of the matrix variable. |
|---|
| 151 | */ |
|---|
| 152 | extern int Tol_GetMatrixContent _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 153 | Tcl_Obj * obj_name, |
|---|
| 154 | Tcl_Obj * obj_result)); |
|---|
| 155 | |
|---|
| 156 | /*! Fill in obj_result the content of the serie variable. |
|---|
| 157 | */ |
|---|
| 158 | extern int Tol_GetSerieContent _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 159 | int objc, |
|---|
| 160 | Tcl_Obj *CONST objv[], |
|---|
| 161 | Tcl_Obj * obj_result)); |
|---|
| 162 | |
|---|
| 163 | /*! Create a new command to manipulate a group of series. |
|---|
| 164 | */ |
|---|
| 165 | extern int Tol_CreateSerieGrp _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 166 | int objc, |
|---|
| 167 | Tcl_Obj *CONST series[], |
|---|
| 168 | Tcl_Obj * obj_result)); |
|---|
| 169 | |
|---|
| 170 | /*! Create a new command to manipulate a group of series. |
|---|
| 171 | */ |
|---|
| 172 | extern int Tol_DestroySerieGrp _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 173 | int objc, |
|---|
| 174 | Tcl_Obj *CONST objv[], |
|---|
| 175 | Tcl_Obj * obj_result)); |
|---|
| 176 | |
|---|
| 177 | /*! Create a new command to manipulate a group of sets (only one set) |
|---|
| 178 | */ |
|---|
| 179 | extern int Tol_CreateTable _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 180 | Tcl_Obj * tblcmd, |
|---|
| 181 | Tcl_Obj * objref, |
|---|
| 182 | int ismat, |
|---|
| 183 | Tcl_Obj * obj_result)); |
|---|
| 184 | |
|---|
| 185 | /*! Create a new command to manipulate a group of sets (only one set) |
|---|
| 186 | */ |
|---|
| 187 | extern int Tol_DestroyTable _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 188 | int objc, |
|---|
| 189 | Tcl_Obj *CONST objv[], |
|---|
| 190 | Tcl_Obj * obj_result)); |
|---|
| 191 | |
|---|
| 192 | /*! Fill in obj_result the list of tol files included |
|---|
| 193 | */ |
|---|
| 194 | extern int Tol_InfoIncluded _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 195 | Tcl_Obj * obj_result)); |
|---|
| 196 | |
|---|
| 197 | /*! Fill in obj_result the list of grammars defined in TOL |
|---|
| 198 | */ |
|---|
| 199 | extern int Tol_SetGrammarsObj _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 200 | Tcl_Obj * obj_result)); |
|---|
| 201 | |
|---|
| 202 | /*! Fill in obj_result the description of gra_name. |
|---|
| 203 | */ |
|---|
| 204 | int Tol_SetGrammarDescObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * gra_name, |
|---|
| 205 | Tcl_Obj * obj_result)); |
|---|
| 206 | |
|---|
| 207 | /*! Fill in obj_result the functions defined for grammar gra_name. |
|---|
| 208 | */ |
|---|
| 209 | extern int Tol_SetFunctionsObj _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 210 | Tcl_Obj * gra_name, |
|---|
| 211 | Tcl_Obj * obj_result)); |
|---|
| 212 | |
|---|
| 213 | /*! Fill in obj_result the function's prototype and description |
|---|
| 214 | * for a given function in a given grammar. |
|---|
| 215 | */ |
|---|
| 216 | int Tol_SetFunctionInfoObj _ANSI_ARGS_((Tcl_Obj * gra_name, |
|---|
| 217 | Tcl_Obj * fun_name, |
|---|
| 218 | Tcl_Obj * obj_result)); |
|---|
| 219 | /*! Fill in obj_result the variables defined for grammar gra_name. |
|---|
| 220 | */ |
|---|
| 221 | extern |
|---|
| 222 | int Tol_SetVariablesObj _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 223 | Tcl_Obj * gra_name, |
|---|
| 224 | Tcl_Obj * obj_result)); |
|---|
| 225 | |
|---|
| 226 | /*! Fill in obj_result the variables's description for a given function |
|---|
| 227 | * in a given grammar. |
|---|
| 228 | */ |
|---|
| 229 | extern |
|---|
| 230 | int Tol_SetVariableInfoObj _ANSI_ARGS_((Tcl_Obj * gra_name, |
|---|
| 231 | Tcl_Obj * var_name, |
|---|
| 232 | Tcl_Obj * obj_result)); |
|---|
| 233 | |
|---|
| 234 | /*! Create a new command to access the given TOL timeset object name. |
|---|
| 235 | */ |
|---|
| 236 | extern |
|---|
| 237 | int Tol_CreateTMSCmd _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 238 | Tcl_Obj * tmscmd, |
|---|
| 239 | Tcl_Obj * tmsname, |
|---|
| 240 | Tcl_Obj * obj_result)); |
|---|
| 241 | |
|---|
| 242 | /*! Destroy the tcl tms commands given in objv. |
|---|
| 243 | */ |
|---|
| 244 | extern |
|---|
| 245 | int Tol_DestroyTMSCmd _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 246 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 247 | Tcl_Obj * obj_result)); |
|---|
| 248 | |
|---|
| 249 | /*! Implement tol::date |
|---|
| 250 | */ |
|---|
| 251 | extern |
|---|
| 252 | int Tol_DateOption _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 253 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 254 | Tcl_Obj * obj_result)); |
|---|
| 255 | |
|---|
| 256 | /*! Implement tol::autocorr |
|---|
| 257 | */ |
|---|
| 258 | extern |
|---|
| 259 | int Tol_GetAutoCorr _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 260 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 261 | Tcl_Obj * obj_result)); |
|---|
| 262 | |
|---|
| 263 | /*! Implement tol::seriestat |
|---|
| 264 | */ |
|---|
| 265 | extern |
|---|
| 266 | int Tol_ComputeSerieStat _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 267 | int objc, Tcl_Obj *CONST objv[], |
|---|
| 268 | Tcl_Obj * obj_result)); |
|---|
| 269 | extern |
|---|
| 270 | int Tol_StopEvaluation _ANSI_ARGS_(()); |
|---|
| 271 | |
|---|
| 272 | extern |
|---|
| 273 | int Tol_LCFormat _ANSI_ARGS_((Tcl_Interp* interp, |
|---|
| 274 | Tcl_Obj*CONST value, |
|---|
| 275 | Tcl_Obj* obj_result)); |
|---|
| 276 | extern |
|---|
| 277 | void Tol_InstallHciWriter _ANSI_ARGS_(()); |
|---|
| 278 | |
|---|
| 279 | extern |
|---|
| 280 | void Tol_InstallMethodsHook _ANSI_ARGS_(()); |
|---|
| 281 | |
|---|
| 282 | END_C_DECLS |
|---|
| 283 | |
|---|
| 284 | //------------------------------------------------------------ |
|---|
| 285 | #ifdef __cplusplus |
|---|
| 286 | |
|---|
| 287 | //#define FINDVARIABLE FindVariable |
|---|
| 288 | #define FINDVARIABLE(name) FindOperand(name,true) |
|---|
| 289 | |
|---|
| 290 | class BSyntaxObject; |
|---|
| 291 | class BGrammar; |
|---|
| 292 | class BDate; |
|---|
| 293 | class BList; |
|---|
| 294 | |
|---|
| 295 | extern |
|---|
| 296 | int Tol_CreateSerieGrp _ANSI_ARGS_((Tcl_Interp * interp, |
|---|
| 297 | char * sgrp_name, |
|---|
| 298 | BList * series, |
|---|
| 299 | Tcl_Obj * obj_result)); |
|---|
| 300 | |
|---|
| 301 | extern |
|---|
| 302 | int Tol_ParseDate(Tcl_Interp * interp, char * what, BDate & date); |
|---|
| 303 | |
|---|
| 304 | /*! |
|---|
| 305 | * Tol_ResolveObject -- |
|---|
| 306 | * |
|---|
| 307 | * Resolve a SyntaxObject given a toltcl object reference. A |
|---|
| 308 | * reference is {TYPE ?container? i1 i2 ... in} or a global |
|---|
| 309 | * container's name of type File|Set|NameBlock|Console. When TYPE |
|---|
| 310 | * is Console then container is not given. The grammar of the |
|---|
| 311 | * object found is matched to the given argument grammar. If the |
|---|
| 312 | * return value is NULL an error message is left in interp. |
|---|
| 313 | */ |
|---|
| 314 | extern |
|---|
| 315 | BSyntaxObject * Tol_ResolveObject(Tcl_Interp *interp, |
|---|
| 316 | Tcl_Obj *obj_ref, |
|---|
| 317 | Tcl_Obj *obj_result/*, |
|---|
| 318 | BGrammar *grammar=NULL*/); |
|---|
| 319 | |
|---|
| 320 | extern |
|---|
| 321 | int Tol_ListToDate _ANSI_ARGS_(( Tcl_Interp * interp, Tcl_Obj * list, |
|---|
| 322 | BDate & date, Tcl_Obj * obj_result )); |
|---|
| 323 | |
|---|
| 324 | extern |
|---|
| 325 | int Tol_DateToList _ANSI_ARGS_(( BDate & date, Tcl_Obj * obj_result )); |
|---|
| 326 | |
|---|
| 327 | #endif /* __cplusplus */ |
|---|
| 328 | //------------------------------------------------------------ |
|---|
| 329 | |
|---|
| 330 | #endif /* TOLTCLINT_H */ |
|---|