Skip to content

Commit

Permalink
Mechanical witx naming convention changes (WebAssembly#137)
Browse files Browse the repository at this point in the history
* witx: drop trailing `_t` from all typenames

this suffix is not appropriate for all languages that may need to
generate code from witx, so this change removes it from all witx files
and leaves the code generator in charge of putting the appropriate
suffix onto any type names it produces.

sed -i -E 's/\$([a-z_]+)_t([)\n\r ])?/\$\1\2/g' **/*.witx

* witx: change identifiers to snake case

Change all $SHOUTY_SNAKE_CASE identifers to $snake_case.

It is the responsibility of a code generator backend to select the
right case and style of these identifiers for the target language.
In witx, we should standardize on snake case (lowercase with a
single underscore as a word separator)

sed -i -E 's/\$([A-Z0-9_]+)([)\n\r ])?/\$\L\1\2/g' **/*.witx

* witx: mechanically remove repeated prefixes from flags, enums

once again, the code translation tool is responsible for putting the
right prefix in the generated code. languages with proper namespacing
facilities don't need the identifiers themselves to be namespaced.
otherwise, you can derive the namespacing prefix from the type name.

sed -i -E 's/\$(clock_|right_|whence_|filetype_|advice_|fdflag_|filestat_set_|lookup_|o_|st_|sock_|shut_|preopentype_)/\$/g' **/*.witx

* restore fields named pr_type and d_type

* remove $event_ prefix from eventrwflags member

doing so by regexp would delete various other valid event_ prefixes

* remove eventtype_ prefix from enum fields

this one could have been mechanical, but i left it out of the regexp

* restore oflags, fdflags argument names in path_open

* witx: delete leading `sig` from each $signal enum variant

* witx: delete leading `e` from each $errno enum variant

* fixup test

* witx: fix up old style names in comments
  • Loading branch information
Pat Hickey authored Nov 12, 2019
1 parent acf3cf1 commit 17f33a5
Show file tree
Hide file tree
Showing 7 changed files with 1,369 additions and 1,374 deletions.
Loading

0 comments on commit 17f33a5

Please sign in to comment.