Commit 28001372 authored by Leonard Faecke's avatar Leonard Faecke
Browse files

+ Added analysis of external function definition

parent a5245844
Loading
Loading
Loading
Loading
+41 −4
Original line number Diff line number Diff line
@@ -499,13 +499,50 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	}
	
	/**
	 * Analyzes a ext function definition. Currently just a skeleton
	 * @param fun The ext function definition to be analyzed
	 * Analyzes an external function definition. Currently just a skeleton
	 * @param fun The external function definition to be analyzed
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeExtFunctionDef(ExtFunctionDef fun, TTCN3Usage output) {
		addToOutput(output, "ExtFunction");
		//TODO everything
System.out.println("Analyzing function");
		
		String fName = fun.getName();
		System.out.println("Analyzing external function: " + fName);
		
		// Return type:
		String id = "ExtFunctionReturn:";
		if(fun.getReturn() != null) {
			if(fun.getReturn().getType().getPre() == null) {
				id += "Non-Primitive";
				addToOutput(output, id + ":" + fun.getReturn().getType().getRef().getHead());
			} else id += fun.getReturn().getType().getPre();
		} else {
			id += "void";
		}
		addToOutput(output, id);
		
		// Parameters per function and types:
		if(fun.getList() != null) {
			EList<FunctionFormalPar> params = fun.getList().getParams();
			for(FunctionFormalPar p : params) {
				id = "FunctionParam:";
				if(p.getValue() == null) {
					id += "NoVal";
				} else {
					if(p.getValue().getType().getPre() == null) {
						id += "Non-Primitive";
						addToOutput(output, id + ":" + p.getValue().getType().getRef().getHead());
					} else {
						id += p.getValue().getType().getPre();
					}
				}
				addToOutput(output, id);
			}
			id = fun.getList().getParams().size()+"ParamsInFunction";
		} else {
			id = "0ParamsInFunction";
		}
		addToOutput(output, id);
	}
	
	/**