当前位置: 首页>>代码示例>>Java>>正文


Java VM.println方法代码示例

本文整理汇总了Java中com.sun.squawk.VM.println方法的典型用法代码示例。如果您正苦于以下问题:Java VM.println方法的具体用法?Java VM.println怎么用?Java VM.println使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.squawk.VM的用法示例。


在下文中一共展示了VM.println方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispose

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * Close the library, as in dlclose.
 * @throws RuntimeException if dlcose fails
 */
public void dispose() {
    if (closed || ptr.isZero()) {
        throw new RuntimeException("closed or RTLD_DEFAULT");
    }
    if (DEBUG) {
        VM.print("Calling DLCLOSE on ");
        VM.println(name);
    }
    Pointer name0 = Pointer.createStringBuffer(name);
    int result = VM.execSyncIO(ChannelConstants.DLCLOSE, ptr.toUWord().toInt(), 0, 0, 0, 0, 0, 0, null, null);
    name0.free();
    if (result != 0) {
        throw new RuntimeException("Error on dlclose: " + errorStr());
    }
    closed = true;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:21,代码来源:NativeLibrary.java

示例2: makePlatform

import com.sun.squawk.VM; //导入方法依赖的package包/类
private static Platform makePlatform() {
    if (DEBUG) {
        VM.println("Making Platform...");
    }
    Platform result = (Platform) getInstance(getNativePlatformName());
    if (result == null) {
        result = (Platform) getInstance("Posix");
    }
    if (result != null) {
        if (DEBUG) {
            VM.println("    created platform: " + result);
        }
        return result;
    }
    VM.println("Error in makePlatform for " + getNativePlatformName() + ". Exiting...");
    VM.haltVM(1);
    return null;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:19,代码来源:Platform.java

示例3: getPlatformInstance

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * Create an instance of the class named NATIVE_PLATFORM_NAME . name.
 * If the class can't be found, halt the VM.
 * @param name the leaf name of the class.
 * @return an instance of the class
 */
private static Object getPlatformInstance(String name) {
    Exception e = null;
    String fullname = getPlatformName() + "." + name;
    if (DEBUG) { VM.println("looking for class " + fullname); }
    Klass klass = Klass.lookupKlass(fullname);
    if (klass != null) {
        if (DEBUG) { VM.println("    found class"); }
        Object result = klass.newInstance();
        if (DEBUG) { VM.println("    got instance"); }
        return result;
    }
    VM.println("Error loading platform " + fullname + "\n   " + e);
    VM.stopVM(1);
    return null;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:22,代码来源:Platform.java

示例4: getFunction0

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * Dynamically look up a native function address by name.
 * Look up the symbol in the specified library
 *
 * @param funcName
 * @return address of the function
 * @throws RuntimeException if there is no function by that name.
 */
private Address getFunction0(String funcName) {
    Address result = getSymbolAddress(funcName);
    if (DEBUG) {
        VM.print("Function Lookup for ");
        VM.print(funcName);
        VM.print(" = ");
        VM.printAddress(result);
        VM.println();
    }
    if (result.isZero()) {
        if (Platform.getPlatform().isWindows()) {
            if (funcName.charAt(funcName.length() - 1) != 'A') {
                return getFunction0(funcName + 'A');
            }
        } else if (funcName.charAt(0) != '_') {
            return getFunction0("_" + funcName);
        }
        throw new RuntimeException("Can't find native symbol " + funcName + ". OS Error: " + errorStr());
    }
    return result;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:30,代码来源:NativeLibrary.java

示例5: waitForWriteEvent

import com.sun.squawk.VM; //导入方法依赖的package包/类
public void waitForWriteEvent(int fd) {
    if (DEBUG) { VM.println("waitForWriteEvent fd: " + fd); }
    Assert.that(fd >= 0 && fd < Select.FD_SETSIZE);
    writeSet.add(fd);
    updateSets();
    cancelSelectCall();
    VMThread.waitForOSEvent(fd);// write is ready, select will remove fd from writeSet
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:9,代码来源:SystemEventsImpl.java

示例6: printFDSet

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * Print the FDs taht are set in fd_set
 *
 * @param fd_set the set of file descriptors in native format.
 */
private void printFDSet(Pointer fd_set) {
    for (int i = 0; i < maxFD + 1; i++) {
        if (Select.INSTANCE.FD_ISSET(i, fd_set)) {
            VM.println("    fd: " + i);
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:13,代码来源:SystemEventsImpl.java

示例7: getSymbolAddress

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * getFunction a symbol's address by name (warpper around dlsym)
 * @param name
 * @return Address of symbol
 */
private Address getSymbolAddress(String name) {
    if (closed) {
        throw new IllegalStateException("closed");
    }
    if (DEBUG) {
        VM.print("Calling DLSYM on ");
        VM.println(name);
    }
    Pointer name0 = Pointer.createStringBuffer(name);
    int result = VM.execSyncIO(ChannelConstants.DLSYM, ptr.toUWord().toInt(), name0.address().toUWord().toInt(), 0, 0, 0, 0, null, null);
    name0.free();
    return Address.fromPrimitive(result);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:19,代码来源:NativeLibrary.java

示例8: errorStr

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * Get any error message provided by the platform (as in dlerror). If no error, then return null.
 * 
 * Note that calling this method clears the error state, so calling two times without calling any other 
 * platform getFunction method (getInstance(), getFunction(), getGlobalVariableAddress(), dispose()) will result in returning null.
 * @return String (may be null)
 */
public static String errorStr() {
    if (DEBUG) {
        VM.println("Calling DLERROR");
    }
    int result = VM.execSyncIO(ChannelConstants.DLERROR, 0, 0, 0, 0, 0, 0, null, null);
    Address r = Address.fromPrimitive(result);
    if (r.isZero()) {
        return null;
    } else {
        return Pointer.NativeUnsafeGetString(r);
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:20,代码来源:NativeLibrary.java

示例9: VMprintStruct

import com.sun.squawk.VM; //导入方法依赖的package包/类
/** Debug utility */
private void VMprintStruct() {
    VM.print("Structure(");
    VM.print(Klass.asKlass(getClass()).getInternalName());
    VM.print(" size: ");
    VM.print(size());
    if (backingNativeMemory == null) {
        VM.println(" memory never allocated)");
    } else {
        VM.print(" Pointer(");
        VM.printAddress(getPointer().address());
        VM.println("))");
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:15,代码来源:Structure.java

示例10: printFDSet

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * Print the FDs that are set in fd_set
 *
 * @param fd_set the set of file descriptors in native format.
 */
private void printFDSet(Pointer fd_set) {
    for (int i = 0; i < maxFD + 1; i++) {
        if (select.FD_ISSET(i, fd_set)) {
            VM.print("    fd: ");
            VM.print(i);
            VM.println();
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:15,代码来源:SystemEventsImpl.java

示例11: newError

import com.sun.squawk.VM; //导入方法依赖的package包/类
/** Read errno, try to clean up fd, and create exception. */
private IOException newError(int fd, String msg)  {
    if (DEBUG) {
        VM.print(msg);
        VM.print(": errno: ");
    }
    int err_code = LibCUtil.errno();
    if (DEBUG) {
        VM.print(err_code);
        VM.println();
    }
    sockets.shutdown(fd, 2);
    libc.close(fd);
    return new IOException(" errno: " + err_code + " on fd: " + fd + " during " + msg);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:16,代码来源:GCFSocketsImpl.java

示例12: preamble

import com.sun.squawk.VM; //导入方法依赖的package包/类
protected void preamble() {
    VM.print(toString());
    VM.println(".call...");
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:5,代码来源:BlockingFunction.java

示例13: waitForEvents

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
     * Poll the OS to see if there have been any events on the requested fds.
     * 
     * Try not to allocate if there are no events...
     * @param timeout  md to wait, or 0 for no wait, or Long.MAX_VALUE for inifinite wait
     */
    public void waitForEvents(long timeout) {
        if (DEBUG && !didCheck) {
            doCheck();
        }

        // TODO: reset the cancelSelectCall()  - ie drain the pipe.
        
        setupTempSet(readSet, masterReadSet, tempReadSet);
        setupTempSet(writeSet, masterWriteSet, tempWriteSet);

        Pointer theTimout;

        // Emergency switch in case select() "breaks" (misses wakeups and hangs)
        // This hasn't happenned, but need a fix that can be run in the field.
        if (timeout > max_wait) {
            timeout = max_wait;
        }
        if (timeout == 0) {
            if (DEBUG) { VM.println("WARNING: Why are we polling select??? -----------------------------------------"); }
            theTimout = zeroTime.getPointer();
        } else if (timeout == Long.MAX_VALUE) {
            theTimout = Pointer.NULL();
        } else {
            timeoutTime.tv_sec = timeout / 1000;
            timeoutTime.tv_usec = (timeout % 1000) * 1000;
            timeoutTime.write();
            theTimout = timeoutTime.getPointer();
        }

//      if (readSet.size() != 0) {
//          VM.println("Read FDs set:");
//          printFDSet(tempReadSet);
//      }
//      if (writeSet.size() != 0) {
//          VM.println("Write FDs set:");
//          printFDSet(tempWriteSet);
//      }
        
        if (DEBUG) { VM.println("waitForEvents - before select"); }

        int num = select(maxFD + 1, tempReadSet, tempWriteSet,
                         Pointer.NULL(), theTimout); /* block waiting for event or timeout */
        if (DEBUG) { VM.println("waitForEvents - after select. num = " + num); }
        // TODO : do non-blocking call if timeout == 0
        
        if (num > 0) {
            num = handleEvents(num, readSet, tempReadSet);
            num = handleEvents(num, writeSet, tempWriteSet);
            if (num != 0 && DEBUG) {
                System.err.println("Missed handling a select event?\n num: " + num + "\nreadSize: " + readSet.size() + ", Read FDs set:");
                printFDSet(tempReadSet);
                System.err.println("writeSize: " + writeSet.size() + ", Write FDs set:");
                printFDSet(tempWriteSet);
            }
            updateSets();
        } else if (num < 0) {
            System.err.println("select error: " + LibCUtil.errno());
        } else {
            if (DEBUG) { VM.println("in waitForEvents(), select cancelled"); }
        }
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:68,代码来源:SystemEventsImpl.java


注:本文中的com.sun.squawk.VM.println方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。