Lines Matching refs:dhp
97 static int buildcode(fm_dc_handle_t *dhp, const char *rhsp,
99 static bitv *code2dictval(fm_dc_handle_t *dhp, const char *code);
146 fm_dc_handle_t *dhp = NULL; in fm_dc_opendict() local
194 if ((dhp = malloc(sizeof (*dhp))) == NULL || in fm_dc_opendict()
195 (dhp->dictname = strdup(dictname)) == NULL) { in fm_dc_opendict()
196 if (dhp) in fm_dc_opendict()
197 free(dhp); in fm_dc_opendict()
209 dhp->fp = NULL; in fm_dc_opendict()
210 dhp->maxkey = 0; in fm_dc_opendict()
211 dhp->version = version; in fm_dc_opendict()
212 dhp->debug = debug; in fm_dc_opendict()
213 dhp->props = NULL; in fm_dc_opendict()
218 if ((dhp->fp = fopen(fname, "r")) == NULL) { in fm_dc_opendict()
228 fm_dc_closedict(dhp); in fm_dc_opendict()
234 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) { in fm_dc_opendict()
241 fm_dc_closedict(dhp); in fm_dc_opendict()
263 fm_dc_closedict(dhp); in fm_dc_opendict()
279 fm_dc_closedict(dhp); in fm_dc_opendict()
283 propp->next = dhp->props; in fm_dc_opendict()
284 dhp->props = propp; in fm_dc_opendict()
291 dhp->maxkey = strtoul(rhsp, NULL, 0); in fm_dc_opendict()
301 dhp->maxkey == 0) { in fm_dc_opendict()
302 fm_dc_closedict(dhp); in fm_dc_opendict()
306 debugstr, prop_version, prop_name, dhp->maxkey); in fm_dc_opendict()
313 (void *)dhp); in fm_dc_opendict()
314 return (dhp); in fm_dc_opendict()
319 fm_dc_closedict(fm_dc_handle_t *dhp) in fm_dc_closedict() argument
324 if (dhp->debug > 1) in fm_dc_closedict()
326 (void *)dhp); in fm_dc_closedict()
327 if (dhp->fp) in fm_dc_closedict()
328 (void) fclose(dhp->fp); in fm_dc_closedict()
330 free((void *) dhp->dictname); in fm_dc_closedict()
332 props = dhp->props; in fm_dc_closedict()
343 free(dhp); in fm_dc_closedict()
348 fm_dc_codelen(fm_dc_handle_t *dhp) in fm_dc_codelen() argument
350 size_t len = strlen(dhp->dictname); in fm_dc_codelen()
354 if (dhp->debug > 2) in fm_dc_codelen()
356 (void *)dhp, (int)(len + MAXCODELEN)); in fm_dc_codelen()
362 fm_dc_maxkey(fm_dc_handle_t *dhp) in fm_dc_maxkey() argument
367 if (dhp->debug > 2) in fm_dc_maxkey()
369 (void *)dhp, dhp->maxkey + 1); in fm_dc_maxkey()
370 return (dhp->maxkey + 1); in fm_dc_maxkey()
375 fm_dc_key2code(fm_dc_handle_t *dhp, in fm_dc_key2code() argument
385 if (dhp->debug > 1) { in fm_dc_key2code()
389 "fm_dc_key2code: dhp 0x%p maxcode %lu ", (void *)dhp, in fm_dc_key2code()
393 } else if (dhp->debug) in fm_dc_key2code()
399 rewind(dhp->fp); in fm_dc_key2code()
401 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) { in fm_dc_key2code()
413 if (dhp->debug > 1) in fm_dc_key2code()
422 return (buildcode(dhp, rhsp, code, maxcode, debugstr)); in fm_dc_key2code()
427 if (dhp->debug) in fm_dc_key2code()
435 fm_dc_code2key(fm_dc_handle_t *dhp, const char *code, in fm_dc_code2key() argument
445 if (dhp->debug > 1) in fm_dc_code2key()
448 (void *)dhp, code, maxkey); in fm_dc_code2key()
449 else if (dhp->debug) in fm_dc_code2key()
453 if ((dictval = code2dictval(dhp, code)) == NULL) { in fm_dc_code2key()
455 if (dhp->debug) { in fm_dc_code2key()
476 rewind(dhp->fp); in fm_dc_code2key()
478 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) { in fm_dc_code2key()
503 if (dhp->debug) in fm_dc_code2key()
533 if (dhp->debug) in fm_dc_code2key()
545 if (dhp->debug) in fm_dc_code2key()
556 if (dhp->debug) in fm_dc_code2key()
564 fm_dc_getprop(fm_dc_handle_t *dhp, const char *name) in fm_dc_getprop() argument
570 if (dhp->debug > 2) in fm_dc_getprop()
572 (void *)dhp, name); in fm_dc_getprop()
574 for (props = dhp->props; props; props = props->next) in fm_dc_getprop()
578 if (dhp->debug > 2) in fm_dc_getprop()
698 buildcode(fm_dc_handle_t *dhp, const char *rhsp, in buildcode() argument
711 if (maxcode < fm_dc_codelen(dhp)) { in buildcode()
712 if (dhp->debug) in buildcode()
716 (ulong_t)fm_dc_codelen(dhp)); in buildcode()
722 for (ptr = dhp->dictname; *ptr; ptr++) { in buildcode()
730 if (dhp->debug) { in buildcode()
755 if (dhp->debug > 3) in buildcode()
765 if (dhp->debug) in buildcode()
776 if (dhp->debug) in buildcode()
820 if (dhp->debug > 1) in buildcode()
829 code2dictval(fm_dc_handle_t *dhp, const char *code) in code2dictval() argument
832 int len = strlen(dhp->dictname); in code2dictval()
843 if (strncasecmp(code, dhp->dictname, len) || in code2dictval()
891 for (ptr = dhp->dictname; *ptr; ptr++) in code2dictval()