]> andersk Git - zcommit.git/blame - src/zsend-0.0.1/lread.h
.htaccess: Do not use [QSA] on the RewriteRule.
[zcommit.git] / src / zsend-0.0.1 / lread.h
CommitLineData
a0223729
GB
1/*
2 lread.h Header file for elisp reader and destructurer
3 Copyright (C) 1992 Nick Thompson (nix@cs.cmu.edu)
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 This code is useful for communicating with emacs, particularly in
20 subprocesses which are started by emacs. It allows you to do structured
21 ipc by passing printed s-expressions between emacs and the subprocess -
22 strings are parsed into a union "Value" by this code and there is also a
23 fairly convenient way to extract data.
24
25 */
26
27#include <stdlib.h> /* for malloc() */
28
29enum Vtag { any, nil, cons, string, symbol, integer, var };
30
31typedef struct Value Value;
32struct Value {
33 enum Vtag tag;
34 union {
35 /* tag nil has no data */
36 struct { Value *car, *cdr; } cons;
37 struct { int length; char *string; } s; /* tag string or symbol */
38 struct { long i; } integer;
39 struct { enum Vtag tag; void **value; } var;
40 } value;
41};
42
43#define ALLOC_VALUE() ((Value *) malloc(sizeof(Value)))
44
45#define VTAG(v) (v?((v)->tag):nil)
46
47extern Value *vmake_cons(Value *car, Value *cdr);
48#define VCAR(v) ((v)->value.cons.car)
49#define VCDR(v) ((v)->value.cons.cdr)
50
51extern Value *vmake_symbol(int length, char *data);
52extern Value *vmake_symbol_c(char *s);
53extern Value *vmake_string(int length, char *data);
54extern Value *vmake_string_c(char *s);
55extern char *vextract_string_c(Value *v);
56#define VSLENGTH(v) ((v)->value.s.length)
57#define VSDATA(v) ((v)->value.s.string)
58
59extern Value *vmake_integer(int n);
60#define VINTEGER(v) ((v)->value.integer.i)
61
62extern Value *vmake_var(enum Vtag tag, void **value);
63#define VVTAG(v) ((v)->value.var.tag)
64#define VVDATA(v) ((v)->value.var.value)
65
66extern Value *assqv(Value *key, Value *assoc);
67extern int vlength(Value *l);
68
69extern int eqv();
70extern int parse();
71extern void free_value();
This page took 0.163539 seconds and 5 git commands to generate.