@@ -890,15 +890,7 @@ algorithm
890890 fn_name := getApiFunctionNameInfo(inStatement);
891891 p := SymbolTable . getAbsyn();
892892 args := getApiFunctionArgs(inStatement);
893-
894- outResult := match(fn_name)
895- case "getDefinitions"
896- algorithm
897- {Absyn . BOOL (addFunctions)} := args;
898- then
899- getDefinitions(p, addFunctions);
900-
901- end match;
893+ fail();
902894end evaluateGraphicalApi_dispatch;
903895
904896protected function extractAllComponentreplacements
@@ -10464,63 +10456,34 @@ end transformFlatElseIfAlgorithm;
1046410456
1046510457/* Start getDefinitions */
1046610458
10467- protected function getDefinitions
10459+ public function getDefinitions
1046810460"This function dumps the defined packages, classes and functions to a string.
1046910461 The function is used by org.openmodelica.corba.parser.DefinitionsCreator."
1047010462 input Absyn . Program ast "The AST to dump" ;
1047110463 input Boolean addFunctions;
10472- output String res "An easily parsed string containing all definitions" ;
10464+ output Values . Value res "An easily parsed string containing all definitions" ;
10465+ protected
10466+ list< Absyn . Class > classes;
10467+ list< String > toPrint;
10468+ Integer handle;
10469+ Absyn . Class cl;
1047310470algorithm
10474- res := match (ast,addFunctions)
10475- local
10476- list< Absyn . Class > classes;
10477- list< String > toPrint;
10478- Integer handle;
10479- Absyn . Class cl;
10471+ Absyn . PROGRAM (classes = classes) := MetaUtil . createMetaClassesInProgram(ast);
10472+ handle := Print . saveAndClearBuf();
10473+ Print . printBuf("( \n " );
1048010474
10481- case (_,_)
10482- equation
10483- Absyn . PROGRAM (classes = classes) = MetaUtil . createMetaClassesInProgram(ast);
10484- handle = Print . saveAndClearBuf();
10485- Print . printBuf(" \" ( \n " );
10486- toPrint = getDefinitions2(classes,addFunctions);
10487- List . map_0(toPrint, printWithNewline);
10488- cl = InteractiveUtil . getPathedClassInProgram(Absyn . IDENT ("SourceInfo" ), ast);
10489- toPrint = getDefinitions2({cl},false );
10490- List . map_0(toPrint, printWithNewline);
10491- Print . printBuf(" \n ) \" " );
10492- res = Print . getString();
10493- Print . restoreBuf(handle);
10494- then res;
10475+ for c in classes loop
10476+ Print . printBuf(getDefinitionsClass(c, addFunctions));
10477+ Print . printBufNewLine();
10478+ end for ;
1049510479
10496- end match;
10480+ cl := InteractiveUtil . getPathedClassInProgram(Absyn . IDENT ("SourceInfo" ), ast);
10481+ Print . printBuf(getDefinitionsClass(cl, false ));
10482+ Print . printBuf(" \n\n )" );
10483+ res := ValuesUtil . makeString(Print . getString());
10484+ Print . restoreBuf(handle);
1049710485end getDefinitions;
1049810486
10499- protected function printWithNewline
10500- input String s;
10501- algorithm
10502- Print . printBuf(s);
10503- Print . printBuf(" \n " );
10504- end printWithNewline;
10505-
10506- protected function getDefinitions2
10507- input list< Absyn . Class > classes;
10508- input Boolean addFunctions;
10509- output list< String > res;
10510- algorithm
10511- res := match (classes,addFunctions)
10512- local
10513- list< Absyn . Class > rest;
10514- Absyn . Class class_;
10515- String str;
10516- case ({},_) then {};
10517- case (class_::rest,_) equation
10518- str = getDefinitionsClass(class_, addFunctions);
10519- res = getDefinitions2(rest, addFunctions);
10520- then str::res;
10521- end match;
10522- end getDefinitions2;
10523-
1052410487protected function getDefinitionsClass
1052510488 input Absyn . Class class_;
1052610489 input Boolean addFunctions;
@@ -10614,11 +10577,9 @@ protected function getDefinitionPathString
1061410577 input Absyn . Path path;
1061510578 output String out;
1061610579algorithm
10617- out := match (path)
10618- // Doesn't work because we only know the AST after parsing... case (Absyn.FULLYQUALIFIED(path)) then "#" + AbsynUtil.pathString(path);
10619- // Thus, scope/lookup is done by the application recieving this information
10620- case _ then AbsynUtil . pathString(path);
10621- end match;
10580+ // Doesn't work because we only know the AST after parsing... case (Absyn.FULLYQUALIFIED(path)) then "#" + AbsynUtil.pathString(path);
10581+ // Thus, scope/lookup is done by the application recieving this information
10582+ out := AbsynUtil . pathString(path);
1062210583end getDefinitionPathString;
1062310584
1062410585public function getDefinitionTypeSpecPathString
@@ -10726,10 +10687,10 @@ protected function getDefinitionDirString
1072610687 input Boolean isFunction;
1072710688 output String res;
1072810689algorithm
10729- res := match (dir, variability, isFunction)
10730- case (Absyn . INPUT (),_, true ) then "input " ;
10731- case (Absyn . OUTPUT (),_, true ) then "output " ;
10732- case (_, _, false )
10690+ res := match (dir, isFunction)
10691+ case (Absyn . INPUT (),true ) then "input " ;
10692+ case (Absyn . OUTPUT (),true ) then "output " ;
10693+ case (_, false )
1073310694 equation
1073410695 failure(Absyn . CONST () = variability);
1073510696 then "" ;
@@ -10743,21 +10704,21 @@ protected function getDefinitionComponents
1074310704 input list< Absyn . ComponentItem > components;
1074410705 output list< String > res;
1074510706algorithm
10746- res := matchcontinue (typeStr,dirStr,numDim, components)
10707+ res := matchcontinue components
1074710708 local
1074810709 list< Absyn . ComponentItem > rest;
1074910710 String ident;
1075010711 list< Absyn . Subscript > l;
1075110712 Integer sumDim;
1075210713
10753- case (_,_,_,{}) then {};
10754- case (_,_,_, Absyn . COMPONENTITEM (component = Absyn . COMPONENT (name = ident, arrayDim = l))::rest) equation
10714+ case {} then {};
10715+ case Absyn . COMPONENTITEM (component = Absyn . COMPONENT (name = ident, arrayDim = l))::rest equation
1075510716 sumDim = numDim + listLength(l);
1075610717 ident = dirStr + (if numDim == 0 then "" else ("[" + intString(sumDim))) + typeStr + " " + ident;
1075710718 ident = "(" + ident + ")" ;
1075810719 res = getDefinitionComponents(typeStr,dirStr,numDim,rest);
1075910720 then ident :: res;
10760- case (_,_,_,_:: rest) then getDefinitionComponents(typeStr,dirStr,numDim,rest);
10721+ case rest then getDefinitionComponents(typeStr,dirStr,numDim,rest);
1076110722 end matchcontinue;
1076210723end getDefinitionComponents;
1076310724
0 commit comments