1 /*
2 * Copyright (c) 2003, 2009, 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
975
976 pw.println("\tpublic " + ft.getReturnType() + " execute() {");
977 if (ft.isVoid()) {
978 pw.println("\t\texecute(null);");
979 } else {
980 pw.println("\t\treturn execute(null);");
981 }
982 pw.println("\t}");
983
984 pw.println("\tpublic " + ft.getReturnType() + " execute(XToolkit.XErrorHandler errorHandler) {");
985 pw.println("\t\tif (__disposed) {");
986 pw.println("\t\t throw new IllegalStateException(\"Disposed\");");
987 pw.println("\t\t}");
988 pw.println("\t\tXToolkit.awtLock();");
989 pw.println("\t\ttry {");
990 pw.println("\t\t\tif (__executed) {");
991 pw.println("\t\t\t throw new IllegalStateException(\"Already executed\");");
992 pw.println("\t\t\t}");
993 pw.println("\t\t\t__executed = true;");
994 pw.println("\t\t\tif (errorHandler != null) {");
995 pw.println("\t\t\t XToolkit.WITH_XERROR_HANDLER(errorHandler);");
996 pw.println("\t\t\t}");
997 iter = ft.getArguments().iterator();
998 while (iter.hasNext()) {
999 AtomicType at = (AtomicType)iter.next();
1000 if (!at.isIn() && at.isAutoFree()) {
1001 pw.println("\t\t\tNative.put" + at.getTypeUpperCase() + "(" +at.getName() + "_ptr, 0);");
1002 }
1003 }
1004 if (!ft.isVoid()) {
1005 pw.println("\t\t\t" + ft.getReturnType() + " status = ");
1006 }
1007 pw.println("\t\t\tXlibWrapper." + ft.getName() + "(XToolkit.getDisplay(), ");
1008 iter = ft.getArguments().iterator();
1009 first = true;
1010 while (iter.hasNext()) {
1011 AtomicType at = (AtomicType)iter.next();
1012 if (!first) {
1013 pw.println(",");
1014 }
1015 first = false;
1016 if (at.isIn()) {
1017 pw.print("\t\t\t\tget_" + at.getName() + "()");
1018 } else {
1019 pw.print("\t\t\t\t" + at.getName() + "_ptr");
1020 }
1021 }
1022 pw.println("\t\t\t);");
1023 pw.println("\t\t\tif (errorHandler != null) {");
1024 pw.println("\t\t\t XToolkit.RESTORE_XERROR_HANDLER();");
1025 pw.println("\t\t\t}");
1026 if (!ft.isVoid()) {
1027 pw.println("\t\t\treturn status;");
1028 }
1029 pw.println("\t\t} finally {");
1030 pw.println("\t\t XToolkit.awtUnlock();");
1031 pw.println("\t\t}");
1032 pw.println("\t}");
1033
1034 pw.println("\tpublic boolean isExecuted() {");
1035 pw.println("\t return __executed;");
1036 pw.println("\t}");
1037 pw.println("\t");
1038 pw.println("\tpublic boolean isDisposed() {");
1039 pw.println("\t return __disposed;");
1040 pw.println("\t}");
1041 pw.println("\tpublic void finalize() {");
1042 pw.println("\t dispose();");
1043 pw.println("\t}");
1044
|
1 /*
2 * Copyright (c) 2003, 2013, 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
975
976 pw.println("\tpublic " + ft.getReturnType() + " execute() {");
977 if (ft.isVoid()) {
978 pw.println("\t\texecute(null);");
979 } else {
980 pw.println("\t\treturn execute(null);");
981 }
982 pw.println("\t}");
983
984 pw.println("\tpublic " + ft.getReturnType() + " execute(XToolkit.XErrorHandler errorHandler) {");
985 pw.println("\t\tif (__disposed) {");
986 pw.println("\t\t throw new IllegalStateException(\"Disposed\");");
987 pw.println("\t\t}");
988 pw.println("\t\tXToolkit.awtLock();");
989 pw.println("\t\ttry {");
990 pw.println("\t\t\tif (__executed) {");
991 pw.println("\t\t\t throw new IllegalStateException(\"Already executed\");");
992 pw.println("\t\t\t}");
993 pw.println("\t\t\t__executed = true;");
994 pw.println("\t\t\tif (errorHandler != null) {");
995 pw.println("\t\t\t XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);");
996 pw.println("\t\t\t}");
997 iter = ft.getArguments().iterator();
998 while (iter.hasNext()) {
999 AtomicType at = (AtomicType)iter.next();
1000 if (!at.isIn() && at.isAutoFree()) {
1001 pw.println("\t\t\tNative.put" + at.getTypeUpperCase() + "(" +at.getName() + "_ptr, 0);");
1002 }
1003 }
1004 if (!ft.isVoid()) {
1005 pw.println("\t\t\t" + ft.getReturnType() + " status = ");
1006 }
1007 pw.println("\t\t\tXlibWrapper." + ft.getName() + "(XToolkit.getDisplay(), ");
1008 iter = ft.getArguments().iterator();
1009 first = true;
1010 while (iter.hasNext()) {
1011 AtomicType at = (AtomicType)iter.next();
1012 if (!first) {
1013 pw.println(",");
1014 }
1015 first = false;
1016 if (at.isIn()) {
1017 pw.print("\t\t\t\tget_" + at.getName() + "()");
1018 } else {
1019 pw.print("\t\t\t\t" + at.getName() + "_ptr");
1020 }
1021 }
1022 pw.println("\t\t\t);");
1023 pw.println("\t\t\tif (errorHandler != null) {");
1024 pw.println("\t\t\t XErrorHandlerUtil.RESTORE_XERROR_HANDLER();");
1025 pw.println("\t\t\t}");
1026 if (!ft.isVoid()) {
1027 pw.println("\t\t\treturn status;");
1028 }
1029 pw.println("\t\t} finally {");
1030 pw.println("\t\t XToolkit.awtUnlock();");
1031 pw.println("\t\t}");
1032 pw.println("\t}");
1033
1034 pw.println("\tpublic boolean isExecuted() {");
1035 pw.println("\t return __executed;");
1036 pw.println("\t}");
1037 pw.println("\t");
1038 pw.println("\tpublic boolean isDisposed() {");
1039 pw.println("\t return __disposed;");
1040 pw.println("\t}");
1041 pw.println("\tpublic void finalize() {");
1042 pw.println("\t dispose();");
1043 pw.println("\t}");
1044
|