Package henplus

Examples of henplus.HenPlus


        final StringTokenizer st = new StringTokenizer(param);
        final int argc = st.countTokens();
        if (argc < 1) {
            return SYNTAX_ERROR;
        }
        final HenPlus henplus = HenPlus.getInstance();
        while (st.hasMoreElements()) {
            int commandCount = 0;
            final String filename = (String) st.nextElement();
            final long startTime = System.currentTimeMillis();
            File currentFile = null;
            try {
                henplus.pushBuffer();
                henplus.getDispatcher().startBatch();
                File f = openFile(filename);
                f = f.getCanonicalFile();
                if (_openFiles.contains(f)) {
                    throw new IOException("recursive inclusion alert: skipping file " + f.getName());
                }
                HenPlus.msg().println(f.getName());
                currentFile = f;
                _openFiles.add(currentFile);
                _cwdStack.push(currentFile.getParentFile());
                final String encoding = System.getProperty("file.encoding"); //"UTF-8"
                final FileInputStream is = new FileInputStream(currentFile);
                final BufferedReader reader = new BufferedReader(new InputStreamReader(is, encoding));
                _running = true;
                SigIntHandler.getInstance().pushInterruptable(this);
                String line;
                while (_running && (line = reader.readLine()) != null) {
                    final byte execResult = henplus.executeLine(line);
                    if (execResult == HenPlus.LINE_EXECUTED) {
                        ++commandCount;
                    }
                }
            } catch (final Exception e) {
                // e.printStackTrace();
                HenPlus.msg().println(e.getMessage());
                if (st.hasMoreElements()) {
                    HenPlus.msg().println("..skipping to next file.");
                    continue;
                }
                return EXEC_FAILED;
            } finally {
                henplus.popBuffer(); // no open state ..
                if (!_running) {
                    HenPlus.msg().println("cancel file loading " + currentFile);
                }
                henplus.getDispatcher().endBatch();
                if (currentFile != null) {
                    _openFiles.remove(currentFile);
                    _cwdStack.pop();
                }
                SigIntHandler.getInstance().popInterruptable();
View Full Code Here

TOP

Related Classes of henplus.HenPlus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.