Browse Source

ngspice.h, cm.h, cmpp.h, introduce char variants of the <ctype.h> family

pre-master-46
rlar 10 years ago
parent
commit
d0c5a495ca
  1. 23
      src/include/ngspice/cm.h
  2. 23
      src/include/ngspice/ngspice.h
  3. 23
      src/xspice/cmpp/cmpp.h

23
src/include/ngspice/cm.h

@ -57,4 +57,27 @@ NON-STANDARD FEATURES
#endif
/*
* type safe variants of the <ctype.h> functions for char arguments
*/
#if !defined(isalpha_c)
inline static int char_to_int(char c) { return (unsigned char) c; }
#define isalpha_c(x) isalpha(char_to_int(x))
#define islower_c(x) islower(char_to_int(x))
#define isdigit_c(x) isdigit(char_to_int(x))
#define isalnum_c(x) isalnum(char_to_int(x))
#define isprint_c(x) isprint(char_to_int(x))
#define isblank_c(x) isblank(char_to_int(x))
#define isspace_c(x) isspace(char_to_int(x))
#define isupper_c(x) isupper(char_to_int(x))
#define tolower_c(x) ((char) tolower(char_to_int(x)))
#define toupper_c(x) ((char) toupper(char_to_int(x)))
#endif
#endif

23
src/include/ngspice/ngspice.h

@ -334,4 +334,27 @@ ATTRIBUTE_NORETURN void controlled_exit(int status);
#endif
/*
* type safe variants of the <ctype.h> functions for char arguments
*/
#if !defined(isalpha_c)
inline static int char_to_int(char c) { return (unsigned char) c; }
#define isalpha_c(x) isalpha(char_to_int(x))
#define islower_c(x) islower(char_to_int(x))
#define isdigit_c(x) isdigit(char_to_int(x))
#define isalnum_c(x) isalnum(char_to_int(x))
#define isprint_c(x) isprint(char_to_int(x))
#define isblank_c(x) isblank(char_to_int(x))
#define isspace_c(x) isspace(char_to_int(x))
#define isupper_c(x) isupper(char_to_int(x))
#define tolower_c(x) ((char) tolower(char_to_int(x)))
#define toupper_c(x) ((char) toupper(char_to_int(x)))
#endif
#endif

23
src/xspice/cmpp/cmpp.h

@ -300,3 +300,26 @@ Status_t write_ifs_c_file(const char *filename, Ifs_Table_t *ifs_table);
FILE *fopen_cmpp(const char **path_p, const char *mode);
/*
* type safe variants of the <ctype.h> functions for char arguments
*/
#if !defined(isalpha_c)
inline static int char_to_int(char c) { return (unsigned char) c; }
#define isalpha_c(x) isalpha(char_to_int(x))
#define islower_c(x) islower(char_to_int(x))
#define isdigit_c(x) isdigit(char_to_int(x))
#define isalnum_c(x) isalnum(char_to_int(x))
#define isprint_c(x) isprint(char_to_int(x))
#define isblank_c(x) isblank(char_to_int(x))
#define isspace_c(x) isspace(char_to_int(x))
#define isupper_c(x) isupper(char_to_int(x))
#define tolower_c(x) ((char) tolower(char_to_int(x)))
#define toupper_c(x) ((char) toupper(char_to_int(x)))
#endif
Loading…
Cancel
Save