diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-21 15:57:21 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-21 15:57:57 +0200 |
commit | 43ba0c3da9ff8913f0286a01a82875fa59601dc0 (patch) | |
tree | fac6765cc2fb90ae39f5eb47d2c41abcaf93fb6d /src/builtin.c | |
parent | 30e1c54062fe7098b9c71601370df1ce27f873d3 (diff) | |
download | wydawca-43ba0c3da9ff8913f0286a01a82875fa59601dc0.tar.gz wydawca-43ba0c3da9ff8913f0286a01a82875fa59601dc0.tar.bz2 |
Namespace cleanup.
Rename "access method" to "dictionary".
All sources affected.
* src/method.c: renamed to...
* src/dictionary.c: ... this.
Diffstat (limited to 'src/builtin.c')
-rw-r--r-- | src/builtin.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/builtin.c b/src/builtin.c index 73b1d23..5588fd6 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -20,21 +20,21 @@ #include "regex.h" int -builtin_init (struct access_method *meth) +builtin_init (struct dictionary *dict) { return 0; } int -builtin_done (struct access_method *meth) +builtin_done (struct dictionary *dict) { return 0; } void * -builtin_open (struct access_method *meth) +builtin_open (struct dictionary *dict) { - return meth; + return dict; } #define CMP_EXACT 0 @@ -159,7 +159,7 @@ static int default_ncol[] = { }; int -builtin_run (struct access_method *meth, void *handle, const char *req) +builtin_lookup (struct dictionary *dict, void *handle, const char *req) { int i; int rc; @@ -168,19 +168,19 @@ builtin_run (struct access_method *meth, void *handle, const char *req) int flags = 0; strcmp_fn cmpfn = cmp_exact; struct builtin_data_storage *bds; - int ncol = default_ncol[meth->id]; + int ncol = default_ncol[dict->id]; - if (meth->parmc == 0) + if (dict->parmc == 0) { - meth->nrow = meth->ncol = 0; + dict->nrow = dict->ncol = 0; return 0; } obstack_init (&stk); - for (i = 0; i < meth->parmc; i++) + for (i = 0; i < dict->parmc; i++) { - char *pat = meth->parmv[i]; + char *pat = dict->parmv[i]; if (pat[0] == '/') { @@ -189,7 +189,7 @@ builtin_run (struct access_method *meth, void *handle, const char *req) continue; } - if (i + ncol >= meth->parmc) + if (i + ncol >= dict->parmc) break; if (cmpfn (pat, req, flags)) @@ -197,7 +197,7 @@ builtin_run (struct access_method *meth, void *handle, const char *req) size_t j; for (j = 1; j <= ncol; j++) { - char *val = meth->parmv[i + j]; + char *val = dict->parmv[i + j]; obstack_grow (&stk, val, strlen (val) + 1); } count++; @@ -206,8 +206,8 @@ builtin_run (struct access_method *meth, void *handle, const char *req) i += ncol; } - meth->nrow = count; - meth->ncol = ncol; + dict->nrow = count; + dict->ncol = ncol; if (count == 0) { @@ -234,32 +234,32 @@ builtin_run (struct access_method *meth, void *handle, const char *req) rc = 0; } - meth->storage = bds; + dict->storage = bds; return rc; } int -builtin_free_result (struct access_method *method, void *handle) +builtin_free_result (struct dictionary *dict, void *handle) { - if (method->storage) + if (dict->storage) { - struct builtin_data_storage *bds = method->storage; + struct builtin_data_storage *bds = dict->storage; obstack_free (&bds->stk, NULL); free (bds->wp); free (bds); - method->storage = NULL; + dict->storage = NULL; } return 0; } int -builtin_get (struct access_method *method, void *handle, +builtin_get (struct dictionary *dict, void *handle, unsigned nrow, unsigned ncol) { - struct builtin_data_storage *bds = method->storage; - char *str = bds->wp[nrow * method->ncol + ncol]; - method_copy_result (method, str, strlen (str)); + struct builtin_data_storage *bds = dict->storage; + char *str = bds->wp[nrow * dict->ncol + ncol]; + dictionary_copy_result (dict, str, strlen (str)); return 0; } |