Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/openal-0.0.8/src/al_rcvar.h @ 17

Last change on this file since 17 was 17, checked in by landauf, 16 years ago

added openal

File size: 3.9 KB
Line 
1/* -*- mode: C; tab-width:8; c-basic-offset:8 -*-
2 * vi:set ts=8:
3 *
4 * al_rcvar.h
5 *
6 * Stuff related to the Rcvar config interface
7 *
8 */
9#ifndef AL_RCVAR_H_
10#define AL_RCVAR_H_
11
12#include <AL/al.h>
13#include <stdlib.h>
14
15/*
16 * opaque pointer to a lisp-like var.  Calling code shouldn't mess with it
17 * directly.
18 */
19typedef void *Rcvar;
20
21/*
22 * Each AL_rctree has a type, which reflects how its data should be
23 * interpreted.  There are those types.
24 */
25typedef enum {
26        ALRC_INVALID,
27        ALRC_PRIMITIVE,
28        ALRC_CONSCELL,
29        ALRC_SYMBOL,
30        ALRC_INTEGER,
31        ALRC_FLOAT,
32        ALRC_STRING,
33        ALRC_BOOL,
34        ALRC_POINTER
35} ALRcEnum;
36
37/*
38 * Returns the binding for the symbol named by name, if it exists, or NULL if
39 * it doesn't.
40 */
41Rcvar rc_lookup( const char *name );
42
43/*
44 * Creates a binding between symname and the evaluation of val in the
45 * global scope, returning val.
46 */
47Rcvar rc_define( const char *symname, Rcvar val );
48
49/*
50 * Creates a binding between car(ls) (symbol) the evaluation of cadr(ls) in the
51 * global scope, returning cadr(ls).
52 */
53Rcvar rc_define_list( Rcvar ls );
54
55/*
56 * Evaluates str, returning result.
57 */
58Rcvar rc_eval( const char *str );
59
60/*
61 * Returns the type of sym.
62 */
63ALRcEnum rc_type( Rcvar sym );
64
65/*
66 * Returns the car portion of sym.  If sym is not a cons cell, returns NULL.
67 */
68Rcvar rc_car( Rcvar sym );
69
70/*
71 * Returns the cdr portion of sym.  If sym is not a cons cell, returns NULL.
72 */
73Rcvar rc_cdr( Rcvar sym );
74
75/*
76 * If sym has type ALRC_SYMBOL, this call populates retstr ( up to len bytes )
77 * with the name of the symbol.
78 */
79Rcvar rc_symtostr0( Rcvar sym, char *retstr, size_t len );
80
81/*
82 * If sym has type ALRC_STRING, this call populates retstr ( up to len bytes )
83 * with the value of the string.
84 */
85Rcvar rc_tostr0( Rcvar sym, char *retstr, size_t len );
86
87/*
88 * Returns AL_TRUE if sym is a boolean type and equal to #t, AL_FALSE
89 * otherwise.
90 */
91ALboolean rc_tobool( Rcvar sym );
92
93/*
94 * If sym is a numerical type, returns the integer value of sym.  Otherwise,
95 * returns 0.
96 */
97ALint rc_toint( Rcvar sym );
98
99/*
100 * If sym is a numerical type, returns the float value of sym.  Otherwise,
101 * returns 0.0f.
102 */
103ALfloat rc_tofloat( Rcvar sym );
104
105/*
106 * If d1 and d2 both have type AL_STRING, returns AL_TRUE if there are
107 * equivilant.  Returns AL_FALSE otherwise.
108 */
109ALboolean rc_strequal( Rcvar d1, Rcvar d2 );
110
111/*
112 * Evaluates needle and sees if it is a member in haystack, returning a list
113 * with the first conscell to have a matching car as its head.
114 */
115Rcvar rc_lookup_list( Rcvar haystack, const char *needle );
116
117/*
118 * Returns a list with the first conscell to have a matching car with sym as
119 * its head, NULL otherwise.
120 */
121Rcvar rc_member( Rcvar ls, Rcvar sym );
122
123/*
124 * Returns AL_TRUE if r1 and r2 and equivilant, AL_FALSE otherwise.
125 */
126ALboolean rc_equal( Rcvar r1, Rcvar r2 );
127
128struct _AL_rctree;
129struct _AL_rctree *(*rc_toprim( Rcvar sym ))( struct _AL_rctree *,
130                                              struct _AL_rctree * );
131
132/*
133 * Returns a const char *representation of type.
134 */
135const char *rc_typestr( ALRcEnum type );
136
137/*
138 * For each member in ls, apply op to the member.
139 */
140void rc_foreach( Rcvar ls, Rcvar (*op)( Rcvar operand ));
141
142/*
143 * Prints a stdout representation of sym to stdout.
144 */
145void rc_print( Rcvar sym );
146
147/*
148 * Quotes sym, returning that.
149 */
150Rcvar alrc_quote( Rcvar sym );
151
152/*
153 * car and cdr convienence macros.
154 */
155#define rc_cddr(s)                            rc_cdr(rc_cdr(s))
156#define rc_cdddr(s)                           rc_cdr(rc_cddr(s))
157#define rc_cddddr(s)                          rc_cdr(rc_cdddr(s))
158#define rc_cddddddr(s)                        rc_cdr(rc_cdddddr(s))
159
160#define rc_cadr(s)                            rc_car(rc_cdr(s))
161#define rc_caddr(s)                           rc_car(rc_cddr(s))
162#define rc_cadddr(s)                          rc_car(rc_cdddr(s))
163#define rc_caddddr(s)                         rc_car(rc_cddddr(s))
164#define rc_cadddddr(s)                        rc_car(rc_cdddddr(s))
165
166#endif /* AL_RCVAR_H_ */
Note: See TracBrowser for help on using the repository browser.