Lines Matching refs:dhp

99 static int buildcode(fm_dc_handle_t *dhp, const char *rhsp,
101 static bitv *code2dictval(fm_dc_handle_t *dhp, const char *code);
148 fm_dc_handle_t *dhp = NULL; in fm_dc_opendict() local
196 if ((dhp = malloc(sizeof (*dhp))) == NULL || in fm_dc_opendict()
197 (dhp->dictname = strdup(dictname)) == NULL) { in fm_dc_opendict()
198 if (dhp) in fm_dc_opendict()
199 free(dhp); in fm_dc_opendict()
211 dhp->fp = NULL; in fm_dc_opendict()
212 dhp->maxkey = 0; in fm_dc_opendict()
213 dhp->version = version; in fm_dc_opendict()
214 dhp->debug = debug; in fm_dc_opendict()
215 dhp->props = NULL; in fm_dc_opendict()
220 if ((dhp->fp = fopen(fname, "r")) == NULL) { in fm_dc_opendict()
230 fm_dc_closedict(dhp); in fm_dc_opendict()
236 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) { in fm_dc_opendict()
243 fm_dc_closedict(dhp); in fm_dc_opendict()
265 fm_dc_closedict(dhp); in fm_dc_opendict()
281 fm_dc_closedict(dhp); in fm_dc_opendict()
285 propp->next = dhp->props; in fm_dc_opendict()
286 dhp->props = propp; in fm_dc_opendict()
293 dhp->maxkey = strtoul(rhsp, NULL, 0); in fm_dc_opendict()
303 dhp->maxkey == 0) { in fm_dc_opendict()
304 fm_dc_closedict(dhp); in fm_dc_opendict()
308 debugstr, prop_version, prop_name, dhp->maxkey); in fm_dc_opendict()
315 (void *)dhp); in fm_dc_opendict()
316 return (dhp); in fm_dc_opendict()
321 fm_dc_closedict(fm_dc_handle_t *dhp) in fm_dc_closedict() argument
326 if (dhp->debug > 1) in fm_dc_closedict()
328 (void *)dhp); in fm_dc_closedict()
329 if (dhp->fp) in fm_dc_closedict()
330 (void) fclose(dhp->fp); in fm_dc_closedict()
332 free((void *) dhp->dictname); in fm_dc_closedict()
334 props = dhp->props; in fm_dc_closedict()
345 free(dhp); in fm_dc_closedict()
350 fm_dc_codelen(fm_dc_handle_t *dhp) in fm_dc_codelen() argument
352 size_t len = strlen(dhp->dictname); in fm_dc_codelen()
356 if (dhp->debug > 2) in fm_dc_codelen()
358 (void *)dhp, (int)(len + MAXCODELEN)); in fm_dc_codelen()
364 fm_dc_maxkey(fm_dc_handle_t *dhp) in fm_dc_maxkey() argument
369 if (dhp->debug > 2) in fm_dc_maxkey()
371 (void *)dhp, dhp->maxkey + 1); in fm_dc_maxkey()
372 return (dhp->maxkey + 1); in fm_dc_maxkey()
377 fm_dc_key2code(fm_dc_handle_t *dhp, in fm_dc_key2code() argument
387 if (dhp->debug > 1) { in fm_dc_key2code()
391 "fm_dc_key2code: dhp 0x%p maxcode %lu ", (void *)dhp, in fm_dc_key2code()
395 } else if (dhp->debug) in fm_dc_key2code()
401 rewind(dhp->fp); in fm_dc_key2code()
403 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) { in fm_dc_key2code()
415 if (dhp->debug > 1) in fm_dc_key2code()
424 return (buildcode(dhp, rhsp, code, maxcode, debugstr)); in fm_dc_key2code()
429 if (dhp->debug) in fm_dc_key2code()
437 fm_dc_code2key(fm_dc_handle_t *dhp, const char *code, in fm_dc_code2key() argument
447 if (dhp->debug > 1) in fm_dc_code2key()
450 (void *)dhp, code, maxkey); in fm_dc_code2key()
451 else if (dhp->debug) in fm_dc_code2key()
455 if ((dictval = code2dictval(dhp, code)) == NULL) { in fm_dc_code2key()
457 if (dhp->debug) { in fm_dc_code2key()
478 rewind(dhp->fp); in fm_dc_code2key()
480 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) { in fm_dc_code2key()
505 if (dhp->debug) in fm_dc_code2key()
535 if (dhp->debug) in fm_dc_code2key()
547 if (dhp->debug) in fm_dc_code2key()
558 if (dhp->debug) in fm_dc_code2key()
566 fm_dc_getprop(fm_dc_handle_t *dhp, const char *name) in fm_dc_getprop() argument
572 if (dhp->debug > 2) in fm_dc_getprop()
574 (void *)dhp, name); in fm_dc_getprop()
576 for (props = dhp->props; props; props = props->next) in fm_dc_getprop()
580 if (dhp->debug > 2) in fm_dc_getprop()
700 buildcode(fm_dc_handle_t *dhp, const char *rhsp, in buildcode() argument
713 if (maxcode < fm_dc_codelen(dhp)) { in buildcode()
714 if (dhp->debug) in buildcode()
718 (ulong_t)fm_dc_codelen(dhp)); in buildcode()
724 for (ptr = dhp->dictname; *ptr; ptr++) { in buildcode()
732 if (dhp->debug) { in buildcode()
757 if (dhp->debug > 3) in buildcode()
767 if (dhp->debug) in buildcode()
778 if (dhp->debug) in buildcode()
822 if (dhp->debug > 1) in buildcode()
831 code2dictval(fm_dc_handle_t *dhp, const char *code) in code2dictval() argument
834 int len = strlen(dhp->dictname); in code2dictval()
845 if (strncasecmp(code, dhp->dictname, len) || in code2dictval()
893 for (ptr = dhp->dictname; *ptr; ptr++) in code2dictval()