1 /** 2 * @file util.c 3 * @brief Supporting functions for example code 4 * @author Ben Bornstein 5 * @author Michael Hucka 6 * 7 * <!-------------------------------------------------------------------------- 8 * This sample program is distributed under a different license than the rest 9 * of libSBML. This program uses the open-source MIT license, as follows: 10 * 11 * Copyright (c) 2013-2018 by the California Institute of Technology 12 * (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK) 13 * and the University of Heidelberg (Germany), with support from the National 14 * Institutes of Health (USA) under grant R01GM070923. All rights reserved. 15 * 16 * Permission is hereby granted, free of charge, to any person obtaining a 17 * copy of this software and associated documentation files (the "Software"), 18 * to deal in the Software without restriction, including without limitation 19 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 20 * and/or sell copies of the Software, and to permit persons to whom the 21 * Software is furnished to do so, subject to the following conditions: 22 * 23 * The above copyright notice and this permission notice shall be included in 24 * all copies or substantial portions of the Software. 25 * 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 29 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 31 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 32 * DEALINGS IN THE SOFTWARE. 33 * 34 * Neither the name of the California Institute of Technology (Caltech), nor 35 * of the European Bioinformatics Institute (EMBL-EBI), nor of the University 36 * of Heidelberg, nor the names of any contributors, may be used to endorse 37 * or promote products derived from this software without specific prior 38 * written permission. 39 * ------------------------------------------------------------------------ --> 40 */ 41 42 43 /** 44 * @return the number of milliseconds elapsed since the Epoch. 45 */ 46 #ifdef __BORLANDC__ 47 unsigned long 48 #else 49 unsigned long long 50 #endif 51 getCurrentMillis (void); 52 53 /** 54 * @return the size (in bytes) of the given filename. 55 */ 56 unsigned long 57 getFileSize (const char *filename); 58 59 /** 60 * Removes whitespace from both ends of the given string. The string 61 * is modified in-place. This function returns a pointer to the (same) 62 * string buffer. 63 */ 64 char * 65 trim_whitespace (char *s); 66 67 /** 68 * The function get_line reads a line from a file (in this case "stdin" and 69 * returns it as a string. It is taken from the utilities library of the 70 * VIENNA RNA PACKAGE ( http://www.tbi.univie.ac.at/~ivo/RNA/ ) 71 */ 72 char* 73 get_line (FILE *fp); 74 75