1#
2# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation.  Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26GENSRC_CHARSETCODER :=
27
28GENSRC_CHARSETCODER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio/charset
29
30GENSRC_CHARSETCODER_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
31
32GENSRC_CHARSETCODER_TEMPLATE := $(GENSRC_CHARSETCODER_SRC)/charset/Charset-X-Coder.java.template
33
34################################################################################
35
36$(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
37	$(MKDIR) -p $(@D)
38	-$(RM) $@.tmp
39	$(TOOL_SPP) < $< >$@.tmp \
40	    -Kdecoder \
41	    -DA='A' \
42	    -Da='a' \
43	    -DCode='Decode' \
44	    -Dcode='decode' \
45	    -DitypesPhrase='bytes in a specific charset' \
46	    -DotypesPhrase='sixteen-bit Unicode characters' \
47	    -Ditype='byte' \
48	    -Dotype='character' \
49	    -DItype='Byte' \
50	    -DOtype='Char' \
51	    -Dcoder='decoder' \
52	    -DCoder='Decoder' \
53	    -Dcoding='decoding' \
54	    -DOtherCoder='Encoder' \
55	    -DreplTypeName='string' \
56	    -DdefaultRepl='"\\uFFFD"' \
57	    -DdefaultReplName='<code>"\&#92;uFFFD"<\/code>' \
58	    -DreplType='String' \
59	    -DreplFQType='java.lang.String' \
60	    -DreplLength='length()' \
61	    -DItypesPerOtype='CharsPerByte' \
62	    -DnotLegal='not legal for this charset' \
63	    -Dotypes-per-itype='chars-per-byte' \
64	    -DoutSequence='Unicode character'
65	$(MV) $@.tmp $@
66
67GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
68
69################################################################################
70
71$(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
72	$(MKDIR) -p $(@D)
73	-$(RM) $@.tmp
74	$(TOOL_SPP) < $< >$@.tmp \
75	    -Kencoder \
76	    -DA='An' \
77	    -Da='an' \
78	    -DCode='Encode' \
79	    -Dcode='encode' \
80	    -DitypesPhrase='sixteen-bit Unicode characters' \
81	    -DotypesPhrase='bytes in a specific charset' \
82	    -Ditype='character' \
83	    -Dotype='byte' \
84	    -DItype='Char' \
85	    -DOtype='Byte' \
86	    -Dcoder='encoder' \
87	    -DCoder='Encoder' \
88	    -Dcoding='encoding' \
89	    -DOtherCoder='Decoder' \
90	    -DreplTypeName='byte array' \
91	    -DdefaultRepl='new byte[] { (byte)'"'"\\?"'"' }' \
92	    -DdefaultReplName='<code>{<\/code>\&nbsp;<code>(byte)'"'"\\?"'"'<\/code>\&nbsp;<code>}<\/code>' \
93	    -DreplType='byte[]' \
94	    -DreplFQType='byte[]' \
95	    -DreplLength='length' \
96	    -DItypesPerOtype='BytesPerChar' \
97	    -DnotLegal='not a legal sixteen-bit Unicode sequence' \
98	    -Dotypes-per-itype='bytes-per-char' \
99	    -DoutSequence='byte sequence in the given charset'
100	$(MV) $@.tmp $@
101
102GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java
103GENSRC_JAVA_BASE += $(GENSRC_CHARSETCODER)
104
105################################################################################
106
107$(GENSRC_CHARSETCODER): $(BUILD_TOOLS_JDK)
108