summaryrefslogtreecommitdiff
path: root/src/util/Misc.c
Commit message (Collapse)AuthorAge
* Correct typoeschnett2012-10-18
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4877 17b73243-c579-4c4c-a9d2-2d5706c11dac
* have CCTK_RegexMatch return a distinct error code if patterns is invalidrhaas2012-06-05
| | | | | | | | | | | | | | This patch changes the return value in the "does not compile" case to -1 and updates all source files that I could find that use it. Note that this patch changes behaviour of a routine. It used to return 0 for non-compiling patterns so thorns that test for C-like true would interpret invalid patterns as does-not-match, but will interpret the -1 return value as does-match. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4831 17b73243-c579-4c4c-a9d2-2d5706c11dac
* bugfix in {integer,real} parameter range checking routines for the casetradke2008-09-15
| | | | | | | | where there's only '*' given as allowed value (see also thread http://www.cactuscode.org/old/pipermail/developers/2008-September/005626.html) git-svn-id: http://svn.cactuscode.org/flesh/trunk@4504 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Cactus has currently an error in its parameter checking. Itschnetter2008-06-17
| | | | | | | | | | | | | | | | | | | | | | | | interprets ranges consisting of single numbers as allowing this number and all larger numbers. For example, the specification INT spatial_order "Order of spatial differencing" { 2 :: "second order" 4 :: "fourth order" } 2 allows all numbers not less than 2. This patch corrects this problem. Since this involves regular expressions which are often difficult to read, I have broken up the regular expressions into macros containing sub-expressions. I have also replaced calls to atoi and atof with calls to strtol and strtod, since these allow error checking which also was not present before. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4496 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Untabifying.goodale2005-10-03
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4163 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Print run time warnings while setting parameters with CCTK_WARNschnetter2005-09-26
| | | | | | | | | | | | | | instead of with fprintf (stderr, ...). Correct critical error in looking at the values of cctk_full_warnings, highlight_warning_messages, and cctk_strong_param_check. Handle the empty regular expression specially in CCTK_RegexMatch, since regcomp may treat it as illegal expression. In Cactus, an empty regular expression matches everything. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4150 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Ensure that the step size for integer parameter ranges is alwaysschnetter2005-09-04
| | | | | | | | | | positive. Cast to unsigned int when checking whether the parameter value complies with the step size. Explain why this is necessary. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4119 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Use int instead of size_t for string length. All other flesh routinesschnetter2004-12-30
| | | | | | | also use int for lengths and not size_t. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3950 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Revert accidental changes from the last commit.schnetter2004-12-28
| | | | | | | Sorry. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3945 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Rename "round" to "myround". Otherwise, the function "round" has theschnetter2004-12-28
| | | | | | | | same name as the one from <math.h> (which is #included) but has a different return type, which is an error for gcc 4.0. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3944 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add a C version of the function CCTK_FortranString. Useschnetter2004-04-12
| | | | | | | *_FORTSTRING_LEN to access the string length. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3660 17b73243-c579-4c4c-a9d2-2d5706c11dac
* for the functionjthorn2004-01-16
| | | | | | | | | | | | | | int Util_DoubleInRange(double inval, const char *range) move the text Valid ranges are of the form start:end:step possibly preceeded by a [ or ( and ended by a ) or ] to indicate closure. The end and step are optional. A * can also be used to indicate any value. from an internal comment up into the header comment, since it describes part of this function's caller-visible semantics. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3514 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Renamed routine CCTK_NULLPointer() into CCTK_NullPointer().tradke2003-02-12
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3136 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added C wrapper for fortran function CCTK_NULLPointer() which takes notradke2003-02-12
| | | | | | | | arguments and returns a C-style NULL pointer. This is necessary for initializing CCTK_POINTER variables in fortran code. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3135 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Make sure that strncpy'ed strings are properly NUL-terminated.tradke2003-02-11
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3133 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Implemented fortran wrapper functiontradke2002-12-11
| | | | | | | | | | | | addr = CCTK_PointerTo (var) CCTK_POINTER addr, var which returns the address of a variable passed in by reference from a fortran routine. This function is declared by the DECLARE_CCTK_FUNCTIONS macro. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3039 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Putting semicolons at the end of the CCTK_FILEVERSIONs.goodale2002-11-12
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@3028 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Replaced HUGE_VAL by DBL_MAX which should be used as the maximum floating-pointtradke2002-04-11
| | | | | | | | number. Thanks to Jonathan to point this out. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2707 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Use HUGE_VAL instead of FLT_MAX for the maximum possible value for doubles.tradke2002-04-11
| | | | | | | This closes Cactus/966. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2706 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Removed warning from CCTK_SetBoolean, this should be caught in anyallen2001-12-04
| | | | | | | calling routine git-svn-id: http://svn.cactuscode.org/flesh/trunk@2477 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed semantics for the fortran wrappers CCTK_FortranString() and ↵tradke2001-11-06
| | | | | | CCTK_ParameterValString(). git-svn-id: http://svn.cactuscode.org/flesh/trunk@2457 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed compiler warnings.tradke2001-05-19
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2193 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Compiler warningsallen2001-05-10
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2165 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Making rcsid strings constant - PR 669.goodale2001-05-10
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2159 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Cactus/460allen2000-10-07
| | | | | | | Optimising CCTK_Equals and fixing Util_NullTerminate git-svn-id: http://svn.cactuscode.org/flesh/trunk@1861 17b73243-c579-4c4c-a9d2-2d5706c11dac
* grdoc, style-guidelines, ...goodale2000-10-05
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1854 17b73243-c579-4c4c-a9d2-2d5706c11dac
* CCTK_NullTerminateString now removes the blanks at the end of a string.allen2000-10-04
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1853 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixing memory leak.goodale2000-05-12
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1650 17b73243-c579-4c4c-a9d2-2d5706c11dac
* CCTK_mkdir is now replaced byallen2000-05-10
| | | | | | | | | | | CCTK_CreateDirectory which creates a directory and any needed parents CCTK_mkdir will be removed in Beta 9 git-svn-id: http://svn.cactuscode.org/flesh/trunk@1636 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Moved the util string functions to one place.goodale2000-05-02
| | | | | | | | | | Added Util_StrSep - same functionality as strsep. Renamed CCTK_StrDup as Util_Strdup. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1621 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Removing rcsid warningsallen2000-04-17
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1559 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added back the line to in CCTK_FortranString which does agoodale2000-04-04
| | | | | | | | | | | | ONE_FORTSTRING_CREATE. This will produce compiler warnings about unused variables on most platforms but is necessary for the T3E. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1512 17b73243-c579-4c4c-a9d2-2d5706c11dac
* GRDOC and bugfix for CCTK_Strdup.goodale2000-03-31
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1507 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Removing compiler warningsallen2000-03-30
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1505 17b73243-c579-4c4c-a9d2-2d5706c11dac
* CCTK_Strduplanfer2000-03-28
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1498 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Removing compiler warningallen2000-03-23
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1487 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Untabified. A few format changes to get closer to standard.goodale2000-03-07
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1433 17b73243-c579-4c4c-a9d2-2d5706c11dac
* A little bit of tidying.goodale2000-03-06
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1421 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Updating GNU files to glibc 2.1.2.goodale2000-02-15
| | | | | | | | | | | | | | | Tidying up how they are included - now people should include cctk_GNU.h. This will allow us later to check what functions are available and maybe not compile the GNU stuff. NOTE: If you edit the GNU stuff please put a wapping great comment /* CCTK: Changed by <> on <> */ by the change and a note in the README. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1380 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Untabified.goodale2000-01-27
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1312 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Capitalising include file namesallen2000-01-16
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1265 17b73243-c579-4c4c-a9d2-2d5706c11dac
* config.h -> cctk_config.hallen2000-01-13
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1247 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix for negative parameters from Eric Schnetterallen1999-12-16
| | | | | | | | | Cactus/186 Also fix for closed ranges of parameters git-svn-id: http://svn.cactuscode.org/flesh/trunk@1200 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Removed tabs from files.goodale1999-11-24
| | | | | | | | | Added @version lines to various header files. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1170 17b73243-c579-4c4c-a9d2-2d5706c11dac
* CCTK_FortranString has to return the lenght of the string as CCTK_INT, not ↵lanfer1999-11-09
| | | | | | int because this gives pointer errors (on the T3E) git-svn-id: http://svn.cactuscode.org/flesh/trunk@1147 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Changing various things pointed to by compiling with -Wall.goodale1999-11-03
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1129 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fortran string stuff on the T3E. Have introducedgoodale1999-10-22
| | | | | | | | | | | | | | | ONE_FORTRSTRING_PTR(arg) etc to get the pointer to a fortran string. Still needs testing on other architectures. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1084 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added CCTK_FortranString which turns a C string into a fortran stringallen1999-10-14
| | | | | | | | Note that the fortran string has to have its length predefined, this routine returns also the number of characters which are used git-svn-id: http://svn.cactuscode.org/flesh/trunk@1022 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Renamed LOGICAL in ccl files to BOOLEANallen1999-09-21
| | | | | | | | | | LOGICAL will still work for now Hopefully this will remove the confusion in Fortran with "logicals" having integer values git-svn-id: http://svn.cactuscode.org/flesh/trunk@977 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Null Terminate String now gives a warning if the length of the stringallen1999-09-11
| | | | | | | | | | passed is more that 100000, since this always happens if you put the wrong arguments in a call to C from Fortran. It lets you carry on, since then you can use a debugger to see exactly where the problem is without editting any par files. git-svn-id: http://svn.cactuscode.org/flesh/trunk@896 17b73243-c579-4c4c-a9d2-2d5706c11dac