Home | History | Annotate | Download | only in libterminfo

Lines Matching defs:tic

69 _ti_promote(TIC *tic)
77 ortype = tic->rtype;
78 tic->rtype = TERMINFO_RTYPE;
79 obuf = tic->name;
80 tic->name = _ti_getname(tic->rtype, tic->name);
81 if (tic->name == NULL) {
83 tic->name = obuf;
89 obuf = buf = tic->alias;
90 tic->alias = NULL;
95 name = _ti_getname(tic->rtype, buf);
97 nbuf = realloc(tic->alias, n + strl);
102 tic->alias = nbuf;
103 memcpy(tic->alias + n, name, strl);
110 obuf = tic->nums.buf;
112 entries = tic->nums.entries;
113 tic->nums.buf = NULL;
114 tic->nums.entries = tic->nums.buflen = tic->nums.bufpos = 0;
119 !_ti_encode_buf_id_num(&tic->nums, ind, num,
120 _ti_numsize(tic)))
129 obuf = tic->extras.buf;
131 entries = tic->extras.entries;
132 tic->extras.buf = NULL;
133 tic->extras.entries = tic->extras.buflen = tic->extras.bufpos = 0;
158 if (!_ti_store_extra(tic, 0, code, type, flag, num,
194 _ti_find_cap(TIC *tic, TBUF *tbuf, char type, short ind)
212 cap += _ti_numsize(tic);
226 _ti_find_extra(TIC *tic, TBUF *tbuf, const char *code)
246 cap += _ti_numsize(tic);
298 _ti_store_extra(TIC *tic, int wrn, const char *id, char type, char flag,
303 _DIAGASSERT(tic != NULL);
306 if (_ti_find_extra(tic, &tic->extras, id) != NULL)
311 tic->name, id);
318 dowarn(flags, "%s: %s: cap name is too long", tic->name, id);
328 capl += _ti_numsize(tic);
335 if (!_ti_grow_tbuf(&tic->extras, capl))
337 _ti_encode_buf_count_str(&tic->extras, id, l);
338 tic->extras.buf[tic->extras.bufpos++] = type;
341 tic->extras.buf[tic->extras.bufpos++] = flag;
344 _ti_encode_buf_num(&tic->extras, num, tic->rtype);
347 _ti_encode_buf_count_str(&tic->extras, str, strl);
350 tic->extras.entries++;
367 _ti_flatten(uint8_t **buf, const TIC *tic)
373 _DIAGASSERT(tic != NULL);
375 len = strlen(tic->name) + 1;
376 if (tic->alias == NULL)
379 alen = strlen(tic->alias) + 1;
380 if (tic->desc == NULL)
383 dlen = strlen(tic->desc) + 1;
389 (sizeof(uint16_t) * 2) + tic->flags.bufpos +
390 (sizeof(uint16_t) * 2) + tic->nums.bufpos +
391 (sizeof(uint16_t) * 2) + tic->strs.bufpos +
392 (sizeof(uint16_t) * 2) + tic->extras.bufpos;
399 *cap++ = tic->rtype;
401 _ti_encode_count_str(&cap, tic->name, len);
402 _ti_encode_count_str(&cap, tic->alias, alen);
403 _ti_encode_count_str(&cap, tic->desc, dlen);
405 _ti_encode_buf(&cap, &tic->flags);
407 _ti_encode_buf(&cap, &tic->nums);
408 _ti_encode_buf(&cap, &tic->strs);
409 _ti_encode_buf(&cap, &tic->extras);
592 TIC *
602 TIC *tic;
631 tic = calloc(sizeof(*tic), 1);
632 if (tic == NULL)
636 tic->rtype = TERMINFO_RTYPE_O1; /* will promote if needed */
638 tic->rtype = TERMINFO_RTYPE;
643 tic->name = _ti_getname(tic->rtype, name);
644 if (tic->name == NULL)
647 tic->alias = _ti_getname(tic->rtype, alias);
648 if (tic->alias == NULL)
652 tic->desc = strdup(desc);
653 if (tic->desc == NULL)
679 _ti_find_cap(tic, &tic->strs, 's', ind) != NULL)
684 if (encode_string(tic->name, token,
689 tic->name, token);
694 tic->name, token);
699 if (!_ti_store_extra(tic, 1, token, 's', -1, -2,
703 if (!_ti_encode_buf_id_count_str(&tic->strs,
717 _ti_find_cap(tic, &tic->nums, 'n', ind) != NULL)
723 tic->name, token);
728 tic->name, token, cnum);
734 else if (tic->rtype == TERMINFO_RTYPE_O1)
735 if (_ti_promote(tic) == -1)
741 if (!_ti_store_extra(tic, 1, token, 'n', -1,
745 if (!_ti_encode_buf_id_num(&tic->nums,
746 ind, num, _ti_numsize(tic)))
761 if (_ti_find_cap(tic, &tic->nums, 'n', ind)
764 if (!_ti_encode_buf_id_num(&tic->nums, ind,
765 CANCELLED_NUMERIC, _ti_numsize(tic)))
769 if (_ti_find_cap(tic, &tic->strs, 's', ind)
773 &tic->strs, ind, 0, sizeof(uint16_t)))
779 if (!_ti_store_extra(tic, 1, token, 'f', flag, 0, NULL,
782 } else if (_ti_find_cap(tic, &tic->flags, 'f', ind) == NULL) {
783 if (!_ti_encode_buf_id_flags(&tic->flags, ind, flag))
789 return tic;
793 _ti_freetic(tic);
798 _ti_freetic(TIC *tic)
801 if (tic != NULL) {
802 free(tic->name);
803 free(tic->alias);
804 free(tic->desc);
805 free(tic->extras.buf);
806 free(tic->flags.buf);
807 free(tic->nums.buf);
808 free(tic->strs.buf);
809 free(tic);