GLYLIB
0.3.0b
|
Classes | |
struct | gly_keysvals |
struct | fileset |
struct | fileslurp |
A structure for a function similar to the perl notion of "slurping" a file. More... | |
Functions | |
FILE * | myfopen (const char *Name, const char *option) |
Opens a file with error checking. | |
FILE * | myfreopen (const char *Name, const char *, FILE *option) |
void | read_eek (const char *surprise, const char *FileDesc) |
Complains (EEK!!!) if a file read fails. | |
void | read_neek (const char *surprise, int line, int field) |
Complains (EEK!!!) if a file read fails. | |
void | read_fneek (const char *surprise, int line, int field, const char *FILENAME) |
int | sscan_file (FILE *F, const char *str) |
Scans a file for instances of a string. | |
int | cscan_file (FILE *F, char c) |
fileslurp | slurp_file (fileset F) |
const char * | gly_get_current_working_directory (void) |
gly_keysvals | get_keysvals_from_slurp (fileslurp F, const char *SEP, int newline_sep, int ignore_hash) |
gly_keysvals | get_keysvals_from_file (fileset F, const char *SEP, int newline_sep, int ignore_hash) |
< Required for directory manipulations Required for directory manipulations Required to get the current working directory
int cscan_file | ( | FILE * | F, |
char | c | ||
) |
Returns the number of times the character c is found in file F
Definition at line 25 of file scan_file.c.
gly_keysvals get_keysvals_from_file | ( | fileset | F, |
const char * | SEP, | ||
int | newline_sep, | ||
int | ignore_hash | ||
) |
This is like get_keysvals_from_slurp (see) except it uses a file and not a fileslurp.
In fact, this function merely slurps in your file and then calls get_keysvals_from_slurp
Reads in keyword/value pairs from a file, drops them in a structure designed for the purpose.
< Slurp file
< Call the slurp version...
Definition at line 75 of file get_keysvals.c.
References get_keysvals_from_slurp(), and slurp_file().
gly_keysvals get_keysvals_from_slurp | ( | fileslurp | F, |
const char * | SEP, | ||
int | newline_sep, | ||
int | ignore_hash | ||
) |
Reads in keyword/value pairs from a file, drops them in a structure designed for the purpose.
Some notes:
< counter
< temporary pointer
< Loop through the slurp
< See if there is a hash in this line
< If there is a hash, call that the end of the string
< If no separator this line, ignore it
< If newline_sep is set
< Split string at SEP (find with strstr)
< Set end of the keyword string
< Prune whitespace and copy to K
< Move pointer to the end of the separator
< Prune whitespace and copy to V
Else
Definition at line 28 of file get_keysvals.c.
References gly_keysvals::K, fileslurp::L, gly_keysvals::n, fileslurp::n, prune_string_whitespace(), and gly_keysvals::V.
Referenced by get_keysvals_from_file().
const char* gly_get_current_working_directory | ( | void | ) |
Determines the current working directory.
Returns a pointer to a string corresponding to the current working directory.
Typical usage:
char *myCWD;
myCWD=strdup(gly_get_current_working_directory());
Definition at line 53 of file file_directory_status_utils.c.
References mywhine().
FILE* myfopen | ( | const char * | Name, |
const char * | option | ||
) |
Opens a file with error checking.
List of files and directories generated for each state. Opens a file with error checking. This function will open a file and then check to see if the file actually opened. If not, it will write a descriptive error message and exit(1) the program. Doing this saves many, many core dumps.
Definition at line 6 of file myfopen.c.
Referenced by crdsnaps(), load_atypes(), load_pdb(), outputAsmblPDB(), outputMolPDB(), read_amber_prmtop_asis(), slurp_file(), and write_amber_prmtop().
FILE* myfreopen | ( | const char * | Name, |
const char * | , | ||
FILE * | option | ||
) |
Like myfopen, but the freopen version.
Definition at line 25 of file myfopen.c.
Referenced by read_amber8_mden(), and read_prep().
void read_eek | ( | const char * | surprise, |
const char * | FileDesc | ||
) |
Complains (EEK!!!) if a file read fails.
Complains (EEK!!!) if a file read fails. Prints the following: "
Unexpected surprise during read of file FileDesc.
Exiting.
"
Definition at line 6 of file read_eek.c.
Referenced by load_atypes(), load_dlg_mol(), read_amber_prmtop_asis(), and read_prepres().
void read_fneek | ( | const char * | surprise, |
int | line, | ||
int | field, | ||
const char * | FILENAME | ||
) |
Complains (EEK!!!) if a file read fails.
Definition at line 18 of file read_neek.c.
Referenced by read_amber_prmtop_asis().
void read_neek | ( | const char * | surprise, |
int | line, | ||
int | field | ||
) |
Complains (EEK!!!) if a file read fails.
Complains (EEK!!!) if a file read fails. Prints the following: "
"
Definition at line 7 of file read_neek.c.
Referenced by rwm_line(), and rwm_line_char().
fileslurp slurp_file | ( | fileset | F | ) |
Slurps in the contents of an entire file or directory
Definition at line 19 of file fileslurp.c.
References fileset::F, fileslurp::L, line, myfopen(), fileset::N, and fileslurp::n.
Referenced by get_keysvals_from_file(), and load_dlg_mol().
int sscan_file | ( | FILE * | F, |
const char * | str | ||
) |
Scans a file for instances of a string.
Returns the number of times the string str is found in file F
Definition at line 7 of file scan_file.c.