summaryrefslogtreecommitdiff
path: root/src/util
Commit message (Collapse)AuthorAge
* Make table printing functions publicly accessibleeschnett2011-11-09
| | | | | | | | | | | | The table data types (util_Table.h) have internal routines that print the table contents to screen. This can be helpful for debugging. This patch makes these functions publicly available. Add a routine Util_TablePrintPretty that converts a table to a nice, human-readable string. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4769 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Accept comments in multi-line strings in parameter fileseschnett2011-07-02
| | | | | | | | | | Modify the parameter file parser to accept comments in multi-line strings. These comments extend from a "#" character to the end of the line. This makes it much easier to comment out variables in output strings. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4710 17b73243-c579-4c4c-a9d2-2d5706c11dac
* from Ian Hinder:knarf2011-01-06
| | | | | | | | | | | | | | | Correctly load parameter files with DOS line-endings Before this commit, when a parameter file with DOS line-endings was used, certain features of Cactus did not work correctly. For example, setting an output directory of $parfile would create an output directory named "$parfile" instead of expanding the parameter filename. This commit converts any CR-LF sequences to LF immediately after the parameter file is loaded. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4663 17b73243-c579-4c4c-a9d2-2d5706c11dac
* The function can get confused with detecting the end of the bufferschnetter2010-01-18
| | | | | | | | | | | | | | when the last line is in a comment or in a string, and may overrun the end of the buffer. The symptoms are error messages past the last line of the parameter file, because the memory after the buffer end is interpreted as (probably mal-formed) parameter file content. Since the paring routine is quite complex, this patch works around this problem by increasing the size of the buffer by a few characters and setting these to NUL. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4594 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Modify the behaviour of mixed C/Fortran string comparisons, so that itschnetter2009-12-05
| | | | | | | | | | | | | is consistent with the routines converting Fortran strings to C strings. Fortran strings have a fixed length, and trailing white space is usually ignored. The Cactus routine converting Fortran to C strings did already ignore trailing white space, but the routine comparing Fortran and C strings did not. This is now consistent. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4590 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Use size_t instead of char as index variable into the parse bufferschnetter2009-11-11
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4576 17b73243-c579-4c4c-a9d2-2d5706c11dac
* This patch improves the parser used by Cactus to prepocess parameterknarf2009-09-25
| | | | | | | | | | | | | | | | | | | files. The main changes are: - when reading a parameter file do not parse the file while reading, but read it first into a buffer, preprocess that and parse the buffer after that - replace the code which changes $parfile into the parameter file name to use this buffer preprocessing - replace $ENV{'*'} "defines" by environment variable values (*), e.g. $ENV{'HOME'} with $HOME. Frank git-svn-id: http://svn.cactuscode.org/flesh/trunk@4573 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
* Fixing Network.c for Cray XT4 Compute Node Linux Compatibility.jshalf2007-10-26
| | | | | | | | | | | | | | | | | | | | | | Network.c uses gethostbyname() which is available on the front-end nodes of the XT4, but not available on Compute Node Linux back-end nodes. The code will link fine with gethostbyname(), but will resolve to the dynamically shared library version of glibc. Since the Compute nodes do not understand dynamically linked libraries (only static linking), then it causes a fatal runtime error if gethostbyname() is invoked even though the compiler will not provide any warning that something bad will occur. Therefore, if you #define CRAY_XT, it will disable the gethostbyname() so as to prevent a fatal runtime error when GetHostName is called. Need to find out a way to recognize Cray XT4/Compute-node-Linux systems automatically. The front-end of the XT4 looks exactly like a Linux cluster. (uname returns "Linux"). Perhaps add a test to the Linux cluster known architectures file that points it to a XT4_CNL known-architetures file. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4434 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct logic errors in CCTK_TimerPrintDataI:schnetter2006-12-19
| | | | | | | | | | | | | | Timer handles are not numbered consecutively from 0 upwards. It is therefore not possible to test for legal timer number by checking the range [0, CCTK_NumTimers()). Instead, for each timer handle one has to check whether handled data exist. Remove the feature that a timer number of -1 prints all existing timers, since it is not possible (?) to iterate over all existing timers. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4396 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct off-by-one error when checking for a legal timer number inschnetter2006-12-18
| | | | | | | CCTK_TimerPrintDataI. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4395 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed formatting for the %g format conversion for small numbers.goodale2006-11-14
| | | | | | | Fixes PR 2058. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4386 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Make the parameter file parser preserve newlines in multi-line string parametertradke2006-08-31
| | | | | | | | | | values. This makes its behaviour consistent with the flesh API routine CCTK_ParameterSet(). This closes PR Cactus/2050: preserve newlines in quoted string parameter values. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4371 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add new flesh API functions CCTK_CompileDateTime() and Util_CurrentDateTime()tradke2006-07-28
| | | | | | | | | | | | | to return a date/time stamp following the ISO 8601 standard format if possible (see http://www.cactuscode.org/old/pipermail/developers/2006-July/004971.html). Add the timezone information in the time stamp returned by Util_CurrentTime(). You also need to update lib/make/make.configuration now in order to compile src/datestamp.c. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4358 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix return code of CCTK_CreateDirectory() if it already exists.tradke2006-05-08
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4292 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct typographical error in warning messageschnetter2006-03-21
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4272 17b73243-c579-4c4c-a9d2-2d5706c11dac
* As discussed in today's Cactus call, applying patches from 14 Febswhite2006-03-02
| | | | | | | Patches mailing list. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4263 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix for the erroneuously lablelled memory corruption. It seems what was just ↵yye002006-01-10
| | | | | | needed was more checking. This checked out alright on lemieux. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4231 17b73243-c579-4c4c-a9d2-2d5706c11dac
* minor fix for complex numbersyye002006-01-06
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4230 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Patch from Erik Schnetter to track the capacity of the list andgoodale2005-12-13
| | | | | | | produce an error if it is exceeded. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4210 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Untabifying.goodale2005-10-03
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4163 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Renaming min macro to MIN to avoid a conflict on windows.goodale2005-10-03
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4162 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
* Add Cactus variable type CCTK_POINTER_TO_CONSTschnetter2005-08-25
| | | | | | | | | | Complete the implementation of the Cactus variable type CCTK_POINTER_TO_CONST. Define a constant CCTK_VARIABLE_POINTER_TO_CONST. Handle this variable when asking for its name and its size. Allow values of this type in tables. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4113 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Don't highlight parameter parser warning messages about newlines in quotedtradke2005-08-04
| | | | | | | | strings. This applies patch http://www.cactuscode.org/pipermail/patches/2005-June/000061.html. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4102 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Insert missing "do" statement (which did not make the code incorrectschnetter2005-07-16
| | | | | | | -- very interesting bug!) git-svn-id: http://svn.cactuscode.org/flesh/trunk@4092 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Change whitespace for the RESIZE_STACK, PUSHOP, and PUSHTOK macroschnetter2005-07-16
| | | | | | | definitions to make the code fit into 80 columns. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4091 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Remove spurious (but harmless) break statement from PUSHTOK macro.schnetter2005-07-16
| | | | | | | Make RESIZE_STACK macro semicolon-safe. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4090 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed gcc compiler warnings about local variables named after global symbolstradke2005-04-05
| | | | | | | and potentially uninitialized variables. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4021 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Rename pow10 to mypow10 because pow10 is defined on some systems in <math.h>schnetter2005-03-24
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4018 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Declare variables at the beginning of a function block.tradke2005-03-21
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4017 17b73243-c579-4c4c-a9d2-2d5706c11dac
* update header comment description of where more docs can be foundjthorn2005-03-18
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4014 17b73243-c579-4c4c-a9d2-2d5706c11dac
* move some debug printf() calls closer to the start of their functionsjthorn2005-03-18
| | | | | | | (all inside #ifdef UTIL_TABLE_TEST) git-svn-id: http://svn.cactuscode.org/flesh/trunk@4010 17b73243-c579-4c4c-a9d2-2d5706c11dac
* split Table.c test driver out into a separate thorn (CactusTest/TestTable)jthorn2005-03-18
| | | | | | | | | | | also add another error check in insert_table_entry() to catch the case where the type code is invalid and hence CCTK_VarTypeSize() returns -1 --> this gives a new error return from this function, and hence from all the Util_TableSet* functions git-svn-id: http://svn.cactuscode.org/flesh/trunk@4008 17b73243-c579-4c4c-a9d2-2d5706c11dac
* * untabifyjthorn2005-03-17
| | | | | | | | | * add a bunch of debug printing to the standalone test drivers (which still core-dumps on my laptop after corrupting the malloc heap; I'm in the process of tracking down what's wrong...) git-svn-id: http://svn.cactuscode.org/flesh/trunk@4006 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Make CCTK_BYTE and CCTK_CHAR be distinct types. CCTK_BYTE is for gridschnetter2005-01-29
| | | | | | | | | | | | variables, and CCTK_CHAR (like CCTK_STRING) only for other purposes, e.g. tables. * Introduce unique integer constants for them * Add missing conversion functions from and to strings * Add table functions for CCTK_BYTE. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3972 17b73243-c579-4c4c-a9d2-2d5706c11dac
* The Fortran wrappers for Util_Table{Get,Set}Char are broken; removeschnetter2005-01-27
| | | | | | | | | them. Technically, Fortran has no character type, but only strings, hence the interface to that routine needs to be different from C. Util_TableSetString is still there, used, and works. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3967 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
* fix wrong function name in grdoc commentjthorn2004-12-28
| | | | | | | -- it's Util_StrSep(), not CCTK_StrSep() git-svn-id: http://svn.cactuscode.org/flesh/trunk@3947 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Revert another accidental change.schnetter2004-12-28
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3946 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
* Added support for 'g' format.goodale2004-12-20
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3941 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added support for E format.goodale2004-12-20
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3940 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix bug which ate zeros after decimal places for output.goodale2004-12-20
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3939 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Undo my previous commit because it was GPL code.tradke2004-12-17
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3936 17b73243-c579-4c4c-a9d2-2d5706c11dac
* New version of snprintf() and vsnprintf(). These are taken from the glib 1.2.8tradke2004-12-17
| | | | | | | | | source code. They have integrated a fix to correctly convert floating point numbers into their string representation. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3935 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Functions completing the Cactus Timer API.swhite2004-08-12
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3828 17b73243-c579-4c4c-a9d2-2d5706c11dac