

Go to the source code of this file.
Classes | |
| struct | cbf_handle_struct |
Defines | |
| #define | CBF_LINELENGTH 80 |
| #define | CBF_FORMAT 0x00000001 |
| #define | CBF_ALLOC 0x00000002 |
| #define | CBF_ARGUMENT 0x00000004 |
| #define | CBF_ASCII 0x00000008 |
| #define | CBF_BINARY 0x00000010 |
| #define | CBF_BITCOUNT 0x00000020 |
| #define | CBF_ENDOFDATA 0x00000040 |
| #define | CBF_FILECLOSE 0x00000080 |
| #define | CBF_FILEOPEN 0x00000100 |
| #define | CBF_FILEREAD 0x00000200 |
| #define | CBF_FILESEEK 0x00000400 |
| #define | CBF_FILETELL 0x00000800 |
| #define | CBF_FILEWRITE 0x00001000 |
| #define | CBF_IDENTICAL 0x00002000 |
| #define | CBF_NOTFOUND 0x00004000 |
| #define | CBF_OVERFLOW 0x00008000 |
| #define | CBF_TOKEN_NULL '\377' |
| #define | CBF_TOKEN_WORD '\300' |
| #define | CBF_TOKEN_SQSTRING '\301' |
| #define | CBF_TOKEN_DQSTRING '\302' |
| #define | CBF_TOKEN_SCSTRING '\303' |
| #define | CBF_TOKEN_BIN '\304' |
| #define | CBF_TOKEN_MIME_BIN '\305' |
| #define | CBF_TOKEN_TMP_BIN '\306' |
| #define | CBF_INTEGER 0x0010 |
| #define | CBF_FLOAT 0x0020 |
| #define | CBF_CANONICAL 0x0050 |
| #define | CBF_PACKED 0x0060 |
| #define | CBF_BYTE_OFFSET 0x0070 |
| #define | CBF_PREDICTOR 0x0080 |
| #define | CBF_NONE 0x0040 |
| #define | PLAIN_HEADERS 0x0001 |
| #define | MIME_HEADERS 0x0002 |
| #define | MSG_NODIGEST 0x0004 |
| #define | MSG_DIGEST 0x0008 |
| #define | MSG_DIGESTNOW 0x0010 |
| #define | HDR_DEFAULT (MIME_HEADERS | MSG_NODIGEST) |
| #define | MIME_NOHEADERS PLAIN_HEADERS |
| #define | CBF 0x0000 |
| #define | CIF 0x0001 |
| #define | ENC_NONE 0x0001 |
| #define | ENC_BASE64 0x0002 |
| #define | ENC_QP 0x0004 |
| #define | ENC_BASE10 0x0008 |
| #define | ENC_BASE16 0x0010 |
| #define | ENC_BASE8 0x0020 |
| #define | ENC_FORWARD 0x0040 |
| #define | ENC_BACKWARD 0x0080 |
| #define | ENC_CRTERM 0x0100 |
| #define | ENC_LFTERM 0x0200 |
| #define | ENC_DEFAULT (ENC_BASE64 | ENC_LFTERM | ENC_FORWARD) |
| #define | cbf_failnez(f) { int err; err = (f); if (err) return err; } |
| #define | cbf_onfailnez(f, c) { int err; err = (f); if (err) {{ c; } return err; }} |
Typedefs | |
| typedef cbf_handle_struct * | cbf_handle |
Functions | |
| int | cbf_make_handle (cbf_handle *handle) |
| int | cbf_free_handle (cbf_handle handle) |
| int | cbf_read_file (cbf_handle handle, FILE *stream, int headers) |
| int | cbf_write_file (cbf_handle handle, FILE *stream, int isbuffer, int ciforcbf, int headers, int encoding) |
| int | cbf_new_datablock (cbf_handle handle, const char *datablockname) |
| int | cbf_force_new_datablock (cbf_handle handle, const char *datablockname) |
| int | cbf_new_category (cbf_handle handle, const char *categoryname) |
| int | cbf_force_new_category (cbf_handle handle, const char *categoryname) |
| int | cbf_new_column (cbf_handle handle, const char *columnname) |
| int | cbf_new_row (cbf_handle handle) |
| int | cbf_insert_row (cbf_handle handle, const int rownumber) |
| int | cbf_delete_row (cbf_handle handle, const int rownumber) |
| int | cbf_set_datablockname (cbf_handle handle, const char *datablockname) |
| int | cbf_reset_datablocks (cbf_handle handle) |
| int | cbf_reset_datablock (cbf_handle handle) |
| int | cbf_reset_category (cbf_handle handle) |
| int | cbf_remove_datablock (cbf_handle handle) |
| int | cbf_remove_category (cbf_handle handle) |
| int | cbf_remove_column (cbf_handle handle) |
| int | cbf_remove_row (cbf_handle handle) |
| int | cbf_rewind_datablock (cbf_handle handle) |
| int | cbf_rewind_category (cbf_handle handle) |
| int | cbf_rewind_column (cbf_handle handle) |
| int | cbf_rewind_row (cbf_handle handle) |
| int | cbf_next_datablock (cbf_handle handle) |
| int | cbf_next_category (cbf_handle handle) |
| int | cbf_next_column (cbf_handle handle) |
| int | cbf_next_row (cbf_handle handle) |
| int | cbf_find_datablock (cbf_handle handle, const char *datablockname) |
| int | cbf_find_category (cbf_handle handle, const char *categoryname) |
| int | cbf_find_column (cbf_handle handle, const char *columnname) |
| int | cbf_find_row (cbf_handle handle, const char *value) |
| int | cbf_find_nextrow (cbf_handle handle, const char *value) |
| int | cbf_count_datablocks (cbf_handle handle, unsigned int *datablocks) |
| int | cbf_count_categories (cbf_handle handle, unsigned int *categories) |
| int | cbf_count_columns (cbf_handle handle, unsigned int *columns) |
| int | cbf_count_rows (cbf_handle handle, unsigned int *rows) |
| int | cbf_select_datablock (cbf_handle handle, unsigned int datablock) |
| int | cbf_select_category (cbf_handle handle, unsigned int category) |
| int | cbf_select_column (cbf_handle handle, unsigned int column) |
| int | cbf_select_row (cbf_handle handle, unsigned int row) |
| int | cbf_datablock_name (cbf_handle handle, const char **datablockname) |
| int | cbf_category_name (cbf_handle handle, const char **categoryname) |
| int | cbf_column_name (cbf_handle handle, const char **columnname) |
| int | cbf_row_number (cbf_handle handle, unsigned int *row) |
| int | cbf_get_value (cbf_handle handle, const char **value) |
| int | cbf_set_value (cbf_handle handle, const char *value) |
| int | cbf_get_integervalue (cbf_handle handle, int *number) |
| int | cbf_get_doublevalue (cbf_handle handle, double *number) |
| int | cbf_set_integervalue (cbf_handle handle, int number) |
| int | cbf_set_doublevalue (cbf_handle handle, const char *format, double number) |
| int | cbf_get_integerarrayparameters (cbf_handle handle, unsigned int *compression, int *id, size_t *elsize, int *elsigned, int *elunsigned, size_t *nelem, int *minelem, int *maxelem) |
| int | cbf_get_integerarray (cbf_handle handle, int *id, void *value, size_t elsize, int elsign, size_t nelem, size_t *nelem_read) |
| int | cbf_set_integerarray (cbf_handle handle, unsigned int compression, int id, void *value, size_t elsize, int elsign, size_t nelem) |
| #define CBF 0x0000 |
Definition at line 87 of file cbf.h.
Referenced by PutCIFData().
| #define CBF_ALLOC 0x00000002 |
Definition at line 32 of file cbf.h.
Referenced by cbf_force_new_category(), cbf_force_new_datablock(), cbf_new_category(), cbf_new_column(), cbf_new_datablock(), cbf_realloc(), cbf_return_text(), cbf_set_bintext(), cbf_set_datablockname(), and cbf_set_value().
| #define CBF_ARGUMENT 0x00000004 |
Definition at line 33 of file cbf.h.
Referenced by cbf_add_child(), cbf_add_columnrow(), cbf_add_contextconnection(), cbf_add_fileconnection(), cbf_add_link(), cbf_add_new_child(), cbf_alloc(), cbf_category_name(), cbf_child_index(), cbf_close_temporary(), cbf_column_name(), cbf_compress(), cbf_compress_canonical(), cbf_compress_none(), cbf_compress_packed(), cbf_copy_file(), cbf_count_categories(), cbf_count_children(), cbf_count_columns(), cbf_count_datablocks(), cbf_count_rows(), cbf_count_values(), cbf_datablock_name(), cbf_decompress(), cbf_decompress_canonical(), cbf_decompress_none(), cbf_decompress_packed(), cbf_delete_columnrow(), cbf_delete_contextconnection(), cbf_delete_fileconnection(), cbf_delete_row(), cbf_end_digest(), cbf_find_category(), cbf_find_child(), cbf_find_column(), cbf_find_datablock(), cbf_find_last_child(), cbf_find_nextrow(), cbf_find_parent(), cbf_flush_bits(), cbf_flush_characters(), cbf_force_new_category(), cbf_force_new_datablock(), cbf_free(), cbf_free_node(), cbf_free_value(), cbf_generate_canonicalcodes(), cbf_get_block(), cbf_get_buffer(), cbf_get_child(), cbf_get_columnrow(), cbf_get_filecoordinates(), cbf_get_fileposition(), cbf_get_integerarray(), cbf_get_integerarrayparameters(), cbf_get_name(), cbf_get_value(), cbf_insert_columnrow(), cbf_insert_row(), cbf_make_child(), cbf_make_compressdata(), cbf_make_new_child(), cbf_make_new_node(), cbf_make_node(), cbf_md5digest_to64(), cbf_name_new_node(), cbf_name_node(), cbf_new_category(), cbf_new_column(), cbf_new_datablock(), cbf_new_row(), cbf_next_category(), cbf_next_column(), cbf_next_datablock(), cbf_next_row(), cbf_open_temporary(), cbf_put_block(), cbf_put_string(), cbf_read_file(), cbf_read_line(), cbf_realloc(), cbf_remove_category(), cbf_remove_column(), cbf_remove_datablock(), cbf_remove_row(), cbf_reset_bits(), cbf_reset_buffer(), cbf_reset_category(), cbf_reset_characters(), cbf_reset_datablock(), cbf_reset_datablocks(), cbf_rewind_category(), cbf_rewind_column(), cbf_rewind_datablock(), cbf_rewind_row(), cbf_row_number(), cbf_save_character(), cbf_select_category(), cbf_select_column(), cbf_select_datablock(), cbf_select_row(), cbf_set_buffersize(), cbf_set_children(), cbf_set_columnrow(), cbf_set_datablockname(), cbf_set_filecoordinates(), cbf_set_fileposition(), cbf_set_integerarray(), cbf_set_link(), cbf_set_value(), cbf_shift_link(), cbf_start_digest(), cbf_tobasex(), cbf_toqp(), cbf_value_type(), cbf_write_ascii(), cbf_write_binary(), cbf_write_category(), cbf_write_datablockname(), cbf_write_file(), cbf_write_itemname(), cbf_write_node(), cbf_write_string(), and cbf_write_value().
| #define CBF_ASCII 0x00000008 |
Definition at line 34 of file cbf.h.
Referenced by cbf_get_bintext(), cbf_get_integerarrayparameters(), and cbf_mime_temp().
| #define CBF_BINARY 0x00000010 |
Definition at line 35 of file cbf.h.
Referenced by cbf_get_value().
| #define CBF_BITCOUNT 0x00000020 |
Definition at line 36 of file cbf.h.
Referenced by cbf_compress_canonical().
| #define CBF_BYTE_OFFSET 0x0070 |
Definition at line 67 of file cbf.h.
Referenced by cbf_compress(), cbf_decompress(), cbf_decompress_parameters(), cbf_parse_mimeheader(), and cbf_write_binary().
| #define CBF_CANONICAL 0x0050 |
Definition at line 65 of file cbf.h.
Referenced by cbf_compress(), cbf_decompress(), cbf_decompress_parameters(), cbf_parse_mimeheader(), and cbf_write_binary().
| #define CBF_ENDOFDATA 0x00000040 |
Definition at line 37 of file cbf.h.
Referenced by cbf_get_code().
| #define cbf_failnez | ( | f | ) | { int err; err = (f); if (err) return err; } |
Definition at line 120 of file cbf.h.
Referenced by cbf_add_child(), cbf_add_link(), cbf_add_new_child(), cbf_binary_parameters(), cbf_category_name(), cbf_check_digest(), cbf_close_temporary(), cbf_column_name(), cbf_compress(), cbf_compress_canonical(), cbf_compress_none(), cbf_compress_packed(), cbf_construct_tree(), cbf_copy_file(), cbf_count_categories(), cbf_count_columns(), cbf_count_datablocks(), cbf_count_rows(), cbf_datablock_name(), cbf_decompress_canonical(), cbf_decompress_packed(), cbf_decompress_parameters(), cbf_delete_columnrow(), cbf_delete_row(), cbf_end_digest(), cbf_find_category(), cbf_find_column(), cbf_find_datablock(), cbf_find_nextrow(), cbf_find_row(), cbf_flush_bits(), cbf_force_new_category(), cbf_force_new_datablock(), cbf_free_node(), cbf_free_value(), cbf_frombase64(), cbf_frombasex(), cbf_fromqp(), cbf_get_binary(), cbf_get_bintext(), cbf_get_bits(), cbf_get_block(), cbf_get_doublevalue(), cbf_get_integer(), cbf_get_integervalue(), cbf_get_table(), cbf_get_value(), cbf_initialise_compressdata(), cbf_insert_columnrow(), cbf_insert_row(), cbf_make_child(), cbf_make_compressdata(), cbf_make_context(), cbf_make_file(), cbf_make_handle(), cbf_make_new_child(), cbf_make_new_node(), cbf_make_node(), cbf_md5digest(), cbf_mime_temp(), cbf_new_category(), cbf_new_column(), cbf_new_datablock(), cbf_new_row(), cbf_next_category(), cbf_next_column(), cbf_next_datablock(), cbf_next_row(), cbf_open_temporary(), cbf_pack_chunk(), cbf_parse_binaryheader(), cbf_parse_mimeheader(), cbf_put_bits(), cbf_put_block(), cbf_put_character(), cbf_put_integer(), cbf_put_stopcode(), cbf_put_string(), cbf_put_table(), cbf_read_file(), cbf_read_line(), cbf_read_mime(), cbf_remove_category(), cbf_remove_column(), cbf_remove_datablock(), cbf_reset_category(), cbf_reset_datablock(), cbf_reset_datablocks(), cbf_rewind_category(), cbf_rewind_column(), cbf_rewind_datablock(), cbf_save_character(), cbf_select_category(), cbf_select_column(), cbf_select_datablock(), cbf_select_row(), cbf_set_binary(), cbf_set_children(), cbf_set_columnrow(), cbf_set_datablockname(), cbf_setup_decode(), cbf_skip_whitespace(), cbf_start_digest(), cbf_tobase64(), cbf_tobasex(), cbf_toqp(), cbf_write_ascii(), cbf_write_binary(), cbf_write_category(), cbf_write_character(), cbf_write_datablockname(), cbf_write_file(), cbf_write_itemname(), cbf_write_node(), cbf_write_string(), cbf_write_value(), and yyparse().
| #define CBF_FILECLOSE 0x00000080 |
Definition at line 38 of file cbf.h.
Referenced by cbf_free_file(), and cbf_open_temporary().
| #define CBF_FILEOPEN 0x00000100 |
Definition at line 39 of file cbf.h.
Referenced by cbf_open_temporary().
| #define CBF_FILEREAD 0x00000200 |
Definition at line 40 of file cbf.h.
Referenced by cbf_frombase64(), cbf_frombasex(), cbf_fromqp(), cbf_get_bits(), cbf_get_block(), cbf_get_code(), cbf_lex(), cbf_read_line(), cbf_tobase64(), cbf_tobasex(), and cbf_toqp().
| #define CBF_FILESEEK 0x00000400 |
Definition at line 41 of file cbf.h.
Referenced by cbf_set_binary(), and cbf_set_fileposition().
| #define CBF_FILETELL 0x00000800 |
Definition at line 42 of file cbf.h.
Referenced by cbf_get_fileposition(), and cbf_set_binary().
| #define CBF_FILEWRITE 0x00001000 |
Definition at line 43 of file cbf.h.
Referenced by cbf_copy_file(), cbf_flush_characters(), and cbf_put_block().
| #define CBF_FORMAT 0x00000001 |
Definition at line 31 of file cbf.h.
Referenced by cbf_check_digest(), cbf_count_rows(), cbf_decompress_none(), cbf_decompress_parameters(), cbf_frombasex(), cbf_fromqp(), cbf_get_code(), cbf_initialise_compressdata(), cbf_lex(), cbf_mime_temp(), cbf_parse_binaryheader(), cbf_parse_mimeheader(), and cbf_read_mime().
| #define CBF_IDENTICAL 0x00002000 |
Definition at line 44 of file cbf.h.
Referenced by cbf_add_child(), and cbf_name_node().
| #define CBF_INTEGER 0x0010 |
Definition at line 63 of file cbf.h.
Referenced by cbf_decompress_parameters().
| #define CBF_LINELENGTH 80 |
Definition at line 26 of file cbf.h.
Referenced by cbf_write_ascii().
| #define CBF_NONE 0x0040 |
Definition at line 69 of file cbf.h.
Referenced by cbf_compress(), cbf_decompress(), cbf_decompress_parameters(), cbf_parse_mimeheader(), and cbf_write_binary().
| #define CBF_NOTFOUND 0x00004000 |
Definition at line 45 of file cbf.h.
Referenced by cbf_add_fileconnection(), cbf_child_index(), cbf_close_temporary(), cbf_delete_columnrow(), cbf_find_child(), cbf_find_last_child(), cbf_find_nextrow(), cbf_find_parent(), cbf_get_child(), cbf_get_columnrow(), cbf_get_doublevalue(), cbf_get_integervalue(), cbf_insert_columnrow(), cbf_make_child(), cbf_next_row(), cbf_read_file(), cbf_reset_datablocks(), cbf_select_row(), and cbf_write_value().
| #define cbf_onfailnez | ( | f, | |
| c | |||
| ) | { int err; err = (f); if (err) {{ c; } return err; }} |
Definition at line 122 of file cbf.h.
Referenced by cbf_compress_canonical(), cbf_compress_packed(), cbf_decompress_canonical(), cbf_make_new_node(), cbf_make_node(), cbf_mime_temp(), cbf_set_binary(), and cbf_set_bintext().
| #define CBF_OVERFLOW 0x00008000 |
Definition at line 46 of file cbf.h.
Referenced by cbf_decompress_none(), cbf_decompress_parameters(), and cbf_get_integer().
| #define CBF_PACKED 0x0060 |
Definition at line 66 of file cbf.h.
Referenced by cbf_compress(), cbf_decompress(), cbf_decompress_parameters(), cbf_parse_mimeheader(), cbf_write_binary(), and PutCIFData().
| #define CBF_PREDICTOR 0x0080 |
Definition at line 68 of file cbf.h.
Referenced by cbf_compress(), cbf_decompress(), cbf_decompress_parameters(), cbf_parse_mimeheader(), and cbf_write_binary().
| #define CBF_TOKEN_BIN '\304' |
Definition at line 56 of file cbf.h.
Referenced by cbf_is_binary(), cbf_lex(), cbf_write_binary(), and cbf_write_value().
| #define CBF_TOKEN_DQSTRING '\302' |
Definition at line 54 of file cbf.h.
Referenced by cbf_lex(), cbf_value_type(), cbf_write_ascii(), and cbf_write_value().
| #define CBF_TOKEN_MIME_BIN '\305' |
Definition at line 57 of file cbf.h.
Referenced by cbf_is_binary(), cbf_is_mimebinary(), cbf_lex(), and cbf_write_value().
| #define CBF_TOKEN_NULL '\377' |
Definition at line 51 of file cbf.h.
Referenced by cbf_lex(), cbf_write_ascii(), and cbf_write_value().
| #define CBF_TOKEN_SCSTRING '\303' |
Definition at line 55 of file cbf.h.
Referenced by cbf_lex(), cbf_value_type(), cbf_write_ascii(), and cbf_write_value().
| #define CBF_TOKEN_SQSTRING '\301' |
Definition at line 53 of file cbf.h.
Referenced by cbf_lex(), cbf_value_type(), cbf_write_ascii(), and cbf_write_value().
| #define CBF_TOKEN_TMP_BIN '\306' |
Definition at line 58 of file cbf.h.
Referenced by cbf_free_value(), cbf_is_binary(), cbf_mime_temp(), cbf_set_binary(), cbf_write_binary(), and cbf_write_value().
| #define CBF_TOKEN_WORD '\300' |
Definition at line 52 of file cbf.h.
Referenced by cbf_lex(), cbf_value_type(), cbf_write_ascii(), and cbf_write_value().
| #define CIF 0x0001 |
Definition at line 88 of file cbf.h.
Referenced by cbf_write_file(), and PutCIFData().
| #define ENC_BACKWARD 0x0080 |
Definition at line 100 of file cbf.h.
Referenced by cbf_tobasex(), and cbf_write_file().
| #define ENC_BASE10 0x0008 |
Definition at line 96 of file cbf.h.
Referenced by cbf_lex(), cbf_parse_mimeheader(), cbf_read_mime(), cbf_write_binary(), and cbf_write_file().
| #define ENC_BASE16 0x0010 |
Definition at line 97 of file cbf.h.
Referenced by cbf_lex(), cbf_parse_mimeheader(), cbf_read_mime(), cbf_write_binary(), and cbf_write_file().
| #define ENC_BASE64 0x0002 |
Definition at line 94 of file cbf.h.
Referenced by cbf_lex(), cbf_parse_mimeheader(), cbf_read_mime(), cbf_write_binary(), cbf_write_file(), and PutCIFData().
| #define ENC_BASE8 0x0020 |
Definition at line 98 of file cbf.h.
Referenced by cbf_lex(), cbf_parse_mimeheader(), cbf_read_mime(), cbf_write_binary(), and cbf_write_file().
| #define ENC_CRTERM 0x0100 |
Definition at line 101 of file cbf.h.
Referenced by cbf_write_character(), cbf_write_file(), and PutCIFData().
| #define ENC_DEFAULT (ENC_BASE64 | ENC_LFTERM | ENC_FORWARD) |
Definition at line 104 of file cbf.h.
Referenced by cbf_write_file().
| #define ENC_FORWARD 0x0040 |
Definition at line 99 of file cbf.h.
Referenced by cbf_tobasex(), and cbf_write_file().
| #define ENC_LFTERM 0x0200 |
Definition at line 102 of file cbf.h.
Referenced by cbf_write_character(), cbf_write_file(), and PutCIFData().
| #define ENC_NONE 0x0001 |
Definition at line 93 of file cbf.h.
Referenced by cbf_lex(), cbf_parse_mimeheader(), cbf_write_binary(), cbf_write_file(), cbf_write_node(), and PutCIFData().
| #define ENC_QP 0x0004 |
Definition at line 95 of file cbf.h.
Referenced by cbf_lex(), cbf_parse_mimeheader(), cbf_read_mime(), cbf_write_binary(), and cbf_write_file().
| #define HDR_DEFAULT (MIME_HEADERS | MSG_NODIGEST) |
Definition at line 80 of file cbf.h.
Referenced by cbf_read_file(), and cbf_write_file().
| #define MIME_HEADERS 0x0002 |
Definition at line 75 of file cbf.h.
Referenced by cbf_write_binary(), cbf_write_file(), and PutCIFData().
| #define MIME_NOHEADERS PLAIN_HEADERS |
Definition at line 82 of file cbf.h.
Referenced by cbf_write_binary().
| #define MSG_DIGEST 0x0008 |
Definition at line 77 of file cbf.h.
Referenced by cbf_check_digest(), cbf_mime_temp(), cbf_read_file(), cbf_write_binary(), cbf_write_file(), GetCIFHeader(), and PutCIFData().
| #define MSG_DIGESTNOW 0x0010 |
Definition at line 78 of file cbf.h.
Referenced by cbf_lex(), cbf_read_file(), and cbf_write_file().
| #define MSG_NODIGEST 0x0004 |
Definition at line 76 of file cbf.h.
Referenced by cbf_read_file(), and cbf_write_file().
| #define PLAIN_HEADERS 0x0001 |
Definition at line 74 of file cbf.h.
Referenced by cbf_write_file().
| typedef cbf_handle_struct* cbf_handle |
| int cbf_category_name | ( | cbf_handle | handle, |
| const char ** | categoryname | ||
| ) |
Definition at line 1844 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_failnez, cbf_find_parent(), cbf_get_name(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* Get the name */
return cbf_get_name (categoryname, node);
}
| int cbf_column_name | ( | cbf_handle | handle, |
| const char ** | columnname | ||
| ) |
Definition at line 1866 of file cbf.c.
References CBF_ARGUMENT, CBF_COLUMN, cbf_failnez, cbf_find_parent(), cbf_get_name(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the column node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_COLUMN))
/* Get the name */
return cbf_get_name (columnname, node);
}
| int cbf_count_categories | ( | cbf_handle | handle, |
| unsigned int * | categories | ||
| ) |
Definition at line 1715 of file cbf.c.
References CBF_ARGUMENT, cbf_count_children(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Count the categories */
return cbf_count_children (categories, node);
}
| int cbf_count_columns | ( | cbf_handle | handle, |
| unsigned int * | columns | ||
| ) |
Definition at line 1737 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_count_children(), cbf_failnez, cbf_find_parent(), and cbf_handle_struct::node.
Referenced by cbf_delete_row(), cbf_insert_row(), and cbf_new_row().
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* Count the columns */
return cbf_count_children (columns, node);
}
| int cbf_count_datablocks | ( | cbf_handle | handle, |
| unsigned int * | datablocks | ||
| ) |
Definition at line 1693 of file cbf.c.
References CBF_ARGUMENT, cbf_count_children(), cbf_failnez, cbf_find_parent(), CBF_ROOT, and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
/* Count the data blocks */
return cbf_count_children (datablocks, node);
}
| int cbf_count_rows | ( | cbf_handle | handle, |
| unsigned int * | rows | ||
| ) |
Definition at line 1759 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_count_children(), cbf_failnez, cbf_find_parent(), CBF_FORMAT, cbf_get_child(), and cbf_handle_struct::node.
Referenced by cbf_delete_row(), cbf_insert_row(), cbf_new_column(), and cbf_new_row().
{
cbf_node *node, *parent;
unsigned int columns, column, columnrows, categoryrows;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&parent, handle->node, CBF_CATEGORY))
/* Count the columns */
cbf_failnez (cbf_count_children (&columns, parent))
/* Get the size of each column */
categoryrows = 0;
for (column = 0; column < columns; column++)
{
/* Get the column */
cbf_failnez (cbf_get_child (&node, parent, column))
/* Count the number of rows */
cbf_failnez (cbf_count_children (&columnrows, node))
/* Is it the same size as the other columns? */
if (column == 0)
categoryrows = columnrows;
else
if (categoryrows != columnrows)
return CBF_FORMAT;
}
if (rows)
*rows = categoryrows;
/* Success */
return 0;
}
| int cbf_datablock_name | ( | cbf_handle | handle, |
| const char ** | datablockname | ||
| ) |
Definition at line 1822 of file cbf.c.
References CBF_ARGUMENT, CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_get_name(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Get the name */
return cbf_get_name (datablockname, node);
}
| int cbf_delete_row | ( | cbf_handle | handle, |
| const int | rownumber | ||
| ) |
Definition at line 825 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_count_columns(), cbf_count_rows(), cbf_delete_columnrow(), cbf_failnez, cbf_find_parent(), cbf_get_child(), cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
Referenced by cbf_remove_row().
{
cbf_node *node, *columnnode;
int errorcode [2];
unsigned int rows, columns, column;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* How many rows and columns does this category have? */
cbf_failnez (cbf_count_rows (handle, &rows))
cbf_failnez (cbf_count_columns (handle, &columns))
/* Delete a row from each column */
errorcode [0] = 0;
for (column = 0; column < columns; column++)
{
errorcode [1] = cbf_get_child (&columnnode, node, column);
if (!errorcode [1])
errorcode [1] = cbf_delete_columnrow (columnnode, rownumber);
errorcode [0] |= errorcode [1];
}
rows--;
if (handle->row > rownumber)
handle->row--;
if (handle->search_row > rownumber)
handle->search_row--;
return errorcode [0];
}
| int cbf_find_category | ( | cbf_handle | handle, |
| const char * | categoryname | ||
| ) |
Definition at line 1552 of file cbf.c.
References CBF_ARGUMENT, CBF_DATABLOCK, cbf_failnez, cbf_find_child(), cbf_find_parent(), cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
Referenced by GetCIFData(), and GetCIFHeader().
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Find the category */
cbf_failnez (cbf_find_child (&node, node, categoryname))
handle->node = node;
handle->row = 0;
handle->search_row = 0;
/* Success */
return 0;
}
| int cbf_find_column | ( | cbf_handle | handle, |
| const char * | columnname | ||
| ) |
Definition at line 1585 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_failnez, cbf_find_child(), cbf_find_parent(), and cbf_handle_struct::node.
Referenced by GetCIFData(), and GetCIFHeader().
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* Find the column */
cbf_failnez (cbf_find_child (&node, node, columnname))
handle->node = node;
/* Success */
return 0;
}
| int cbf_find_datablock | ( | cbf_handle | handle, |
| const char * | datablockname | ||
| ) |
Definition at line 1523 of file cbf.c.
References CBF_ARGUMENT, cbf_failnez, cbf_find_child(), cbf_find_parent(), CBF_ROOT, and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
/* Find the data block */
cbf_failnez (cbf_find_child (&node, node, datablockname))
handle->node = node;
/* Success */
return 0;
}
| int cbf_find_nextrow | ( | cbf_handle | handle, |
| const char * | value | ||
| ) |
Definition at line 1624 of file cbf.c.
References CBF_ARGUMENT, CBF_COLUMN, cbf_count_children(), cbf_failnez, cbf_find_parent(), cbf_get_columnrow(), cbf_is_binary(), CBF_NOTFOUND, cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
Referenced by cbf_find_row(), and GetCIFHeader().
{
cbf_node *node;
unsigned int row, rows;
const char *text;
if (!handle)
return CBF_ARGUMENT;
/* Find the column node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_COLUMN))
/* Count the rows */
cbf_failnez (cbf_count_children (&rows, node))
for (row = handle->search_row; row < rows; row++)
{
/* Is the value ascii? */
if (cbf_is_binary (node, row))
continue;
/* Get the value of the current row */
cbf_failnez (cbf_get_columnrow (&text, node, row))
/* Compare the values */
if (text && value)
{
if (strcmp (text + 1, value))
continue;
}
else
if (text != value)
continue;
/* Found a match */
handle->row = row;
handle->search_row = row + 1;
return 0;
}
/* Fail */
return CBF_NOTFOUND;
}
| int cbf_find_row | ( | cbf_handle | handle, |
| const char * | value | ||
| ) |
Definition at line 1614 of file cbf.c.
References cbf_failnez, cbf_find_nextrow(), and cbf_rewind_row().
Referenced by GetCIFData().
{
cbf_failnez (cbf_rewind_row (handle))
return cbf_find_nextrow (handle, value);
}
| int cbf_force_new_category | ( | cbf_handle | handle, |
| const char * | categoryname | ||
| ) |
Definition at line 567 of file cbf.c.
References CBF_ALLOC, CBF_ARGUMENT, CBF_CATEGORY, cbf_copy_string(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_free_string(), cbf_make_new_child(), and cbf_handle_struct::node.
Referenced by PutCIFHeader().
{
cbf_node *node;
int errorcode;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Copy the name */
if (categoryname)
{
categoryname = cbf_copy_string (NULL, categoryname, 0);
if (!categoryname)
return CBF_ALLOC;
}
/* Add a category */
errorcode = cbf_make_new_child (&node, node, CBF_CATEGORY, categoryname);
if (errorcode)
{
cbf_free_string (NULL, categoryname);
return errorcode;
}
/* Success */
handle->node = node;
return 0;
}
| int cbf_force_new_datablock | ( | cbf_handle | handle, |
| const char * | datablockname | ||
| ) |
Definition at line 467 of file cbf.c.
References CBF_ALLOC, CBF_ARGUMENT, cbf_copy_string(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_free_string(), cbf_make_new_child(), CBF_ROOT, and cbf_handle_struct::node.
{
cbf_node *node;
int errorcode;
if (!handle)
return CBF_ARGUMENT;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
/* Copy the name */
if (datablockname)
{
datablockname = cbf_copy_string (NULL, datablockname, 0);
if (!datablockname)
return CBF_ALLOC;
}
/* Add a datablock */
errorcode = cbf_make_new_child (&node, node, CBF_DATABLOCK, datablockname);
if (errorcode)
{
cbf_free_string (NULL, datablockname);
return errorcode;
}
/* Success */
handle->node = node;
return 0;
}
| int cbf_free_handle | ( | cbf_handle | handle | ) |
Definition at line 159 of file cbf.c.
References cbf_free(), cbf_free_node(), and cbf_handle_struct::node.
Referenced by GetCIFData(), and PutCIFData().
{
int errorcode;
if (handle)
{
errorcode = cbf_free_node (handle->node);
return errorcode | cbf_free ((void **) &handle, NULL);
}
return 0;
}
| int cbf_get_doublevalue | ( | cbf_handle | handle, |
| double * | number | ||
| ) |
Definition at line 2022 of file cbf.c.
References cbf_failnez, cbf_get_value(), and CBF_NOTFOUND.
Referenced by GetCIFHeader().
{
const char *value;
/* Get the value */
cbf_failnez (cbf_get_value (handle, &value))
/* Convert it into a double */
if (!value)
return CBF_NOTFOUND;
if (number)
*number = atof (value);
/* Success */
return 0;
}
| int cbf_get_integerarray | ( | cbf_handle | handle, |
| int * | id, | ||
| void * | value, | ||
| size_t | elsize, | ||
| int | elsign, | ||
| size_t | nelem, | ||
| size_t * | nelem_read | ||
| ) |
Definition at line 2122 of file cbf.c.
References CBF_ARGUMENT, cbf_get_binary(), cbf_handle_struct::node, and cbf_handle_struct::row.
Referenced by GetCIFData().
{
if (!handle)
return CBF_ARGUMENT;
return cbf_get_binary (handle->node, handle->row, id,
value, elsize, elsign, nelem, nelem_read);
}
| int cbf_get_integerarrayparameters | ( | cbf_handle | handle, |
| unsigned int * | compression, | ||
| int * | id, | ||
| size_t * | elsize, | ||
| int * | elsigned, | ||
| int * | elunsigned, | ||
| size_t * | nelem, | ||
| int * | minelem, | ||
| int * | maxelem | ||
| ) |
Definition at line 2087 of file cbf.c.
References CBF_ARGUMENT, CBF_ASCII, cbf_binary_parameters(), cbf_is_binary(), cbf_handle_struct::node, and cbf_handle_struct::row.
Referenced by GetCIFData().
{
/* Check the arguments */
if (!handle)
return CBF_ARGUMENT;
/* Is the value binary? */
if (!cbf_is_binary (handle->node, handle->row))
return CBF_ASCII;
/* Get the parameters */
return cbf_binary_parameters (handle->node, handle->row,
compression, id, NULL, elsize,
elsigned, elunsigned, nelem,
minelem, maxelem);
}
| int cbf_get_integervalue | ( | cbf_handle | handle, |
| int * | number | ||
| ) |
Definition at line 1993 of file cbf.c.
References cbf_failnez, cbf_get_value(), and CBF_NOTFOUND.
Referenced by GetCIFHeader().
{
const char *value;
/* Get the value */
cbf_failnez (cbf_get_value (handle, &value))
/* Convert it into an integer */
if (!value)
return CBF_NOTFOUND;
if (number)
*number = atoi (value);
/* Success */
return 0;
}
| int cbf_get_value | ( | cbf_handle | handle, |
| const char ** | value | ||
| ) |
Definition at line 1907 of file cbf.c.
References CBF_ARGUMENT, CBF_BINARY, cbf_failnez, cbf_get_columnrow(), cbf_is_binary(), cbf_handle_struct::node, and cbf_handle_struct::row.
Referenced by cbf_get_doublevalue(), cbf_get_integervalue(), and GetCIFHeader().
{
const char *text;
/* Check the arguments */
if (!handle)
return CBF_ARGUMENT;
/* Is the value binary? */
if (cbf_is_binary (handle->node, handle->row))
return CBF_BINARY;
/* Get the value */
cbf_failnez (cbf_get_columnrow (&text, handle->node, handle->row))
if (value)
if (text)
*value = text + 1;
else
*value = NULL;
/* Success */
return 0;
}
| int cbf_insert_row | ( | cbf_handle | handle, |
| const int | rownumber | ||
| ) |
Definition at line 756 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_count_columns(), cbf_count_rows(), cbf_delete_columnrow(), cbf_failnez, cbf_find_parent(), cbf_get_child(), cbf_insert_columnrow(), cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
{
cbf_node *node, *columnnode;
int errorcode [2];
unsigned int rows, columns, column;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* How many rows and columns does this category have? */
cbf_failnez (cbf_count_rows (handle, &rows))
cbf_failnez (cbf_count_columns (handle, &columns))
/* Insert a row into each column */
for (column = 0; column < columns; column++)
{
errorcode [0] = cbf_get_child (&columnnode, node, column);
if (!errorcode [0])
errorcode [0] = cbf_insert_columnrow (columnnode, rownumber, NULL);
if (errorcode [0])
{
/* Set the columns back to the original number of rows */
while (column)
{
column--;
errorcode [1] = cbf_get_child (&columnnode, node, column);
if (!errorcode [1])
errorcode [1] |= cbf_delete_columnrow (columnnode, rownumber);
errorcode [0] |= errorcode [1];
}
return errorcode [0];
}
}
/* Success */
handle->row = rownumber;
handle->search_row = rownumber;
return 0;
}
| int cbf_make_handle | ( | cbf_handle * | handle | ) |
Definition at line 137 of file cbf.c.
References cbf_alloc(), cbf_failnez, cbf_free(), cbf_make_node(), and CBF_ROOT.
Referenced by GetCIFHeader(), and PutCIFHeader().
{
int errorcode;
cbf_failnez (cbf_alloc ((void **) handle, NULL, sizeof (cbf_handle), 1))
errorcode = cbf_make_node (&(*handle)->node, CBF_ROOT, NULL, NULL);
if (errorcode)
return errorcode | cbf_free ((void **) handle, NULL);
(*handle)->row = 0;
(*handle)->search_row = 0;
return 0;
}
| int cbf_new_category | ( | cbf_handle | handle, |
| const char * | categoryname | ||
| ) |
Definition at line 517 of file cbf.c.
References CBF_ALLOC, CBF_ARGUMENT, CBF_CATEGORY, cbf_copy_string(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_free_string(), cbf_make_child(), and cbf_handle_struct::node.
{
cbf_node *node;
int errorcode;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Copy the name */
if (categoryname)
{
categoryname = cbf_copy_string (NULL, categoryname, 0);
if (!categoryname)
return CBF_ALLOC;
}
/* Add a category */
errorcode = cbf_make_child (&node, node, CBF_CATEGORY, categoryname);
if (errorcode)
{
cbf_free_string (NULL, categoryname);
return errorcode;
}
/* Success */
handle->node = node;
return 0;
}
| int cbf_new_column | ( | cbf_handle | handle, |
| const char * | columnname | ||
| ) |
Definition at line 617 of file cbf.c.
References CBF_ALLOC, CBF_ARGUMENT, CBF_CATEGORY, CBF_COLUMN, cbf_copy_string(), cbf_count_rows(), cbf_failnez, cbf_find_parent(), cbf_free_node(), cbf_free_string(), cbf_make_child(), cbf_set_children(), cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
Referenced by PutCIFHeader().
{
cbf_node *node;
int errorcode;
unsigned int rows;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* How many rows does this category have? */
cbf_failnez (cbf_count_rows (handle, &rows))
/* Copy the name */
if (columnname)
{
columnname = cbf_copy_string (NULL, columnname, 0);
if (!columnname)
return CBF_ALLOC;
}
/* Add a column */
errorcode = cbf_make_child (&node, node, CBF_COLUMN, columnname);
if (errorcode)
{
cbf_free_string (NULL, columnname);
return errorcode;
}
/* Set the number of rows */
errorcode = cbf_set_children (node, rows);
if (errorcode)
return errorcode | cbf_free_node (node);
/* Success */
handle->node = node;
handle->row = 0;
handle->search_row = 0;
return 0;
}
| int cbf_new_datablock | ( | cbf_handle | handle, |
| const char * | datablockname | ||
| ) |
Definition at line 417 of file cbf.c.
References CBF_ALLOC, CBF_ARGUMENT, cbf_copy_string(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_free_string(), cbf_make_child(), CBF_ROOT, and cbf_handle_struct::node.
Referenced by PutCIFHeader().
{
cbf_node *node;
int errorcode;
if (!handle)
return CBF_ARGUMENT;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
/* Copy the name */
if (datablockname)
{
datablockname = cbf_copy_string (NULL, datablockname, 0);
if (!datablockname)
return CBF_ALLOC;
}
/* Add a datablock */
errorcode = cbf_make_child (&node, node, CBF_DATABLOCK, datablockname);
if (errorcode)
{
cbf_free_string (NULL, datablockname);
return errorcode;
}
/* Success */
handle->node = node;
return 0;
}
| int cbf_new_row | ( | cbf_handle | handle | ) |
Definition at line 687 of file cbf.c.
References cbf_add_columnrow(), CBF_ARGUMENT, CBF_CATEGORY, cbf_count_columns(), cbf_count_rows(), cbf_failnez, cbf_find_parent(), cbf_get_child(), cbf_set_children(), cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
Referenced by PutCIFHeader().
{
cbf_node *node, *columnnode;
int errorcode [2];
unsigned int rows, columns, column;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* How many rows and columns does this category have? */
cbf_failnez (cbf_count_rows (handle, &rows))
cbf_failnez (cbf_count_columns (handle, &columns))
/* Add a row to each column */
for (column = 0; column < columns; column++)
{
errorcode [0] = cbf_get_child (&columnnode, node, column);
if (!errorcode [0])
errorcode [0] = cbf_add_columnrow (columnnode, NULL);
if (errorcode [0])
{
/* Set the columns back to the original number of rows */
while (column)
{
column--;
errorcode [1] = cbf_get_child (&columnnode, node, column);
if (!errorcode [1])
errorcode [1] |= cbf_set_children (columnnode, rows);
errorcode [0] |= errorcode [1];
}
return errorcode [0];
}
}
/* Success */
handle->row = rows;
handle->search_row = rows;
return 0;
}
| int cbf_next_category | ( | cbf_handle | handle | ) |
Definition at line 1280 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_child_index(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_get_child(), and cbf_handle_struct::node.
{
cbf_node *parent, *node;
unsigned int index;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* Find the data block node */
cbf_failnez (cbf_find_parent (&parent, node, CBF_DATABLOCK))
/* Which child is this? */
cbf_failnez (cbf_child_index (&index, node))
/* Get the next category */
cbf_failnez (cbf_get_child (&node, parent, index + 1))
handle->node = node;
/* Success */
return 0;
}
| int cbf_next_column | ( | cbf_handle | handle | ) |
Definition at line 1321 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_child_index(), CBF_COLUMN, cbf_failnez, cbf_find_parent(), cbf_get_child(), and cbf_handle_struct::node.
{
cbf_node *parent, *node;
unsigned int index;
if (!handle)
return CBF_ARGUMENT;
/* Find the column node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_COLUMN))
/* Find the category node */
cbf_failnez (cbf_find_parent (&parent, node, CBF_CATEGORY))
/* Which child is this? */
cbf_failnez (cbf_child_index (&index, node))
/* Get the next column */
cbf_failnez (cbf_get_child (&node, parent, index + 1))
handle->node = node;
/* Success */
return 0;
}
| int cbf_next_datablock | ( | cbf_handle | handle | ) |
Definition at line 1239 of file cbf.c.
References CBF_ARGUMENT, cbf_child_index(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_get_child(), CBF_ROOT, and cbf_handle_struct::node.
{
cbf_node *parent, *node;
unsigned int index;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Find the root node */
cbf_failnez (cbf_find_parent (&parent, node, CBF_ROOT))
/* Which child is this? */
cbf_failnez (cbf_child_index (&index, node))
/* Get the next data block */
cbf_failnez (cbf_get_child (&node, parent, index + 1))
handle->node = node;
/* Success */
return 0;
}
| int cbf_next_row | ( | cbf_handle | handle | ) |
Definition at line 1362 of file cbf.c.
References CBF_ARGUMENT, CBF_COLUMN, cbf_count_children(), cbf_failnez, cbf_find_parent(), CBF_NOTFOUND, cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
Referenced by PutCIFHeader().
{
cbf_node *node;
unsigned int rows;
if (!handle)
return CBF_ARGUMENT;
/* Find the column node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_COLUMN))
cbf_failnez (cbf_count_children (&rows, node))
/* Is the row valid? */
if (handle->row >= rows)
return CBF_NOTFOUND;
handle->row++;
handle->search_row = handle->row;
/* Success */
return 0;
}
| int cbf_read_file | ( | cbf_handle | handle, |
| FILE * | stream, | ||
| int | headers | ||
| ) |
Definition at line 176 of file cbf.c.
References CBF_ARGUMENT, cbf_count_children(), cbf_delete_fileconnection(), cbf_failnez, cbf_find_parent(), cbf_free_node(), cbf_get_child(), cbf_get_name(), cbf_make_file(), CBF_NOTFOUND, cbf_parse(), CBF_ROOT, cbf_set_children(), HDR_DEFAULT, MSG_DIGEST, MSG_DIGESTNOW, MSG_NODIGEST, cbf_handle_struct::node, and cbf_file::read_headers.
Referenced by GetCIFHeader().
{
cbf_file *file;
cbf_node *node;
void *parse [2];
int errorcode;
unsigned int children;
const char *name;
/* Check the arguments */
if (!handle)
return CBF_ARGUMENT;
if (((headers & (MSG_DIGEST | MSG_DIGESTNOW)) && (headers & MSG_NODIGEST)))
return CBF_ARGUMENT;
/* Delete the old datablocks */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
cbf_failnez (cbf_set_children (node, 0))
handle->node = node;
/* Create the input file */
cbf_failnez (cbf_make_file (&file, stream))
/* Defaults */
if ((headers & (MSG_DIGEST | MSG_NODIGEST | MSG_DIGESTNOW)) == 0)
headers |= (HDR_DEFAULT & (MSG_DIGEST | MSG_NODIGEST | MSG_DIGESTNOW));
if (headers & MSG_DIGESTNOW)
headers |= MSG_DIGEST;
/* Copy the flags */
file->read_headers = headers;
/* Parse the file */
parse [0] = file;
parse [1] = handle->node;
errorcode = cbf_parse (parse);
/* Delete the first datablock if it's empty */
if (!errorcode)
{
errorcode = cbf_get_child (&node, node, 0);
if (!errorcode)
{
errorcode = cbf_get_name (&name, node);
if (!errorcode && !name)
{
errorcode = cbf_count_children (&children, node);
if (!errorcode && !children)
errorcode = cbf_free_node (node);
}
}
else
if (errorcode == CBF_NOTFOUND)
errorcode = 0;
}
/* Disconnect the file */
return errorcode | cbf_delete_fileconnection (&file);
}
| int cbf_remove_category | ( | cbf_handle | handle | ) |
Definition at line 1063 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_free_node(), and cbf_handle_struct::node.
{
cbf_node *node, *parent;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* Find the data block node */
cbf_failnez (cbf_find_parent (&parent, node, CBF_DATABLOCK))
handle->node = parent;
/* Delete the column */
return cbf_free_node (node);
}
| int cbf_remove_column | ( | cbf_handle | handle | ) |
Definition at line 1092 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, CBF_COLUMN, cbf_failnez, cbf_find_parent(), cbf_free_node(), and cbf_handle_struct::node.
{
cbf_node *node, *parent;
if (!handle)
return CBF_ARGUMENT;
/* Find the column node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_COLUMN))
/* Find the category node */
cbf_failnez (cbf_find_parent (&parent, node, CBF_CATEGORY))
handle->node = parent;
/* Delete the column */
return cbf_free_node (node);
}
| int cbf_remove_datablock | ( | cbf_handle | handle | ) |
Definition at line 1034 of file cbf.c.
References CBF_ARGUMENT, CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_free_node(), CBF_ROOT, and cbf_handle_struct::node.
{
cbf_node *node, *parent;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Find the root node */
cbf_failnez (cbf_find_parent (&parent, node, CBF_ROOT))
handle->node = parent;
/* Delete the datablock */
return cbf_free_node (node);
}
| int cbf_remove_row | ( | cbf_handle | handle | ) |
Definition at line 1121 of file cbf.c.
References CBF_ARGUMENT, cbf_delete_row(), and cbf_handle_struct::row.
{
if (!handle)
return CBF_ARGUMENT;
return cbf_delete_row (handle, handle->row);
}
| int cbf_reset_category | ( | cbf_handle | handle | ) |
Definition at line 1010 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_failnez, cbf_find_parent(), cbf_set_children(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
handle->node = node;
/* Delete the children */
return cbf_set_children (node, 0);
}
| int cbf_reset_datablock | ( | cbf_handle | handle | ) |
Definition at line 986 of file cbf.c.
References CBF_ARGUMENT, CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_set_children(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
handle->node = node;
/* Delete the children */
return cbf_set_children (node, 0);
}
| int cbf_reset_datablocks | ( | cbf_handle | handle | ) |
Definition at line 931 of file cbf.c.
References CBF_ARGUMENT, cbf_count_children(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_get_child(), CBF_NOTFOUND, CBF_ROOT, cbf_set_children(), and cbf_handle_struct::node.
{
cbf_node *node, *datablocknode;
unsigned int datablocks, datablock;
int errorcode;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
errorcode = cbf_find_parent (&datablocknode, handle->node, CBF_DATABLOCK);
if (errorcode && errorcode != CBF_NOTFOUND)
return errorcode;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
if (errorcode)
handle->node = node;
else
handle->node = datablocknode;
/* Delete all grandchildren */
cbf_failnez (cbf_count_children (&datablocks, node))
for (datablock = 0; datablock < datablocks; datablock++)
{
cbf_failnez (cbf_get_child (&node, handle->node, datablock))
cbf_failnez (cbf_set_children (node, 0))
}
/* Success */
return 0;
}
| int cbf_rewind_category | ( | cbf_handle | handle | ) |
Definition at line 1162 of file cbf.c.
References CBF_ARGUMENT, CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_get_child(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Find the first child */
cbf_failnez (cbf_get_child (&node, node, 0))
handle->node = node;
/* Success */
return 0;
}
| int cbf_rewind_column | ( | cbf_handle | handle | ) |
Definition at line 1191 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_failnez, cbf_find_parent(), cbf_get_child(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* Find the first child */
cbf_failnez (cbf_get_child (&node, node, 0))
handle->node = node;
/* Success */
return 0;
}
| int cbf_rewind_datablock | ( | cbf_handle | handle | ) |
Definition at line 1133 of file cbf.c.
References CBF_ARGUMENT, cbf_failnez, cbf_find_parent(), cbf_get_child(), CBF_ROOT, and cbf_handle_struct::node.
Referenced by GetCIFData(), and GetCIFHeader().
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
/* Find the first child */
cbf_failnez (cbf_get_child (&node, node, 0))
handle->node = node;
/* Success */
return 0;
}
| int cbf_rewind_row | ( | cbf_handle | handle | ) |
Definition at line 1220 of file cbf.c.
References CBF_ARGUMENT, cbf_handle_struct::row, and cbf_handle_struct::search_row.
Referenced by cbf_find_row(), GetCIFHeader(), and PutCIFHeader().
{
if (!handle)
return CBF_ARGUMENT;
handle->row = 0;
handle->search_row = 0;
/* Success */
return 0;
}
| int cbf_row_number | ( | cbf_handle | handle, |
| unsigned int * | row | ||
| ) |
Definition at line 1888 of file cbf.c.
References CBF_ARGUMENT, and cbf_handle_struct::row.
{
if (!handle)
return CBF_ARGUMENT;
if (row)
*row = handle->row;
/* Success */
return 0;
}
| int cbf_select_category | ( | cbf_handle | handle, |
| unsigned int | category | ||
| ) |
Definition at line 1428 of file cbf.c.
References CBF_ARGUMENT, CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_get_child(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Select the category */
cbf_failnez (cbf_get_child (&node, node, category))
handle->node = node;
/* Success */
return 0;
}
| int cbf_select_column | ( | cbf_handle | handle, |
| unsigned int | column | ||
| ) |
Definition at line 1457 of file cbf.c.
References CBF_ARGUMENT, CBF_CATEGORY, cbf_failnez, cbf_find_parent(), cbf_get_child(), and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the category node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY))
/* Select the column */
cbf_failnez (cbf_get_child (&node, node, column))
handle->node = node;
/* Success */
return 0;
}
| int cbf_select_datablock | ( | cbf_handle | handle, |
| unsigned int | datablock | ||
| ) |
Definition at line 1399 of file cbf.c.
References CBF_ARGUMENT, cbf_failnez, cbf_find_parent(), cbf_get_child(), CBF_ROOT, and cbf_handle_struct::node.
{
cbf_node *node;
if (!handle)
return CBF_ARGUMENT;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
/* Select the data block */
cbf_failnez (cbf_get_child (&node, node, datablock))
handle->node = node;
/* Success */
return 0;
}
| int cbf_select_row | ( | cbf_handle | handle, |
| unsigned int | row | ||
| ) |
Definition at line 1486 of file cbf.c.
References CBF_ARGUMENT, CBF_COLUMN, cbf_count_children(), cbf_failnez, cbf_find_parent(), CBF_NOTFOUND, cbf_handle_struct::node, cbf_handle_struct::row, and cbf_handle_struct::search_row.
{
cbf_node *node;
unsigned int rows;
if (!handle)
return CBF_ARGUMENT;
/* Find the column node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_COLUMN))
cbf_failnez (cbf_count_children (&rows, node))
/* Is the row valid? */
if (row >= rows)
return CBF_NOTFOUND;
handle->row = row;
handle->search_row = row;
/* Success */
return 0;
}
| int cbf_set_datablockname | ( | cbf_handle | handle, |
| const char * | datablockname | ||
| ) |
Definition at line 881 of file cbf.c.
References CBF_ALLOC, CBF_ARGUMENT, cbf_copy_string(), CBF_DATABLOCK, cbf_failnez, cbf_find_parent(), cbf_free_string(), cbf_name_node(), and cbf_handle_struct::node.
{
cbf_node *node;
int errorcode;
if (!handle)
return CBF_ARGUMENT;
/* Find the data block node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_DATABLOCK))
/* Copy the name */
if (datablockname)
{
datablockname = cbf_copy_string (NULL, datablockname, 0);
if (!datablockname)
return CBF_ALLOC;
}
/* Change the name */
errorcode = cbf_name_node (node, datablockname);
if (errorcode)
{
cbf_free_string (NULL, datablockname);
return errorcode;
}
/* Success */
handle->node = node;
return 0;
}
| int cbf_set_doublevalue | ( | cbf_handle | handle, |
| const char * | format, | ||
| double | number | ||
| ) |
Definition at line 2069 of file cbf.c.
References cbf_set_value().
Referenced by PutCIFHeader().
{
char value [64];
/* Write the value */
sprintf (value, format, number);
/* Save it */
return cbf_set_value (handle, value);
}
| int cbf_set_integerarray | ( | cbf_handle | handle, |
| unsigned int | compression, | ||
| int | id, | ||
| void * | value, | ||
| size_t | elsize, | ||
| int | elsign, | ||
| size_t | nelem | ||
| ) |
Definition at line 2141 of file cbf.c.
References CBF_ARGUMENT, cbf_set_binary(), cbf_handle_struct::node, and cbf_handle_struct::row.
Referenced by PutCIFData().
{
if (!handle)
return CBF_ARGUMENT;
return cbf_set_binary (handle->node, handle->row,
compression, id, value, elsize, elsign, nelem);
}
| int cbf_set_integervalue | ( | cbf_handle | handle, |
| int | number | ||
| ) |
Definition at line 2051 of file cbf.c.
References cbf_set_value().
Referenced by PutCIFHeader().
{
char value [64];
/* Write the value */
sprintf (value, "%d", number);
/* Save it */
return cbf_set_value (handle, value);
}
| int cbf_set_value | ( | cbf_handle | handle, |
| const char * | value | ||
| ) |
Definition at line 1949 of file cbf.c.
References CBF_ALLOC, CBF_ARGUMENT, cbf_copy_string(), cbf_free_string(), cbf_set_columnrow(), cbf_handle_struct::node, and cbf_handle_struct::row.
Referenced by cbf_set_doublevalue(), cbf_set_integervalue(), and PutCIFHeader().
{
int errorcode;
/* Check the arguments */
if (!handle)
return CBF_ARGUMENT;
/* Copy the string */
if (value)
{
value = cbf_copy_string (NULL, value, '\200');
if (!value)
return CBF_ALLOC;
}
/* Set the new value */
errorcode = cbf_set_columnrow (handle->node, handle->row, value, 1);
if (errorcode)
{
cbf_free_string (NULL, value);
return errorcode;
}
/* Success */
return 0;
}
| int cbf_write_file | ( | cbf_handle | handle, |
| FILE * | stream, | ||
| int | isbuffer, | ||
| int | ciforcbf, | ||
| int | headers, | ||
| int | encoding | ||
| ) |
Definition at line 275 of file cbf.c.
References CBF_ARGUMENT, cbf_delete_fileconnection(), cbf_failnez, cbf_find_parent(), cbf_make_file(), CBF_ROOT, cbf_write_node(), CIF, ENC_BACKWARD, ENC_BASE10, ENC_BASE16, ENC_BASE64, ENC_BASE8, ENC_CRTERM, ENC_DEFAULT, ENC_FORWARD, ENC_LFTERM, ENC_NONE, ENC_QP, HDR_DEFAULT, MIME_HEADERS, MSG_DIGEST, MSG_DIGESTNOW, MSG_NODIGEST, cbf_handle_struct::node, PLAIN_HEADERS, cbf_file::stream, cbf_file::write_encoding, and cbf_file::write_headers.
Referenced by PutCIFData().
{
cbf_file *file;
cbf_node *node;
int errorcode;
int little;
/* CIF or CBF? */
if (ciforcbf == CIF)
encoding = encoding & ~ENC_NONE;
else
encoding = (encoding & ~(ENC_BASE8 |
ENC_BASE10 |
ENC_BASE16 |
ENC_BASE64 |
ENC_QP |
ENC_FORWARD |
ENC_BACKWARD)) | ENC_NONE | ENC_CRTERM
| ENC_LFTERM;
/* Check the arguments */
if (!handle)
return CBF_ARGUMENT;
if (((headers & MIME_HEADERS) && (headers & PLAIN_HEADERS)) ||
((headers & MSG_DIGEST) && (headers & MSG_NODIGEST)) ||
((headers & MSG_DIGEST) && (headers & PLAIN_HEADERS)) ||
((headers & MSG_DIGESTNOW) && (headers & MSG_NODIGEST)) ||
((headers & MSG_DIGESTNOW) && (headers & PLAIN_HEADERS)) ||
((encoding & ENC_FORWARD) && (encoding & ENC_BACKWARD)))
return CBF_ARGUMENT;
if (((encoding & ENC_NONE) > 0) +
((encoding & ENC_BASE8) > 0) +
((encoding & ENC_BASE10) > 0) +
((encoding & ENC_BASE16) > 0) +
((encoding & ENC_BASE64) > 0) +
((encoding & ENC_QP) > 0) > 1)
return CBF_ARGUMENT;
/* Find the root node */
cbf_failnez (cbf_find_parent (&node, handle->node, CBF_ROOT))
/* Create the file */
cbf_failnez (cbf_make_file (&file, stream))
/* Defaults */
if (headers & (MSG_DIGEST | MSG_DIGESTNOW))
headers |= MIME_HEADERS;
else
if ((headers & (MIME_HEADERS | PLAIN_HEADERS)) == 0)
headers |= (HDR_DEFAULT & (MIME_HEADERS | PLAIN_HEADERS));
if (headers & PLAIN_HEADERS)
headers |= MSG_NODIGEST;
else
if ((headers & (MSG_DIGEST | MSG_NODIGEST | MSG_DIGESTNOW)) == 0)
headers |= (HDR_DEFAULT & (MSG_DIGEST | MSG_NODIGEST | MSG_DIGESTNOW));
if (headers & MSG_DIGESTNOW)
headers |= MSG_DIGEST;
if ((encoding & (ENC_NONE |
ENC_BASE8 |
ENC_BASE10 |
ENC_BASE16 |
ENC_BASE64 |
ENC_QP)) == 0)
encoding |= (ENC_DEFAULT & (ENC_NONE |
ENC_BASE8 |
ENC_BASE10 |
ENC_BASE16 |
ENC_BASE64 |
ENC_QP));
if ((encoding & (ENC_CRTERM | ENC_LFTERM)) == 0)
encoding |= (ENC_DEFAULT & (ENC_CRTERM | ENC_LFTERM));
if ((encoding & (ENC_FORWARD | ENC_BACKWARD)) == 0)
encoding |= (ENC_DEFAULT & (ENC_FORWARD | ENC_BACKWARD));
/* Copy the flags */
file->write_headers = headers;
file->write_encoding = encoding;
/* Write the file */
errorcode = cbf_write_node (node, file, isbuffer);
/* Free the file structure but don't close the file? */
if (!isbuffer)
file->stream = NULL;
/* Disconnect the file */
return errorcode | cbf_delete_fileconnection (&file);
}
1.7.3