Sherman,
thanks for catching my request.
> Just took a quick look at the original awk script, it looks like
there might be some "old" leftover code,
> it should be simplified to something like below (let me know if I'm
wrong on this one)
I'm not sure, if I'm the right person to "review" your "un-garbadging"
of the original script, as I don't know anything about awk scripts.
However, I was wondering about the syntax of this script, as it looks
like java code, but I'm missing the java-conform declaration of the used
variables.
"Un-garbadging" the script from those lines will make it much clearer to
me, how it works, so I guess, you are not wrong with your "simplification".
If it outputs sun.nio.cs.StandardCharsets.java as identical to the "old"
leftover code, it should be correct.
But again, can you please run the script (original or your correction)
for me, to see, how generated source of sun.nio.cs.StandardCharsets.java
looks like.
You said, I could run the awk script myself from cygwin. As I'm also not
familiar to cygwin till this day, can you please give me an example,
what I should type in at cygwin shell to run the genCharsetProvider.sh
script, for my first attempt at walking.
My modified "awk script" is supposed to do following:
(1) If variable $3, the charset class name, starts with "%", creation of
the static String[] aliases should be omitted.
(2) If variable $3 equals "%S", it should be replaced by constant
SINGLE_BYTE_CLN. SINGLE_BYTE_CLN should be defined in
FastCharsetProvider.java, from which StandardCharsets.java is subclassed
from, as following:
static final String SINGLE_BYTE_CLN = "SingleByteCharset";
For running the script first, maybe it should be inlined directly as
"SingleByteCharset" to make it simpler.
(3) invokation of constructor should be shortened to:
super("$PKG", new Aliases(), new Classes());
(for details, why saving 1 HashMap in constructor, see:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6790402)
In awaiting your additional answer,
-Ulf
Am 12.04.2009 09:43, Xueming Shen schrieb:
Ulf,
While I am kind of able to guess what you want to achieve I'm not sure
I understand what
your modified "awk script" is supposed to do. genCharsetProvider.sh is
a shell scrip + awk,
it should be easy to experiment in any popular shell tool (cygwin)
without a C/C++ compiler
installed. I have to admit that I am not aware that awk supports the
syntax you are using, so I
can't help more on them.
Just took a quick look at the original awk script, it looks like there
might be some "old" leftover code,
it should be simplified to something like below (let me know if I'm
wrong on this one)
Sherman
------------------------------------
72c72,73
< BEGIN { n = 1; }
---
> BEGIN { n = 1; m = 1; }
>
74c75,79
< n++;
---
> csn = $2; cln = $3;
> lcsn = tolower(csn);
> lcsns[n++] = lcsn;
> csns[lcsn] = csn;
> classMap[lcsn] = cln;
77c82
< printf " static final String[] aliases_%s = new String[]
{\n", $3;
---
> printf " static final String[] aliases_%s = new String[]
{\n", cln;
80a86,87
> acsns[m++] = tolower($2);
> aliasMap[tolower($2)] = lcsn;
88a96
>
Ulf Zibis wrote:
Hi all,
as I'm working on Windows and I don't have Microsoft Visual Studio
C++ 2008 (VS2008) Standard Edition compiler, I can't run makefiles.
So I ask you, if somebody can run OpenJDK7\jdk\make\java\nio\Makefile
for me, to generate source of sun.nio.cs.StandardCharsets.java
(output of > \jdk\make\java\nio\genCharsetProvider.sh).
Additionally I have modified (see attachment):
OpenJDK7\jdk\make\java\nio\genCharsetProvider.sh
OpenJDK7\jdk\src\share\classes\sun\nio\cs\standard-charsets
Please too run the makefile with my modifications, and send me the
resulting output sun.nio.cs.StandardCharsets.java.
If there are some syntax errors (I'm not familiar with make syntax)
in my modified genCharsetProvider.sh, please try to correct them.
Thanks in advance for your investigation,
-Ulf
P.S.: please send your answer via the mailing list, so nobody would
do the work twice.