Ignore:
Timestamp:
12/27/07 12:14:01 (6 years ago)
Author:
xi
Message:

Another round of API update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libyaml/trunk/include/yaml.h

    r261 r264  
    4646 */ 
    4747 
    48 /** 
    49  * Get the library version as a string. 
    50  * 
    51  * @returns The function returns the pointer to a static string of the form 
    52  * @c "X.Y.Z", where @c X is the major version number, @c Y is a minor version 
    53  * number, and @c Z is the patch version number. 
    54  */ 
    55  
    56 YAML_DECLARE(const char *) 
    57 yaml_get_version_string(void); 
    58  
    59 /** 
    60  * Get the library version numbers. 
     48/** The major version number. */ 
     49#define YAML_VERSION_MAJOR  0 
     50 
     51/** The minor version number. */ 
     52#define YAML_VERSION_MINOR  2 
     53 
     54/** The patch version number. */ 
     55#define YAML_VERSION_PATCH  0 
     56 
     57/** The version string generator macro. */ 
     58#define YAML_VERSION_STRING_GENERATOR(major,minor,patch)                        \ 
     59    (#major "." #minor "." #patch) 
     60 
     61/** The version string. */ 
     62#define YAML_VERSION_STRING                                                     \ 
     63    YAML_VERSION_STRING_GENERATOR(YAML_VERSION_MAJOR,YAML_VERSION_MINOR,YAML_VERSION_PATCH) 
     64 
     65/** 
     66 * Get the library version numbers at runtime. 
    6167 * 
    6268 * @param[out]      major   Major version number. 
     
    6773YAML_DECLARE(void) 
    6874yaml_get_version(int *major, int *minor, int *patch); 
     75 
     76/** 
     77 * Get the library version as a string at runtime. 
     78 * 
     79 * @returns The function returns the pointer to a static string of the form 
     80 * @c "X.Y.Z", where @c X is the major version number, @c Y is the minor version 
     81 * number, and @c Z is the patch version number. 
     82 */ 
     83 
     84YAML_DECLARE(const char *) 
     85yaml_get_version_string(void); 
    6986 
    7087/** @} */ 
     
    87104    /** Cannot decode the input stream. */ 
    88105    YAML_DECODER_ERROR, 
    89  
    90106    /** Cannot scan a YAML token. */ 
    91107    YAML_SCANNER_ERROR, 
     
    97113    /** Cannot write into the output stream. */ 
    98114    YAML_WRITER_ERROR, 
    99  
    100115    /** Cannot emit a YAML event. */ 
    101116    YAML_EMITTER_ERROR, 
    102117    /** Cannot serialize a YAML document. */ 
    103     YAML_SERIALIZER_ERROR 
     118    YAML_SERIALIZER_ERROR, 
     119 
     120    /** Cannot resolve an implicit tag. */ 
     121    YAML_RESOLVER_ERROR 
    104122} yaml_error_type_t; 
    105123 
     
    143161         */ 
    144162        struct { 
    145             /** The problem description. */ 
    146             const char *problem; 
    147             /** The problem mark. */ 
    148             yaml_mark_t problem_mark; 
    149163            /** The context in which the problem occured 
    150164             * (@c NULL if not applicable). 
     
    153167            /** The context mark (if @c problem_mark is not @c NULL). **/ 
    154168            yaml_mark_t context_mark; 
     169            /** The problem description. */ 
     170            const char *problem; 
     171            /** The problem mark. */ 
     172            yaml_mark_t problem_mark; 
    155173        } loading; 
    156174 
     
    171189        } dumping; 
    172190 
     191        /** A problem while resolving an implicit tag (@c YAML_RESOLVER_ERROR). */ 
     192        struct { 
     193            /** The problem description. */ 
     194            const char *problem; 
     195        } resolving; 
     196 
    173197    } data; 
    174198 
    175199} yaml_error_t; 
    176200 
     201/** 
     202 * Create an error message. 
     203 * 
     204 * @param[in]   error   An error object. 
     205 * @param[out]  buffer         model   A token to copy. 
     206 * 
     207 * @returns @c 1 if the function succeeded, @c 0 on error.  The function may 
     208 * fail if the buffer is not large enough to contain the whole message. 
     209 */ 
     210 
     211YAML_DECLARE(int) 
     212yaml_error_message(yaml_error_t *error, char *buffer, size_t capacity); 
    177213 
    178214/** @} */ 
     
    434470 
    435471YAML_DECLARE(int) 
    436 yaml_token_duplicate(yaml_token_t *token, yaml_token_t *model); 
     472yaml_token_duplicate(yaml_token_t *token, const yaml_token_t *model); 
    437473 
    438474/** 
     
    608644 
    609645YAML_DECLARE(int) 
    610 yaml_event_duplicate(yaml_event_t *event, yaml_event_t *model); 
     646yaml_event_duplicate(yaml_event_t *event, const yaml_event_t *model); 
    611647 
    612648/** 
     
    792828 
    793829/** The tag @c !!null with the only possible value: @c null. */ 
    794 #define YAML_NULL_TAG       "tag:yaml.org,2002:null" 
     830#define YAML_NULL_TAG       ((const yaml_char_t *) "tag:yaml.org,2002:null") 
    795831/** The tag @c !!bool with the values: @c true and @c falce. */ 
    796 #define YAML_BOOL_TAG       "tag:yaml.org,2002:bool" 
     832#define YAML_BOOL_TAG       ((const yaml_char_t *) "tag:yaml.org,2002:bool") 
    797833/** The tag @c !!str for string values. */ 
    798 #define YAML_STR_TAG        "tag:yaml.org,2002:str" 
     834#define YAML_STR_TAG        ((const yaml_char_t *) "tag:yaml.org,2002:str") 
    799835/** The tag @c !!int for integer values. */ 
    800 #define YAML_INT_TAG        "tag:yaml.org,2002:int" 
     836#define YAML_INT_TAG        ((const yaml_char_t *) "tag:yaml.org,2002:int") 
    801837/** The tag @c !!float for float values. */ 
    802 #define YAML_FLOAT_TAG      "tag:yaml.org,2002:float" 
     838#define YAML_FLOAT_TAG      ((const yaml_char_t *) "tag:yaml.org,2002:float") 
    803839 
    804840/** The tag @c !!seq is used to denote sequences. */ 
    805 #define YAML_SEQ_TAG        "tag:yaml.org,2002:seq" 
     841#define YAML_SEQ_TAG        ((const yaml_char_t *) "tag:yaml.org,2002:seq") 
    806842/** The tag @c !!map is used to denote mapping. */ 
    807 #define YAML_MAP_TAG        "tag:yaml.org,2002:map" 
     843#define YAML_MAP_TAG        ((const yaml_char_t *) "tag:yaml.org,2002:map") 
    808844 
    809845/** The default scalar tag is @c !!str. */ 
     
    12281264 */ 
    12291265 
    1230 typedef int yaml_writer_t(void *data, unsigned char *buffer, size_t length); 
     1266typedef int yaml_writer_t(void *data, const unsigned char *buffer, 
     1267        size_t length); 
    12311268 
    12321269/** 
     
    13991436 
    14001437YAML_DECLARE(int) 
    1401 yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token); 
     1438yaml_parser_parse_token(yaml_parser_t *parser, yaml_token_t *token); 
    14021439 
    14031440/** 
     
    14231460 
    14241461YAML_DECLARE(int) 
    1425 yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event); 
     1462yaml_parser_parse_event(yaml_parser_t *parser, yaml_event_t *event); 
    14261463 
    14271464#if 0 
     
    14501487 
    14511488YAML_DECLARE(int) 
    1452 yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document); 
     1489yaml_parser_parse_document(yaml_parser_t *parser, yaml_document_t *document); 
    14531490 
    14541491#endif 
     
    16481685 
    16491686YAML_DECLARE(int) 
    1650 yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event); 
     1687yaml_emitter_emit_event(yaml_emitter_t *emitter, yaml_event_t *event); 
    16511688 
    16521689#if 0 
     
    16951732 
    16961733YAML_DECLARE(int) 
    1697 yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document); 
     1734yaml_emitter_emit_document(yaml_emitter_t *emitter, yaml_document_t *document); 
    16981735 
    16991736#endif 
Note: See TracChangeset for help on using the changeset viewer.