summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/lcode.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-09-06 16:54:04 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-09-06 16:54:04 +0000
commit9f4f5dbc2683a17159aac153aaccce023fc5dab3 (patch)
treebc335c25ee2579450c3d2cee7463b8fcbe631e26 /apps/plugins/lua/lcode.c
parent66499ecad05866e709e3b48131801356cdf888c1 (diff)
downloadrockbox-9f4f5dbc2683a17159aac153aaccce023fc5dab3.zip
rockbox-9f4f5dbc2683a17159aac153aaccce023fc5dab3.tar.gz
rockbox-9f4f5dbc2683a17159aac153aaccce023fc5dab3.tar.bz2
rockbox-9f4f5dbc2683a17159aac153aaccce023fc5dab3.tar.xz
Make the e200 compile the vled for the sim... other targets are probably doing the same thing so find out which.. commit will be immediatly followed to fixd red
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22642 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions
href='#n140'>140 141 142 143 144 145 146 147 148 149 150 151 152 153
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2010 Robert Bieber
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#ifndef GENERIC_PARSER_H
#define GENERIC_PARSER_H

#ifdef __cplusplus
extern "C"
{
#endif
#include <stdlib.h>
#include <stdbool.h>

/********************************************************************
 ****** Data Structures *********************************************
 *******************************************************************/

/* Possible types of element in a WPS file */
enum skin_element_type
{
    UNKNOWN = -1,
    VIEWPORT,
    LINE_ALTERNATOR,
    LINE,
    CONDITIONAL,
    TAG,
    TEXT,
    COMMENT,
};

enum skin_errorcode
{
    MEMORY_LIMIT_EXCEEDED,
    NEWLINE_EXPECTED,
    ILLEGAL_TAG,
    ARGLIST_EXPECTED,
    TOO_MANY_ARGS,
    DEFAULT_NOT_ALLOWED,
    UNEXPECTED_NEWLINE,
    INSUFFICIENT_ARGS,
    INT_EXPECTED,
    DECIMAL_EXPECTED,
    SEPARATOR_EXPECTED,
    CLOSE_EXPECTED,
    MULTILINE_EXPECTED
};

/* Holds a tag parameter, either numeric or text */
struct skin_tag_parameter
{
    enum
    {
        INTEGER,
        DECIMAL, /* stored in data.number as (whole*10)+part */
        STRING,
        CODE,
        DEFAULT
    } type;

    union
    {
        int number;
        char* text;
        struct skin_element* code;
    } data;

    char type_code;
            
};

/* Defines an element of a SKIN file */
struct skin_element
{
    /* Defines what type of element it is */
    enum skin_element_type type;

    /* The line on which it's defined in the source file */
    int line;

    /* Placeholder for element data
     * TEXT and COMMENT uses it for the text string
     * TAG, VIEWPORT, LINE, etc may use it for post parse extra storage
     */
    void* data;

    /* The tag or conditional name */
    const struct tag_info *tag;

    /* Pointer to and size of an array of parameters */
    int params_count;
    struct skin_tag_parameter* params;

    /* Pointer to and size of an array of children */
    int children_count;
    struct skin_element** children;

    /* Link to the next element */
    struct skin_element* next;
};

enum skin_cb_returnvalue
{
    CALLBACK_ERROR = -666,
    FEATURE_NOT_AVAILABLE,
    CALLBACK_OK = 0,
    /* > 0 reserved for future use */
};
typedef int (*skin_callback)(struct skin_element* element, void* data);

/***********************************************************************
 ***** Functions *******************************************************
 **********************************************************************/