home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1986, 1988, 1989 the Free Software Foundation, Inc.
- *
- * This file is part of GAWK, the GNU implementation of the
- * AWK Progamming Language.
- *
- * GAWK is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 1, or (at your option)
- * any later version.
- *
- * GAWK 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GAWK; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #if defined (X3J11) || defined (THINK_C)
- typedef void *pointer; /* generic pointer type */
- #else
- typedef char *pointer; /* generic pointer type */
- #endif
-
- /* Protoypes grabbed from file
- ** "alloca.c"
- ** 1990 Sep 5 (Wed) 20:40:48
- */
-
- void
- find_stack_direction(void);
-
- pointer
- alloca(unsigned size); /* # bytes to allocate */
-
- /* Protoypes grabbed from file
- ** "awk.tab.c"
- ** 1990 Sep 6 (Thu) 20:38:04
- */
-
- int
- yyparse(void);
-
- void
- yyerror(char *,...);
-
- int
- yylex(void);
-
- FILE *
- pathopen(char *file);
-
- NODE *
- node_common(NODETYPE op);
-
- NODE *
- node(NODE *left,
- NODETYPE op,
- NODE *right);
-
- NODE *
- snode(NODE *subn,
- NODETYPE op,
- NODE *(*procp)());
-
- NODE *
- mkrangenode(NODE *cpair);
-
- NODE *
- make_for_loop(NODE *init,
- NODE *cond,
- NODE *incr);
-
- NODE *
- install(NODE **table,
- char *name,
- NODE *value);
-
- NODE *
- lookup(NODE **table,
- char *name);
-
- int
- hashf(char *name,
- int len,
- int hashsize);
-
- NODE *
- append_right(NODE *list,
- NODE *new);
-
- void
- func_install(NODE *params,
- NODE *def);
-
- void
- pop_var(NODE *np,
- int freeit);
-
- void
- pop_params(NODE *params);
-
- NODE *
- make_param(char *name);
-
- NODE *
- variable(char *name);
-
- /* Protoypes grabbed from file
- ** "array.c"
- ** 1990 Aug 5 (Sun) 22:00:19
- */
-
- NODE *
- concat_exp(NODE *tree);
-
- void
- assoc_clear(NODE *symbol);
-
- int
- hash_calc(NODE *subs);
-
- NODE *
- assoc_find(NODE *symbol,
- NODE *subs,
- int hash1);
-
- int
- in_array(NODE *symbol,
- NODE *subs);
-
- NODE **
- assoc_lookup(NODE *symbol,
- NODE *subs);
-
- void
- do_delete(NODE *symbol,
- NODE *tree);
-
- struct search *
- assoc_scan(NODE *symbol);
-
- struct search *
- assoc_next(struct search *lookat);
-
- /* Protoypes grabbed from file
- ** "builtin.c"
- ** 1990 Jul 29 (Sun) 21:33:56
- */
-
- NODE *
- do_exp(NODE *tree);
-
- NODE *
- do_index(NODE *tree);
-
- NODE *
- do_int(NODE *tree);
-
- NODE *
- do_length(NODE *tree);
-
- NODE *
- do_log(NODE *tree);
-
- NODE *
- do_sprintf(NODE *tree);
-
- void
- do_printf(NODE *tree);
-
- NODE *
- do_sqrt(NODE *tree);
-
- NODE *
- do_substr(NODE *tree);
-
- NODE *
- do_system(NODE *tree);
-
- void
- do_print(NODE *tree);
-
- NODE *
- do_tolower(NODE *tree);
-
- NODE *
- do_toupper(NODE *tree);
-
- void
- get_one(NODE *tree,
- NODE **res);
-
- void
- get_two(NODE *tree,
- NODE **res1,
- NODE **res2);
-
- int
- get_three(NODE *tree,
- NODE **res1,
- NODE **res2,
- NODE **res3);
-
- int
- a_get_three(NODE *tree,
- NODE **res1,
- NODE **res2,
- NODE **res3);
-
- void
- print_simple(NODE *tree,
- FILE *fp);
-
- NODE *
- do_atan2(NODE *tree);
-
- NODE *
- do_sin(NODE *tree);
-
- NODE *
- do_cos(NODE *tree);
-
- NODE *
- do_rand(NODE *tree);
-
- NODE *
- do_srand(NODE *tree);
-
- NODE *
- do_match(NODE *tree);
-
- NODE *
- sub_common(NODE *tree,
- int global);
-
- NODE *
- do_gsub(NODE *tree);
-
- NODE *
- do_sub(NODE *tree);
-
- /* Protoypes grabbed from file
- ** "debug.c"
- ** 1990 Aug 18 (Sat) 13:22:48
- */
-
-
- ptree(NODE *n);
-
-
- pt(void);
-
-
- print_parse_tree(NODE *ptr);
-
-
- dump_vars(void);
-
-
- dump_fields(void);
-
-
- print_debug(char *str,
- int n);
-
- print_a_node(NODE *ptr);
-
-
- print_maybe_semi(NODE *ptr);
-
-
- deal_with_curls(NODE *ptr);
-
- NODE *
- do_prvars(void);
-
- NODE *
- do_bp(void);
-
- void
- do_free(char *s);
-
- /* Protoypes grabbed from file
- ** "eval.c"
- ** 1990 Jul 29 (Sun) 21:33:54
- */
-
- int
- interpret(NODE *tree);
-
- NODE *
- r_tree_eval(NODE *tree);
-
- void
- assign_number(NODE **ptr,
- AWKNUM value);
-
- int
- eval_condition(NODE *tree);
-
- int
- cmp_nodes(NODE *t1,
- NODE *t2);
-
- NODE *
- op_assign(NODE *tree);
-
- NODE *
- func_call(NODE *name, /* name is a Node_val giving function name */
- NODE *arg_list); /* Node_expression_list of calling args. */
-
- NODE **
- get_lhs(NODE *ptr,
- int assign); /* this is being called for the LHS of an assign. */
-
- NODE *
- match_op(NODE *tree);
-
- /* Protoypes grabbed from file
- ** "field.c"
- ** 1990 Jul 29 (Sun) 21:34:01
- */
-
- void
- init_fields(void);
-
- void
- set_field(int num,
- char *str,
- int len,
- NODE *dummy);
-
- void
- rebuild_record(void);
-
- void
- set_record(char *buf,
- int cnt);
-
- NODE **
- get_field(int num,
- int assign);
-
- int
- parse_fields(int up_to,
- char **buf,
- int len,
- char *fs,
- void (*set)(),
- NODE *n);
-
- int
- re_split(char *buf,
- int len,
- char *fs,
- struct re_registers *reregsp);
-
- NODE *
- do_split(NODE *tree);
-
- char *
- get_fs(void);
-
- void
- set_element(int num,
- char *s,
- int len,
- NODE *n);
-
- /* Protoypes grabbed from file
- ** "gnufuncts.c"
- ** 1990 Sep 5 (Wed) 20:49:10
- */
-
- void
- bzero(void *p,
- int n);
-
- FILE *
- popen(char *s,
- char *mode);
-
-
- pclose(FILE *fp);
-
- int
- bcmp(char *d,
- char *d2,
- int mcnt);
-
- char *
- index(char *s,
- char c);
-
- int
- pipe(int fildes[2]);
-
- int
- fork(void);
-
- int
- wait(void *);
-
- int
- dup2(int old,
- int new);
-
- pointer
- xmalloc(unsigned int n);
-
- /* Protoypes grabbed from file
- ** "io.c"
- ** 1990 Aug 28 (Tue) 21:10:46
- */
-
- IOBUF *
- nextfile(void);
-
- IOBUF *
- iop_alloc(int fd);
-
- void
- do_input(void);
-
- int
- iop_close(IOBUF *iop);
-
- int
- inrec(IOBUF *iop);
-
- void
- do_file(IOBUF *iop);
-
- int
- get_rs(void);
-
- struct redirect *
- redirect(NODE *tree,
- int *errflg);
-
- void
- close_one(void);
-
- NODE *
- do_close(NODE *tree);
-
- int
- close_redir(struct redirect *rp);
-
- int
- flush_io(void);
-
- int
- close_io(void);
-
- int
- devopen(char *name,
- char *mode);
-
- IOBUF *
- gawk_popen(char *cmd,
- struct redirect *rp);
-
- int
- gawk_pclose(struct redirect *rp);
-
- IOBUF *
- gawk_popen(char *cmd,
- struct redirect *rp);
-
- int
- gawk_pclose(struct redirect *rp);
-
- int
- get_a_record(char **res,
- IOBUF *iop);
-
- NODE *
- do_getline(NODE *tree);
-
- /* Protoypes grabbed from file
- ** "main.c"
- ** 1990 Sep 3 (Mon) 18:29:41
- */
-
- int
- main(int argc,
- char **argv);
-
- void
- usage(void);
-
- struct re_pattern_buffer *
- make_regexp(NODE *s,
- int ignorecase);
-
- struct re_pattern_buffer *
- mk_re_parse(char *s,
- int ignorecase);
-
- void
- copyleft(void);
-
- void
- set_fs(char *str);
-
- void
- init_args(int argc0,
- int argc,
- char *argv0,
- char **argv);
-
- void
- init_vars(void);
-
- NODE *
- spc_var(char *name,
- NODE *value);
-
- void
- pre_assign(char *v);
-
- SIGTYPE
- catchsig(int sig,
- int code);
-
- /* Protoypes grabbed from file
- ** "msg.c"
- ** 1990 Jul 29 (Sun) 21:33:58
- */
-
- void
- err(char *s, char *msg, va_list *argp);
-
- /* Protoypes grabbed from file
- ** "node.c"
- ** 1990 Jul 29 (Sun) 21:34:01
- */
-
- AWKNUM
- r_force_number(NODE *n);
-
- NODE *
- r_force_string(NODE *s);
-
- NODE *
- dupnode(NODE *n);
-
- NODE *
- make_number(AWKNUM x);
-
- NODE *
- tmp_number(AWKNUM x);
-
- NODE *
- make_str_node(char *s,
- int len,
- int scan);
-
- NODE *
- tmp_string(char *s,
- int len);
-
- NODE *
- newnode(NODETYPE ty);
-
- void
- freenode(NODE *it);
-
-
- pf(void);
-
- void
- do_deref(void);
-
- /* Protoypes grabbed from file
- ** "regex.c"
- ** 1990 Sep 2 (Sun) 21:54:54
- */
-
- void
- init_syntax_once(void);
-
- int
- re_set_syntax(
- int syntax);
-
- char *
- re_compile_pattern(char *pattern,
- int size,
- struct re_pattern_buffer *bufp);
-
- int
- store_jump(char *from,
- char opcode,
- char *to);
-
- int
- insert_jump(char op,
- char *from,
- char *to,
- char *current_end);
-
- void
- re_compile_fastmap(struct re_pattern_buffer *bufp);
-
- int
- re_search(struct re_pattern_buffer *pbufp,
- char *string,
- int size,
- int startpos,
- int range,
- struct re_registers *regs);
-
- int
- re_search_2(struct re_pattern_buffer *pbufp,
- char *string1,
- int size1,
- char *string2,
- int size2,
- int startpos,
- int range,
- struct re_registers *regs,
- int mstop);
-
- int
- re_match(struct re_pattern_buffer *pbufp,
- char *string,
- int size,
- int pos,
- struct re_registers *regs);
-
- int
- re_match_2(struct re_pattern_buffer *pbufp,
- unsigned char *string1,
- int size1,
- unsigned char *string2,
- int size2,
- int pos,
- struct re_registers *regs,
- int mstop);
-
- int
- bcmp_translate(unsigned char *s1,
- unsigned char *s2,
- int len,
- unsigned char *translate);
-
- char *
- re_comp(char *s);
-
- int
- re_exec(char *s);
-
-
- main(int argc,
- char **argv);
-
-
- print_buf(struct re_pattern_buffer *bufp);
-
-
- printchar(char c);
-
- /* Protoypes grabbed from file
- ** "gcvt.c"
- ** 1990 Jul 29 (Sun) 21:34:33
- */
-
- char *
- gcvt(double value,
- int digits,
- char *buff);
-
- /* Protoypes grabbed from file
- ** "getopt.c"
- ** 1990 Aug 18 (Sat) 13:19:18
- */
-
- int
- getopt(int argc,
- char **argv,
- char *opts);
-
-
- /* Protoypes grabbed from file
- ** "random.c"
- ** 1990 Jul 29 (Sun) 21:34:35
- */
-
-
- srandom(unsigned x);
-
- char *
- initstate(unsigned seed,
- char *arg_state,
- int n);
-
- char *
- setstate(char *arg_state);
-
- long
- random(void);
-
- /* Protoypes grabbed from file
- ** "strcase.c"
- ** 1990 Aug 18 (Sat) 13:21:27
- */
-
-
- strcasecmp(char *s1,
- char *s2);
-
-
- strncasecmp(char *s1,
- char *s2,
- int n);
-
- /* Protoypes grabbed from file
- ** "strerror.c"
- ** 1990 Jul 29 (Sun) 21:34:36
- */
-
- char *
- strerror(int n);
-
- /* Protoypes grabbed from file
- ** "strtod.c"
- ** 1990 Jul 29 (Sun) 21:34:37
- */
-
- double
- strtod(char *s,
- char **ptr);
-
-
- main(int argc,
- char **argv);
-
- /* Protoypes grabbed from file
- ** "tmpnam.c"
- ** 1990 Jul 29 (Sun) 21:34:37
- */
-
- char *
- tmpnam(char *tmp);
-
- /* Protoypes grabbed from file
- ** "vprintf.c"
- ** 1990 Jul 29 (Sun) 21:34:37
- */
-
- int
- vsprintf(char *str,
- char *fmt,
- va_list ap);
-
- int
- vfprintf(FILE *iop,
- char *fmt,
- va_list ap);
-
- int
- vprintf(char *fmt,
- va_list ap);
-
-
- /* Protoypes grabbed from file
- ** "msg.c"
- ** 1990 Jul 29 (Sun) 21:33:58
- */
-
- void
- msg(char *,...);