1 /*$Id: l_lib.h,v 1.3 2010-08-16 12:23:30 felix Exp $ -*- C++ -*-
2 * Copyright (C) 2001 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
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 3, or (at your option)
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA
22 //testing=script 2006.07.13
26 #define HAVE_GETENV_DEFAULTS
27 // #include "u_parameter.h"
28 /*--------------------------------------------------------------------------*/
30 INTERFACE
bool Umatch(const std::string
&, const std::string
&);
31 INTERFACE
bool wmatch(const std::string
& s1
,const std::string
& s2
);
33 //template doesnt work?
34 INTERFACE
std::string
to_string(std::string
);
35 INTERFACE
std::string
to_string(int);
36 INTERFACE
std::string
to_string(unsigned long int);
37 INTERFACE
std::string
to_string(long int);
38 INTERFACE
std::string
to_string(unsigned);
39 INTERFACE
std::string
to_string(double);
40 INTERFACE
std::string
to_string(long double);
43 INTERFACE
std::string
to_string(std::vector
<double>);
44 INTERFACE
std::string
to_string(std::list
<double>);
46 INTERFACE
char* ftos(double,int,int,int);
47 /*--------------------------------------------------------------------------*/
49 enum { /* formatting bit-fields */
50 ftos_DEFAULT
= 0, /* default formatting, with letters */
51 ftos_EXP
= 1, /* use 'e' notation, almost like printf */
52 ftos_SIGN
= 2, /* always include sign */
53 ftos_FILL
= 4 /* fill in trailing zeros */
55 /*--------------------------------------------------------------------------*/
56 // wrappers for old standard C lpbrary
58 inline void system(const std::string
& s
) {itested();
62 inline void chdir(const std::string
& s
) {itested();
66 inline void remove(const std::string
& s
) {itested();
70 inline bool access_ok(const std::string
& file
, int mode
) {
71 return (::access(file
.c_str(), mode
) == 0/*file_ok*/);
74 inline std::string
getcwd() {itested();
76 char* cwd
= ::getcwd(buf
,BUFLEN
);
84 inline std::string
getenv(const std::string
& s
) {
85 char* ev
= ::getenv(s
.c_str());
94 T
getenv(const std::string
&, T def
);
97 inline T
getenv(const std::string
& s
, T def
) {
98 char* ev
= ::getenv(s
.c_str());
107 inline bool getenv(const std::string
& s
, bool def
) {
108 char* ev
= ::getenv(s
.c_str());
112 return strcmp(ev
,"no") && strcmp(ev
,"0");
116 /*--------------------------------------------------------------------------*/
117 /*--------------------------------------------------------------------------*/
119 // vim:ts=8:sw=2:noet: