diff options
author | Sven Gothel <[email protected]> | 2013-06-20 20:06:35 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-06-20 20:06:35 +0200 |
commit | f69831574d4927d03d40c330d0b047d8c89622a4 (patch) | |
tree | 7d8b7f272422c438a106a344a2afec23529652e6 /src/java/com/jogamp/gluegen/procaddress | |
parent | 8cabcd2de8b46c42dffcaaf46ccc2dc4d092ebba (diff) |
ProcAddressTable: Make all handles package private, use local PROCADDRESS_VAR_PREFIX instance, add checkAllPermissions() for reset() and initEntry(..)
- Generated ProcAddressTable's function handles are all package private
- Generated ProcAddressTable's visibility can be set via 'AccessControl' config, default: public.
- ProcAddressTable's reset() and initEntry(..) perform checkAllPermissions() 1st.
Diffstat (limited to 'src/java/com/jogamp/gluegen/procaddress')
-rw-r--r-- | src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java index e6b3b6f..57b29e9 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2013 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -67,7 +68,8 @@ import com.jogamp.gluegen.runtime.ProcAddressTable; */ public class ProcAddressEmitter extends JavaEmitter { - public static final String PROCADDRESS_VAR_PREFIX = ProcAddressTable.PROCADDRESS_VAR_PREFIX; + /** Must be synchronized w/ ProcAddressTable.PROCADDRESS_VAR_PREFIX !!! */ + public static final String PROCADDRESS_VAR_PREFIX = "_addressof_"; protected static final String WRAP_PREFIX = "dispatch_"; private TypeDictionary typedefDictionary; protected PrintWriter tableWriter; @@ -297,15 +299,19 @@ public class ProcAddressEmitter extends JavaEmitter { } protected void beginProcAddressTable() throws Exception { - tableClassPackage = getProcAddressConfig().tableClassPackage(); - tableClassName = getProcAddressConfig().tableClassName(); + final ProcAddressConfiguration cfg = getProcAddressConfig(); + tableClassPackage = cfg.tableClassPackage(); + tableClassName = cfg.tableClassName(); // Table defaults to going into the impl directory unless otherwise overridden String implPackageName = tableClassPackage; if (implPackageName == null) { implPackageName = getImplPackageName(); } - String jImplRoot = getJavaOutputDir() + File.separator + CodeGenUtils.packageAsPath(implPackageName); + final String fullTableClassName = implPackageName + "." + tableClassName; + final MethodAccess tableClassAccess = cfg.accessControl(fullTableClassName); + + final String jImplRoot = getJavaOutputDir() + File.separator + CodeGenUtils.packageAsPath(implPackageName); tableWriter = openFile(jImplRoot + File.separator + tableClassName + ".java", tableClassName); emittedTableEntries = new HashSet<String>(); @@ -318,13 +324,14 @@ public class ProcAddressEmitter extends JavaEmitter { tableWriter.println("import " + imporT + ";"); } tableWriter.println("import " + ProcAddressTable.class.getName() + ";"); + tableWriter.println("import com.jogamp.common.util.SecurityUtil;"); tableWriter.println(); tableWriter.println("/**"); tableWriter.println(" * This table is a cache of pointers to the dynamically-linkable C library."); tableWriter.println(" * @see " + ProcAddressTable.class.getSimpleName()); tableWriter.println(" */"); - tableWriter.println("public class " + tableClassName + " extends "+ ProcAddressTable.class.getSimpleName() + " {"); + tableWriter.println(tableClassAccess.getJavaName() + " final class " + tableClassName + " extends "+ ProcAddressTable.class.getSimpleName() + " {"); tableWriter.println(); for (String string : getProcAddressConfig().getForceProcAddressGen()) { @@ -352,7 +359,7 @@ public class ProcAddressEmitter extends JavaEmitter { return; } emittedTableEntries.add(str); - tableWriter.print(" public long "); + tableWriter.print(" /* pp */ long "); tableWriter.print(PROCADDRESS_VAR_PREFIX); tableWriter.print(str); tableWriter.println(";"); |