Fix naming of shared Unicode stubs#1363
Conversation
|
*_to_os seems good to me. What about execve_os, and char_os instead of wchar_t? |
|
I will wait a little before updating the PR to give more time in case there are other opinions. |
byterun/startup.c
Outdated
| #ifdef _WIN32 | ||
|
|
||
| static wchar_t * read_section_to_utf16(int fd, struct exec_trailer *trail, char *name) | ||
| static wchar_t * read_section_to_os(int fd, struct exec_trailer *trail, char *name) |
There was a problem hiding this comment.
That's where I found wchar_t. Should this be charnat (resp. char_os) for consistency?
There was a problem hiding this comment.
Ping on this minor point.
b24c716 to
c18897b
Compare
c18897b to
7060fda
Compare
|
Rebased on |
|
I still have some questions about the use of
|
|
Thanks for the questions @gasche ! Indeed, simplifications along the lines you mention may be possible.
All in all I agree that it is very appealing to try to get rid of the Just to summarize your suggestion is to change the signature of (where |
No way. It's perfectly legitimate to copy bytes as just byte with no OS-specific encoding implied. That the need doesn't show up in today's (Windows version of) the runtime system is an accident. |
|
What I think would be useful to have by release time are clear guidelines on how to write portable string-manipulating C code for the OCaml runtime (inside the distribution or in user's bindings), and hopefully to have these guidelines be followed by the code in the compiler distribution. (Another interesting question is whether we understand the backward-compatibility impact of these guidelines, that is the ability to write code that works under both old and new OCaml versions. I suppose that currently the answer is "wait until the oldest version you want to support has |
|
The
I'm not a big fan of those function names that start with an underscore, first because they scream "Windows!", second because the ISO C99 standard has a few choice words to say about them (7.1.3):
The Windows names such as |
|
What about using the
|
|
It seems fine to me. |
gasche
left a comment
There was a problem hiding this comment.
I approve of this change. Would a third person have a look, and merge if they also agree?
|
On the other hand, I believe that this needs to be rebased on top of the just-merged #1357 before merging. |
|
It's hard to do a useful review of such mostly mechanical renaming, but this all looks good to me, and @xavierleroy validated the terminology, so I think this is good to merge after rebasing. (There is also just one pending minor comment.) |
bd64432 to
aa96a54
Compare
|
Incidentally the Travis failures seem to be unrelated to the Unicode stuff, having to do with the symbol |
|
Note: this will have to be rebased again when #1362 is merged. The |
|
LGTM too and ready to rebase now that #1362 is merged. |
aa96a54 to
799f36d
Compare
|
Rebased on |
|
Anyone wants to restart Travis, or merge directly ? |
|
I restarted the CI build. We have long been waiting to see the greens! |
|
@nojb: could you maybe add this PR number to the Changes entry about the Windows runtime? It would be nice if someone following the PRs could get the whole picture -- especially given that currently those discussions and sources are the only source of documentation for the C interface. |
|
Sure, makes sense. |
|
All green! Merge? |
|
Thanks! |
|
Huzzah - well done @nojb! |
Fix naming of shared Unicode stubs
|
Merged, and cherry-picked in 4.06 ( 6882353 ). |
|
So good to be back to a healthy trunk!
Incidentally: we may try to do a better job at uniformizing our
different CI scripts. For instance, we may want to architecture things
so that we can guarranty that some things are tested on Inria's CI,
AppVeyor and Travis. We don't do that yet, e.g. the tests are not yet
run with ocamlrund on Inria's CI.
If nobody has done so before, I'll probably try to have a look to this
in not too long.
|
* Create invitation-to-contribute * Rename invitation-to-contribute to invitation-to-contribute.md * remove kind from title space * added description field * Delete invitation-to-contribute.md * Create invitation-to-contribute.md * fix image link * image for contribute * added calendar dates and Discord link * Update data/news/ocamlorg/invitation-to-contribute.md Co-authored-by: sabine <sabine@users.noreply.github.com> * Update data/news/ocamlorg/invitation-to-contribute.md Co-authored-by: sabine <sabine@users.noreply.github.com> --------- Co-authored-by: sabine <sabine@users.noreply.github.com>
This PR fixes a naming oversight in #1200. There are three functions used in C code shared between Unix and Windows to support Unicode under Windows which are called
caml_stat_strdup_to_utf16[converts from OCaml-side to OS-side]caml_stat_strdup_of_utf16[converts from OS-side to OCaml-side]caml_copy_string_of_utf16[converts from OS-side to OCaml-side]These names make no sense under Unix (where they are just synonyms for
caml_stat_strdup,caml_stat_strdup, andcaml_copy_stringrespectively). Let us rename them to something more neutral. In #1200 @dra27 had suggested using_osas suffix (I lost track of the suggestion back then):caml_stat_strdup_to_oscaml_stat_strdup_of_oscaml_copy_string_of_osOpinions ?
While on this topic, it may be worthwhile to revisit the other names introduced by #1200, see here. For example, the name
_texecvestands forexecveunder Unix and_wexecveunder Windows. The reason for this naming choice was partly due to it being like this in the original Unicode PR and partly because it follows Windows conventions. But I would be happy to hear any suggestions for improvements.Also: the changes in #1357 will need to be updated to take into account this PR.
@gasche @alainfrisch @dra27