/* * This file is part of the Vars library, copyright (C) Glenn Hutchings * 1996-2006. * * The Vars library comes with ABSOLUTELY NO WARRANTY. This is free * software, and you are welcome to redistribute it under certain * conditions; see the file COPYING for details. */ /* Compatibility with previous Vars versions */ #include #include #include "vars.h" #include "vars-compat.h" /* * Old I/O functions. */ #define OLD_IO(code, name) \ name * v ## code ## _fread(FILE *fp) \ { return v ## code ## _read(fp); } \ int v ## code ## _fwrite(name *var, FILE *fp) \ { return v ## code ## _write(var, fp); } OLD_IO(a, varray); OLD_IO(b, vbuffer); OLD_IO(d, vdatabase); OLD_IO(f, vfunc); OLD_IO(g, vgraph); OLD_IO(h, vhash); OLD_IO(i, vimage); OLD_IO(l, vlist); OLD_IO(m, vmatrix); OLD_IO(p, vparser); OLD_IO(q, vqueue); OLD_IO(r, vregex); OLD_IO(s, vscalar); OLD_IO(v, vvector); void *v_fread(FILE *fp) {return v_read(fp);} int v_fwrite(void *ptr, FILE *fp) {return v_write(ptr, fp);} /* * Old type declaration functions. */ char *vt_name(vtype *t) {return v_name(t);} char *vt_ptrname(void *ptr) {return v_ptrname(ptr);} vheader *vt_header(vtype *t) {return v_header(t);} void vt_declare(void) {v_declare();} void vt_copy_with(vtype *t, void *(*func)()) {v_copy_func(t, func);} void vt_destroy_with(vtype *t, void (*func)()) {v_destroy_func(t, func);} void vt_freeze_with(vtype *t, int (*func)()) {v_freeze_func(t, func);} void vt_print_with(vtype *t, void (*func)()) {v_print_func(t, func);} void vt_read_with(vtype *t, void *(*func)()) {v_read_func(t, func);} void vt_thaw_with(vtype *t, void *(*func)()) {v_thaw_func(t, func);} void vt_traverse_with(vtype *t, int (*func)()) {v_traverse_func(t, func);} void vt_write_with(vtype *t, int (*func)()) {v_write_func(t, func);} vtype *vt_create(char *name, char *code) {return v_create(name, code);} vtype *vt_find(char *code) {return v_find(code);} vtype *vt_find_name(char *name) {return v_find_name(name);} vtype *vt_type(void *ptr) {return v_type(ptr);} /* * Other renamed functions. */ vlist *vg_path_list(vgraph *g, char *n1, char *n2) {return vg_path_nodes(g, n1, n2);} vhash *vh_create_table(unsigned size, int reuse) {return vh_create_size(size);} vhash *vh_environ(void) {return v_environ();} vhash *vh_getopt(int argc, char *argv[]) {return v_getopts(argc, argv);} vlist *vh_sortkeys(vhash *h, int (*cmp)(vscalar **s1, vscalar **s2)) {return vl_sort(vh_keys(h), cmp);} vlist *vh_sortvalues(vhash *h, int (*cmp)(vscalar **s1, vscalar **s2)) {return vl_sort(vh_values(h), cmp);} vlist *vl_glob(char *dir, char *pat) {return v_glob(dir, pat);} vlist *vl_procinfo(void) {return v_procinfo();} void vl_sort_inplace(vlist *l, int (*cmp)(vscalar **s1, vscalar **s2)) {vl_sort(l, cmp);} vlist *vl_stat(char *file) {return vl_copy(v_stat(file));}