Ignore:
Timestamp:
02/16/06 13:29:00 (19 years ago)
Author:
remar
Message:

org.modelica.mdt.core

fixed a comment, removed some debug printouts

org.modelica.mdt.omc

getErrorString() is called after every call to sendExpression()

org.modelica.mdt.ui

beutification fixes

org.modelica.mdt.test

added some assertions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.mdt.omc/src/org/modelica/mdt/omc/OMCProxy.java

    r317 r325  
    9191
    9292    private String[] standardLibraryPackages = { "Modelica" };
    93    
     93
    9494    /* should we trace the calls to sendExpression? */
    9595    private static boolean traceOMCCalls = false;
     
    484484            return;
    485485        }
    486         System.out.println(message);
     486        System.out.println("OMCSTATUS: " + message);
    487487    }
    488488
     
    527527        String retval = sendExpression("getClassNames("+className+")");
    528528       
     529        /* fetch error string but ignore it */
     530        getErrorString();
     531       
    529532        return ModelicaParser.parseList(retval);
    530533    }
     
    547550        reply = reply.trim();
    548551        reply = reply.substring(1, reply.length()-1);
     552       
     553        /* fetch error string but ignore it */
     554        getErrorString();
    549555       
    550556        return IModelicaClass.Type.parse(reply);
     
    586592        ParseResults res = new ParseResults();
    587593
    588         // We need to call this to empty the error queue in OMC
    589         sendExpression("getMessagesString()");
    590        
    591594        String fullName = file.getLocation().toString();
    592595        String retval =
    593596            sendExpression("loadFileInteractiveQualified(\"" + fullName + "\")");
    594597       
    595         String errorString = sendExpression("getMessagesString()");
     598        /* Always keep your stuff nice and tidy! */
     599        retval = retval.trim();
    596600       
    597601        /*
    598          * See if there were parse errors
    599          */
    600         if(retval.toLowerCase().contains("error"))
     602         * See if there were parse errors, an empty list {} also denotes error
     603         */
     604        if(retval.toLowerCase().contains("error") || retval.equals("{}"))
    601605        {           
    602606            res.setCompileErrors
     
    614618        /*
    615619         * If there were errors, but the compilation went through,
    616          * collect the error messages. (Test if errorString == "")
    617          */
    618         errorString = errorString.trim();
    619         if(errorString.equals("\"\"") == false)
    620         {
    621             errorString = errorString.substring(1, errorString.length() - 1);
     620         * collect the error messages. (Test if errorString != "")
     621         */
     622        String errorString = getErrorString();
     623        System.out.println("errorString: -->" + errorString + "<--");
     624        if(errorString.equals("") == false)
     625        {
     626//          errorString = errorString.trim();
     627//          errorString = errorString.substring(1, errorString.length() - 1);
     628            System.out.println("setCompileErrors!!!");
    622629            res.setCompileErrors(OMCParser.parseErrorString(errorString));
    623630        }
     
    641648        String retval = sendExpression("getCrefInfo(" + className + ")");
    642649       
     650        /* fetch error string but ignore it */
     651        getErrorString();
     652       
    643653        if(retval.contains("Error") || retval.contains("error"))
    644654        {
     
    680690        {
    681691            throw new
    682                 UnexpectedReplyException("can't parse getCrefInfo() reply, "+
    683                         "unexpected format");
     692                UnexpectedReplyException("Can't parse getCrefInfo() reply, "+
     693                                         "unexpected format");
    684694        }
    685695       
     
    699709    {
    700710        String retval = sendExpression("isPackage(" + className + ")");
     711
     712        /* fetch error string but ignore it */
     713        getErrorString();
     714       
    701715        return retval.contains("true");
    702716    }
     
    706720    {
    707721        String retval = sendExpression("getElementsInfo("+ className +")");
     722       
     723        /* fetch error string but ignore it */
     724        getErrorString();
    708725       
    709726        /*
     
    774791        {
    775792            sendExpression("loadModel(Modelica)");
     793           
     794            /* fetch error string but ignore it */
     795            getErrorString();
     796           
    776797            systemLibraryLoaded = true;
    777798        }
Note: See TracChangeset for help on using the changeset viewer.