- Timestamp:
- 12/13/05 10:44:11 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt/src/org/modelica/mdt/internal/omcproxy/OMCProxy.java
r204 r210 54 54 import org.modelica.mdt.core.IModelicaClass; 55 55 import org.modelica.mdt.core.IModelicaClass.Type; 56 import org.modelica.mdt.internal.core.ElementLocation; 56 57 import org.omg.CORBA.ORB; 57 58 … … 59 60 * The OMCProxy is the glue between the OpenModelica Compiler and MDT. 60 61 * It uses the interactive API of OMC to get information about classes 61 * and to load classes into OMC. 62 * and to load classes into OMC. 63 * 62 64 * @author Andreas Remar 63 *64 65 */ 65 66 public class OMCProxy … … 708 709 709 710 String[] tokens = ProxyParser.parseSimpleList(retval); 710 int line , column;711 int line; 711 712 712 713 try 713 714 { 714 715 line = Integer.parseInt(tokens[1]); 715 column = Integer.parseInt(tokens[2]);716 716 } 717 717 catch (NumberFormatException e) … … 721 721 } 722 722 723 return new ElementLocation(tokens[0], line , column);723 return new ElementLocation(tokens[0], line); 724 724 } 725 725 … … 739 739 740 740 /** 741 * NOT IMPLEMENTED742 * This function returns the info about this element that getElementsInfo743 * returns.. somehow744 741 * @param className 745 742 * @return 746 743 * @throws ConnectionException 747 */ 748 public static ElementsInfo getElementsInfo(String className) 749 throws ConnectionException 750 { 751 // TODO actually return real elements info.. 744 * @throws InvocationError 745 * @throws UnexpectedReplyException 746 */ 747 public static Vector<Object> getElementsInfo(String className) 748 throws ConnectionException, InvocationError, UnexpectedReplyException 749 { 752 750 String retval = sendExpression("getElementsInfo("+ className +")"); 753 Vector<Object> v = ProxyParser.parseList(retval); 754 System.out.println(v); 755 756 return new ElementsInfo(); 751 752 /* 753 * we need a efficient way to check if the result is 754 * humongosly huge list or 'Error' or maybe 'error' 755 */ 756 for (int i = 0; i < retval.length(); i++) 757 { 758 if (retval.charAt(i) == '{') 759 { 760 /* we found the begining of the list, let's hope for the best */ 761 return ProxyParser.parseList(retval); 762 } 763 else if (retval.charAt(i) == 'E' || retval.charAt(i) == 'e') 764 { 765 /* 766 * this is the unreadable way to check if the retval 767 * equals 'Error' or 'error' 768 */ 769 if (retval.substring(i+1,i+5).equals("rror")) 770 { 771 throw new InvocationError("getElementsInfo("+ className +")" + 772 " replays 'error'"); 773 } 774 else 775 { 776 /* OMC returned someting wierd, panic mode ! */ 777 break; 778 } 779 } 780 } 781 /* we have no idea what OMC returned */ 782 throw new UnexpectedReplyException("getElementsInfo("+ className +")" + 783 "replays:'" + retval + "'"); 784 757 785 } 758 786 }
Note: See TracChangeset
for help on using the changeset viewer.