Lines Matching defs: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;
196 if ((dhp = malloc(sizeof (*dhp))) == NULL ||
197 (dhp->dictname = strdup(dictname)) == NULL) {
198 if (dhp)
199 free(dhp);
211 dhp->fp = NULL;
212 dhp->maxkey = 0;
213 dhp->version = version;
214 dhp->debug = debug;
215 dhp->props = NULL;
220 if ((dhp->fp = fopen(fname, "r")) == NULL) {
230 fm_dc_closedict(dhp);
236 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) {
243 fm_dc_closedict(dhp);
265 fm_dc_closedict(dhp);
281 fm_dc_closedict(dhp);
285 propp->next = dhp->props;
286 dhp->props = propp;
293 dhp->maxkey = strtoul(rhsp, NULL, 0);
303 dhp->maxkey == 0) {
304 fm_dc_closedict(dhp);
308 debugstr, prop_version, prop_name, dhp->maxkey);
314 (void) fprintf(stderr, "fm_dc_opendict: dhp 0x%p\n",
315 (void *)dhp);
316 return (dhp);
321 fm_dc_closedict(fm_dc_handle_t *dhp)
326 if (dhp->debug > 1)
327 (void) fprintf(stderr, "fm_dc_closedict: dhp 0x%p\n",
328 (void *)dhp);
329 if (dhp->fp)
330 (void) fclose(dhp->fp);
332 free((void *) dhp->dictname);
334 props = dhp->props;
345 free(dhp);
350 fm_dc_codelen(fm_dc_handle_t *dhp)
352 size_t len = strlen(dhp->dictname);
354 /* only one version so far, so dhp->version isn't checked */
356 if (dhp->debug > 2)
357 (void) fprintf(stderr, "fm_dc_codelen: dhp 0x%p: %d\n",
358 (void *)dhp, (int)(len + MAXCODELEN));
364 fm_dc_maxkey(fm_dc_handle_t *dhp)
366 /* only one version so far, so dhp->version isn't checked */
369 if (dhp->debug > 2)
370 (void) fprintf(stderr, "fm_dc_maxkey: dhp 0x%p: maxkey %d\n",
371 (void *)dhp, dhp->maxkey + 1);
372 return (dhp->maxkey + 1);
377 fm_dc_key2code(fm_dc_handle_t *dhp,
385 /* only one version so far, so dhp->version isn't checked */
387 if (dhp->debug > 1) {
391 "fm_dc_key2code: dhp 0x%p maxcode %lu ", (void *)dhp,
395 } else if (dhp->debug)
401 rewind(dhp->fp);
403 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) {
415 if (dhp->debug > 1)
424 return (buildcode(dhp, rhsp, code, maxcode, debugstr));
429 if (dhp->debug)
437 fm_dc_code2key(fm_dc_handle_t *dhp, const char *code,
445 /* only one version so far, so dhp->version isn't checked */
447 if (dhp->debug > 1)
449 "fm_dc_code2key: dhp 0x%p code \"%s\" maxkey %d: ",
450 (void *)dhp, code, maxkey);
451 else if (dhp->debug)
455 if ((dictval = code2dictval(dhp, code)) == NULL) {
457 if (dhp->debug) {
478 rewind(dhp->fp);
480 while (fgets(linebuf, DICTMAXLINE, dhp->fp) != NULL) {
505 if (dhp->debug)
535 if (dhp->debug)
547 if (dhp->debug)
558 if (dhp->debug)
566 fm_dc_getprop(fm_dc_handle_t *dhp, const char *name)
570 /* only one version so far, so dhp->version isn't checked */
572 if (dhp->debug > 2)
573 (void) fprintf(stderr, "fm_dc_getprop: dhp 0x%p: \"%s\"",
574 (void *)dhp, name);
576 for (props = dhp->props; props; props = props->next)
580 if (dhp->debug > 2)
700 buildcode(fm_dc_handle_t *dhp, const char *rhsp,
713 if (maxcode < fm_dc_codelen(dhp)) {
714 if (dhp->debug)
718 (ulong_t)fm_dc_codelen(dhp));
724 for (ptr = dhp->dictname; *ptr; ptr++) {
732 if (dhp->debug) {
757 if (dhp->debug > 3)
767 if (dhp->debug)
778 if (dhp->debug)
822 if (dhp->debug > 1)
831 code2dictval(fm_dc_handle_t *dhp, const char *code)
834 int len = strlen(dhp->dictname);
845 if (strncasecmp(code, dhp->dictname, len) ||
893 for (ptr = dhp->dictname; *ptr; ptr++)