1 /* $Id: builtin.c,v 1.7 1994/06/24 12:26:40 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
11 /* Insert all builtin names into the outermost symbol table (first statement
12 * is sym_down() ). Note that this table is never destroy()ed, so static
13 * initializers may be used.
18 static char file[]="file";
20 static struct par_list
22 { &open_list[1], nil, T_VAR }, /* File descriptor */
23 { &open_list[2], nil, T_VALUE|T_ARR }, /* File name */
24 { nil, nil, T_VALUE|T_ARR } /* "r", "w", "a" */
27 { nil, nil, T_VALUE } /* File descriptor */
30 { nil, nil, T_VALUE } /* Exit code */
33 sym_down(); /* Add level of symbols above all others */
35 /* CHAN file[20], input=file[0], output=file[1], error=file[2]: */
37 info.vc.st.builtin=file;
39 insert(file, T_CHAN|T_ARR|T_BUILTIN, 20, &info);
41 info.vc.st.builtin=file;
43 insert("input", T_CHAN|T_BUILTIN, 1, &info);
45 info.vc.st.builtin=file;
47 insert("output", T_CHAN|T_BUILTIN, 1, &info);
49 info.vc.st.builtin=file;
50 info.vc.offset=2*(wz+vz);
51 insert("error", T_CHAN|T_BUILTIN, 1, &info);
53 /* DEF EOF= -1, TEXT= -2, RAW= -3: */
55 info.t_const=new_const(-1L);
56 insert("EOF", T_CONST|T_BUILTIN, 0, &info);
58 info.t_const=new_const(-2L);
59 insert("TEXT", T_CONST|T_BUILTIN, 0, &info);
61 info.t_const=new_const(-3L);
62 insert("RAW", T_CONST|T_BUILTIN, 0, &info);
64 /* PROC open(VAR fd, VALUE name[], mode[])= .... : */
65 info.proc.st.builtin="b_open";
66 info.proc.pars=open_list;
67 insert("open", T_PROC|T_BUILTIN, 0, &info);
69 /* PROC close(VALUE fd)= .... : */
70 info.proc.st.builtin="b_close";
71 info.proc.pars=close_list;
72 insert("close", T_PROC|T_BUILTIN, 0, &info);
74 /* PROC exit(VALUE code)= .... : */
75 info.proc.st.builtin="b_exit";
76 info.proc.pars=exit_list;
77 insert("exit", T_PROC|T_BUILTIN, 0, &info);