mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
Initial code for lisp interpreter
This commit is contained in:
parent
8b1ac5a638
commit
640ee8faa7
15 changed files with 1926 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS=control mixer ordinary_mixer pcm ordinary_pcm rawmidi timer hwdep seq instr compat conf
|
||||
SUBDIRS=control mixer ordinary_mixer pcm ordinary_pcm rawmidi timer hwdep seq instr compat conf alisp
|
||||
EXTRA_DIST=Versions
|
||||
COMPATNUM=@LIBTOOL_VERSION_INFO@
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ libasound_la_LIBADD = control/libcontrol.la \
|
|||
pcm/libpcm.la ordinary_pcm/libordinarypcm.la \
|
||||
rawmidi/librawmidi.la timer/libtimer.la \
|
||||
hwdep/libhwdep.la seq/libseq.la instr/libinstr.la \
|
||||
compat/libcompat.la -lm -ldl -lpthread
|
||||
compat/libcompat.la alisp/libalisp.la -lm -ldl -lpthread
|
||||
|
||||
libasound_la_LDFLAGS = -version-info $(COMPATNUM)
|
||||
LDFLAGS = $(VSYMS)
|
||||
|
|
@ -53,4 +53,7 @@ instr/libinstr.la:
|
|||
compat/libcompat.la:
|
||||
$(MAKE) -C compat libcompat.la
|
||||
|
||||
alisp/libalisp.la:
|
||||
$(MAKE) -C alisp libalisp.la
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/include
|
||||
|
|
|
|||
|
|
@ -108,3 +108,9 @@ ALSA_0.9.3 {
|
|||
snd_ctl_elem_info_get_dimensions;
|
||||
snd_ctl_elem_info_get_dimension;
|
||||
} ALSA_0.9.0;
|
||||
|
||||
ALSA_0.9.5 {
|
||||
global:
|
||||
|
||||
alsa_lisp;
|
||||
} ALSA_0.9.3;
|
||||
|
|
|
|||
9
src/alisp/Makefile.am
Normal file
9
src/alisp/Makefile.am
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
EXTRA_LTLIBRARIES = libalisp.la
|
||||
|
||||
libalisp_la_SOURCES = alisp.c
|
||||
|
||||
noinst_HEADERS = alisp_local.h
|
||||
|
||||
all: libalisp.la
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/include
|
||||
1628
src/alisp/alisp.c
Normal file
1628
src/alisp/alisp.c
Normal file
File diff suppressed because it is too large
Load diff
92
src/alisp/alisp_local.h
Normal file
92
src/alisp/alisp_local.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* ALSA lisp implementation
|
||||
* Copyright (c) 2003 by Jaroslav Kysela <perex@suse.cz>
|
||||
*
|
||||
* Based on work of Sandro Sigala (slisp-1.2)
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
enum alisp_tokens {
|
||||
ALISP_IDENTIFIER,
|
||||
ALISP_INTEGER,
|
||||
ALISP_STRING
|
||||
};
|
||||
|
||||
enum alisp_objects {
|
||||
ALISP_OBJ_NIL,
|
||||
ALISP_OBJ_T,
|
||||
ALISP_OBJ_INTEGER,
|
||||
ALISP_OBJ_IDENTIFIER,
|
||||
ALISP_OBJ_STRING,
|
||||
ALISP_OBJ_CONS
|
||||
};
|
||||
|
||||
struct alisp_object {
|
||||
int type;
|
||||
int gc;
|
||||
union {
|
||||
char *id;
|
||||
char *s;
|
||||
int i;
|
||||
struct {
|
||||
struct alisp_object *car;
|
||||
struct alisp_object *cdr;
|
||||
} c;
|
||||
} value;
|
||||
struct alisp_object *next;
|
||||
};
|
||||
|
||||
struct alisp_object_pair {
|
||||
struct alisp_object *name;
|
||||
struct alisp_object *value;
|
||||
struct alisp_object_pair *next;
|
||||
};
|
||||
|
||||
#define ALISP_LEX_BUF_MAX 16
|
||||
|
||||
struct alisp_instance {
|
||||
int verbose: 1,
|
||||
warning: 1,
|
||||
debug: 1;
|
||||
/* i/o */
|
||||
snd_input_t *in;
|
||||
snd_output_t *out;
|
||||
snd_output_t *vout; /* verbose output */
|
||||
snd_output_t *wout; /* warning output */
|
||||
snd_output_t *dout; /* debug output */
|
||||
/* lexer */
|
||||
int charno;
|
||||
int lineno;
|
||||
int lex_buf[ALISP_LEX_BUF_MAX];
|
||||
int *lex_bufp;
|
||||
char *token_buffer;
|
||||
int token_buffer_max;
|
||||
int thistoken;
|
||||
/* object allocator */
|
||||
int free_objs;
|
||||
int used_objs;
|
||||
struct alisp_object *free_objs_list;
|
||||
struct alisp_object *used_objs_list;
|
||||
/* set object */
|
||||
struct alisp_object_pair *setobjs_list;
|
||||
/* garbage collect */
|
||||
int gc_id;
|
||||
/* alsa configuration */
|
||||
snd_config_t *root; /* configuration root */
|
||||
snd_config_t *node; /* result */
|
||||
};
|
||||
12
src/output.c
12
src/output.c
|
|
@ -78,6 +78,18 @@ int snd_output_printf(snd_output_t *output, const char *format, ...)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Writes formatted output (like \c fprintf(3)) to an output handle.
|
||||
* \param output The output handle.
|
||||
* \param format Format string in \c fprintf format.
|
||||
* \param args Other \c fprintf arguments.
|
||||
* \return The number of characters written, or a negative error code.
|
||||
*/
|
||||
int snd_output_vprintf(snd_output_t *output, const char *format, va_list args)
|
||||
{
|
||||
return output->ops->print(output, format, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Writes a string to an output handle (like \c fputs(3)).
|
||||
* \param output The output handle.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue