cr-term

## cr-term cr-term |

## Synopsis

    struct              CRTerm;
    CRTerm *            cr_term_parse_expression_from_buf   (const guchar *a_buf,
                                                             enum CREncoding a_encoding);
    CRTerm *            cr_term_new                         (void);
    enum CRStatus       cr_term_set_number                  (CRTerm *a_this,
                                                             CRNum *a_num);
    enum CRStatus       cr_term_set_function                (CRTerm *a_this,
                                                             CRString *a_func_name,
                                                             CRTerm *a_func_param);
    enum CRStatus       cr_term_set_string                  (CRTerm *a_this,
                                                             CRString *a_str);
    enum CRStatus       cr_term_set_ident                   (CRTerm *a_this,
                                                             CRString *a_str);
    enum CRStatus       cr_term_set_uri                     (CRTerm *a_this,
                                                             CRString *a_str);
    enum CRStatus       cr_term_set_rgb                     (CRTerm *a_this,
                                                             CRRgb *a_rgb);
    enum CRStatus       cr_term_set_hash                    (CRTerm *a_this,
                                                             CRString *a_str);
    CRTerm *            cr_term_append_term                 (CRTerm *a_this,
                                                             CRTerm *a_new_term);
    CRTerm *            cr_term_prepend_term                (CRTerm *a_this,
                                                             CRTerm *a_new_term);
    guchar *            cr_term_to_string                   (CRTerm const *a_this);
    guchar *            cr_term_one_to_string               (CRTerm const *a_this);
    void                cr_term_dump                        (CRTerm const *a_this,
                                                             FILE *a_fp);
    int                 cr_term_nr_values                   (CRTerm const *a_this);
    CRTerm *            cr_term_get_from_list               (CRTerm *a_this,
                                                             int itemnr);
    void                cr_term_ref                         (CRTerm *a_this);
    gboolean            cr_term_unref                       (CRTerm *a_this);
    void                cr_term_destroy                     (CRTerm *a_term);

## Description

## Details

### struct CRTerm

    struct CRTerm {
            /**
             *The type of the term.
             */
            enum CRTermType type ;

            /**
             *The unary operator associated to
             *the current term.
             */
            enum UnaryOperator unary_op ;

            /**
             *The operator associated to the current term.
             */
            enum Operator the_operator ;

            /**
             *The content of the term.
             *Depending of the type of the term,
             *this holds either a number, a percentage ...
             */
            union
            {
                    CRNum *num ;
                    CRString * str ;
                    CRRgb * rgb ;
            } content ;

            /**
             *If the term is of type UNICODERANGE,
             *this field holds the upper bound of the range.
             *if the term is of type FUNCTION, this holds
             *an instance of CRTerm that represents
             * the expression which is the argument of the function.
             */
            union
            {
                    CRTerm *func_param ;
            } ext_content ;

            /**
             *A spare pointer, just in case.
             *Can be used by the application.
             */
            gpointer app_data ;

            glong ref_count ;

            /**
             *A pointer to the next term,
             *just in case this term is part of
             *an expression.
             */
            CRTerm *next ;

            /**
             *A pointer to the previous
             *term.
             */
            CRTerm *prev ;
            CRParsingLocation location ;
    };

### cr_term_parse_expression_from_buf ()

    CRTerm *            cr_term_parse_expression_from_buf   (const guchar *a_buf,
                                                             enum CREncoding a_encoding);

### cr_term_new ()

    CRTerm *            cr_term_new                         (void);

### cr_term_set_number ()

    enum CRStatus       cr_term_set_number                  (CRTerm *a_this,
                                                             CRNum *a_num);

### cr_term_set_function ()

    enum CRStatus       cr_term_set_function                (CRTerm *a_this,
                                                             CRString *a_func_name,
                                                             CRTerm *a_func_param);

### cr_term_set_string ()

    enum CRStatus       cr_term_set_string                  (CRTerm *a_this,
                                                             CRString *a_str);

### cr_term_set_ident ()

    enum CRStatus       cr_term_set_ident                   (CRTerm *a_this,
                                                             CRString *a_str);

### cr_term_set_uri ()

    enum CRStatus       cr_term_set_uri                     (CRTerm *a_this,
                                                             CRString *a_str);

### cr_term_set_rgb ()

    enum CRStatus       cr_term_set_rgb                     (CRTerm *a_this,
                                                             CRRgb *a_rgb);

### cr_term_set_hash ()

    enum CRStatus       cr_term_set_hash                    (CRTerm *a_this,
                                                             CRString *a_str);

### cr_term_append_term ()

    CRTerm *            cr_term_append_term                 (CRTerm *a_this,
                                                             CRTerm *a_new_term);

### cr_term_prepend_term ()

    CRTerm *            cr_term_prepend_term                (CRTerm *a_this,
                                                             CRTerm *a_new_term);

### cr_term_to_string ()

    guchar *            cr_term_to_string                   (CRTerm const *a_this);

### cr_term_one_to_string ()

    guchar *            cr_term_one_to_string               (CRTerm const *a_this);

### cr_term_dump ()

    void                cr_term_dump                        (CRTerm const *a_this,
                                                             FILE *a_fp);

### cr_term_nr_values ()

    int                 cr_term_nr_values                   (CRTerm const *a_this);

### cr_term_get_from_list ()

    CRTerm *            cr_term_get_from_list               (CRTerm *a_this,
                                                             int itemnr);

### cr_term_ref ()

    void                cr_term_ref                         (CRTerm *a_this);

### cr_term_unref ()

    gboolean            cr_term_unref                       (CRTerm *a_this);

### cr_term_destroy ()

    void                cr_term_destroy                     (CRTerm *a_term);