Changeset 7c3fb9b in mainline for uspace/lib/bithenge/src/script.c


Ignore:
Timestamp:
2018-05-17T08:29:01Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ff23ff
Parents:
fac0ac7
git-author:
Jiri Svoboda <jiri@…> (2018-05-16 17:28:17)
git-committer:
Jiri Svoboda <jiri@…> (2018-05-17 08:29:01)
Message:

Fix block comment formatting (ccheck).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/bithenge/src/script.c

    rfac0ac7 r7c3fb9b  
    5555/** @cond internal
    5656 * Single-character symbols are represented by the character itself. Every
    57  * other token uses one of these values: */
     57 * other token uses one of these values:
     58 */
    5859typedef enum {
    5960        TOKEN_ERROR = -128,
     
    9899typedef struct {
    99100        /** Rather than constantly checking return values, the parser uses this
    100          * to indicate whether an error has occurred. */
     101         * to indicate whether an error has occurred.
     102         */
    101103        errno_t error;
    102104
     
    109111        FILE *file;
    110112        /** The buffer that holds script code. There is always a '\0' after the
    111          * current position to prevent reading too far. */
     113         * current position to prevent reading too far.
     114         */
    112115        char buffer[BUFFER_SIZE];
    113116        /** The start position within the buffer of the next unread token. */
     
    124127        union {
    125128                /** The value of a TOKEN_IDENTIFIER token. Unless changed to
    126                  * NULL, it will be freed when the next token is read. */
     129                 * NULL, it will be freed when the next token is read.
     130                 */
    127131                char *token_string;
    128132                /** The value of a TOKEN_INTEGER token. */
     
    139143
    140144/** Free the previous token's data. This must be called before changing
    141  * state->token. */
     145 * state->token.
     146 */
    142147static void done_with_token(state_t *state)
    143148{
     
    346351/** Allocate memory and handle failure by setting the error in the state. The
    347352 * caller must check the state for errors before using the return value of this
    348  * function. */
     353 * function.
     354 */
    349355static void *state_malloc(state_t *state, size_t size)
    350356{
     
    358364
    359365/** Reallocate memory and handle failure by setting the error in the state. If
    360  * an error occurs, the existing pointer will be returned. */
     366 * an error occurs, the existing pointer will be returned.
     367 */
    361368static void *state_realloc(state_t *state, void *ptr, size_t size)
    362369{
     
    372379
    373380/** Expect and consume a certain token. If the next token is of the wrong type,
    374  * an error is caused. */
     381 * an error is caused.
     382 */
    375383static void expect(state_t *state, token_type_t type)
    376384{
     
    383391
    384392/** Expect and consume an identifier token. If the next token is not an
    385  * identifier, an error is caused and this function returns null. */
     393 * identifier, an error is caused and this function returns null.
     394 */
    386395static char *expect_identifier(state_t *state)
    387396{
     
    397406
    398407/** Find a transform by name. A reference will be added to the transform.
    399  * @return The found transform, or NULL if none was found. */
     408 * @return The found transform, or NULL if none was found.
     409 */
    400410static bithenge_transform_t *get_named_transform(state_t *state,
    401411    const char *name)
     
    419429
    420430/** Add a named transform. This function takes ownership of the name and a
    421  * reference to the transform. If an error has occurred, either may be null. */
     431 * reference to the transform. If an error has occurred, either may be null.
     432 */
    422433static void add_named_transform(state_t *state, bithenge_transform_t *xform, char *name)
    423434{
     
    809820/** Create a transform that just produces an empty node.
    810821 * @param state The parser state.
    811  * @return The new transform, or NULL on error. */
     822 * @return The new transform, or NULL on error.
     823 */
    812824static bithenge_transform_t *make_empty_transform(state_t *state)
    813825{
     
    11391151
    11401152/** Parse a transform without composition.
    1141  * @return The parsed transform, or NULL if an error occurred. */
     1153 * @return The parsed transform, or NULL if an error occurred.
     1154 */
    11421155static bithenge_transform_t *parse_transform_no_compose(state_t *state)
    11431156{
     
    11881201
    11891202/** Parse a transform.
    1190  * @return The parsed transform, or NULL if an error occurred. */
     1203 * @return The parsed transform, or NULL if an error occurred.
     1204 */
    11911205static bithenge_transform_t *parse_transform(state_t *state)
    11921206{
     
    13201334 * @param[out] out Stores the "main" transform.
    13211335 * @return EOK on success, EINVAL on syntax error, or an error code from
    1322  * errno.h. */
     1336 * errno.h.
     1337 */
    13231338errno_t bithenge_parse_script(const char *filename, bithenge_transform_t **out)
    13241339{
Note: See TracChangeset for help on using the changeset viewer.