diff options
| author | Simon Tatham <anakin@pobox.com> | 2004-04-20 17:50:41 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2004-04-20 17:50:41 +0000 |
| commit | 2b6def26f41457eba8f2056432cd1af68a5b58b0 (patch) | |
| tree | 6bc7c479673f48b7e488ea383c6076d4f28cf0fc /bk_whlp.c | |
| parent | 8a9d3f97956db97b0813a6d24c486371ff14bd80 (diff) | |
| download | halibut-2b6def26f41457eba8f2056432cd1af68a5b58b0.zip halibut-2b6def26f41457eba8f2056432cd1af68a5b58b0.tar.gz halibut-2b6def26f41457eba8f2056432cd1af68a5b58b0.tar.bz2 halibut-2b6def26f41457eba8f2056432cd1af68a5b58b0.tar.xz | |
Infrastructure changes for character set support. ustrtoa,
ustrfroma, utoa_dup and ufroma_dup now take a charset parameter, and
also have a variety of subtly distinct forms. Also, when a \cfg
directive is seen in the input file, the precise octet strings for
each parameter are kept in their original form as well as being
translated into Unicode, so that when they represent filenames they
can be used verbatim.
[originally from svn r4097]
Diffstat (limited to 'bk_whlp.c')
| -rw-r--r-- | bk_whlp.c | 31 |
1 files changed, 4 insertions, 27 deletions
@@ -45,30 +45,7 @@ static void whlp_contents_write(struct bk_whlp_state *state, paragraph *whlp_config_filename(char *filename) { - paragraph *p; - wchar_t *ufilename, *up; - int len; - - p = mknew(paragraph); - memset(p, 0, sizeof(*p)); - p->type = para_Config; - p->next = NULL; - p->fpos.filename = "<command line>"; - p->fpos.line = p->fpos.col = -1; - - ufilename = ufroma_dup(filename); - len = ustrlen(ufilename) + 2 + lenof(L"winhelp-filename"); - p->keyword = mknewa(wchar_t, len); - up = p->keyword; - ustrcpy(up, L"winhelp-filename"); - up = uadv(up); - ustrcpy(up, ufilename); - up = uadv(up); - *up = L'\0'; - assert(up - p->keyword < len); - sfree(ufilename); - - return p; + return cmdline_cfg_simple("winhelp-filename", filename, NULL); } void whlp_backend(paragraph *sourceform, keywordlist *keywords, @@ -129,7 +106,7 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords, p->parent->private_data = topicname; } else if (!ustricmp(p->keyword, L"winhelp-filename")) { sfree(filename); - filename = utoa_dup(uadv(p->keyword)); + filename = dupstr(adv(p->origkeyword)); } } } @@ -152,7 +129,7 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords, filename = newf; len = strlen(newf); } - cntname = mknewa(char, len); + cntname = mknewa(char, len+1); sprintf(cntname, "%.*s.cnt", len-4, filename); } @@ -671,7 +648,7 @@ static void whlp_rdaddwc(rdstringc *rs, word *text) { assert(text->type != word_CodeQuote && text->type != word_WkCodeQuote); if (removeattr(text->type) == word_Normal) { - if (whlp_convert(text->text, 0, &c, FALSE)) + if (whlp_convert(text->text, 0, &c, FALSE) || !text->alt) rdaddsc(rs, c); else whlp_rdaddwc(rs, text->alt); |