44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
/******************************************************************************
|
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
* All rights reserved. This program and the accompanying materials
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
* which accompanies this distribution, and is available at
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
*
|
|
* Contributors:
|
|
* IBM Corporation - initial API and implementation
|
|
*****************************************************************************/
|
|
package com.ibm.wala.cast.ir.translator;
|
|
|
|
import com.ibm.wala.cast.tree.CAst;
|
|
import com.ibm.wala.ide.plugin.CorePlugin;
|
|
|
|
/**
|
|
* superclass for CAst parsers / translators making use of native code. performs
|
|
* initialization of the core CAst native library.
|
|
*/
|
|
public abstract class NativeBridge {
|
|
|
|
protected final CAst Ast;
|
|
|
|
protected static boolean isInitialized;
|
|
|
|
protected NativeBridge(CAst Ast) {
|
|
this.Ast = Ast;
|
|
}
|
|
|
|
/**
|
|
* initialize the CAst native library
|
|
*/
|
|
protected static native void initialize();
|
|
|
|
static {
|
|
isInitialized = false;
|
|
if (CorePlugin.IS_RESOURCES_BUNDLE_AVAILABLE) {
|
|
System.loadLibrary("cast");
|
|
initialize();
|
|
isInitialized = true;
|
|
}
|
|
}
|
|
}
|