Commit 22504b73 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

deprecated old classes

refs 118
parent 6f2ada7f
......@@ -23,6 +23,7 @@ import org.fortiss.af3.project.model.typesystem.impl.ITypeImpl;
/**
* C base type instance, e.g. for type defined in supplementary C libraries.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -32,6 +32,7 @@ import org.fortiss.af3.project.model.typesystem.IType;
/**
* C function model.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -61,9 +62,8 @@ public class Function {
private final ITypeStringGenerator generator;
/** Constructor. */
public Function(Modifier modifier, IType type, String name,
List<Variable> parameters, List<Variable> variables, ITerm body,
ITypeStringGenerator generator) {
public Function(Modifier modifier, IType type, String name, List<Variable> parameters,
List<Variable> variables, ITerm body, ITypeStringGenerator generator) {
this.modifier = modifier;
this.type = type;
this.name = name;
......@@ -74,10 +74,9 @@ public class Function {
}
/** Constructor. */
public Function(Modifier modifier, IType type, String name,
List<Variable> parameters, List<Variable> variables, ITerm body) {
this(modifier, type, name, parameters, variables, body,
new IdentityTypeStringGenerator());
public Function(Modifier modifier, IType type, String name, List<Variable> parameters,
List<Variable> variables, ITerm body) {
this(modifier, type, name, parameters, variables, body, new IdentityTypeStringGenerator());
}
/** Generates forward declaration. */
......@@ -98,11 +97,11 @@ public class Function {
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
if (!EXTERN.equals(modifier)) {
if(!EXTERN.equals(modifier)) {
buf.append(modifierString(modifier));
}
buf.append(getSignature()).append(" {\n");
for (Variable cv : variables) {
for(Variable cv : variables) {
buf.append(cv.toString()).append(";\n");
}
buf.append(body.toString());
......@@ -117,11 +116,11 @@ public class Function {
StringBuffer buf = new StringBuffer();
buf.append(generator.getTypeString(type)).append(' ');
buf.append(name).append('(');
if (!parameters.isEmpty()) {
for (Iterator<Variable> it = parameters.iterator(); it.hasNext();) {
if(!parameters.isEmpty()) {
for(Iterator<Variable> it = parameters.iterator(); it.hasNext();) {
Variable locvar = it.next();
buf.append(locvar.toString());
if (it.hasNext()) {
if(it.hasNext()) {
buf.append(", ");
}
}
......@@ -138,18 +137,14 @@ public class Function {
}
/** Creates external function. */
public static Function createExternFunction(IType type, String name,
List<Variable> parameters, List<Variable> variables, ITerm body,
ITypeStringGenerator generator) {
return new Function(EXTERN, type, name, parameters, variables, body,
generator);
public static Function createExternFunction(IType type, String name, List<Variable> parameters,
List<Variable> variables, ITerm body, ITypeStringGenerator generator) {
return new Function(EXTERN, type, name, parameters, variables, body, generator);
}
/** Creates internal function. */
public static Function createInternFunction(IType type, String name,
List<Variable> parameters, List<Variable> variables, ITerm body,
ITypeStringGenerator generator) {
return new Function(STATIC, type, name, parameters, variables, body,
generator);
public static Function createInternFunction(IType type, String name, List<Variable> parameters,
List<Variable> variables, ITerm body, ITypeStringGenerator generator) {
return new Function(STATIC, type, name, parameters, variables, body, generator);
}
}
......@@ -26,6 +26,7 @@ import org.fortiss.af3.generator.common.model.oldsource.SourceUnitBase;
/**
* Model for C header files.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -43,14 +44,13 @@ public class HeaderFile extends SourceUnitBase {
public String toString() {
StringBuffer buf = new StringBuffer();
String ifdefString = unitName.replaceAll("\\W", "_");
buf.append("/* generated by AutoFOCUS 3 (")
.append(new Date().toString()).append(") */\n");
buf.append("/* generated by AutoFOCUS 3 (").append(new Date().toString()).append(") */\n");
buf.append("#ifndef __HEADER_").append(ifdefString).append('\n');
buf.append("#define __HEADER_").append(ifdefString).append('\n');
for (ImportBase i : importList) {
for(ImportBase i : importList) {
buf.append(i.toString()).append('\n');
}
for (DeclarationBase d : declarationList) {
for(DeclarationBase d : declarationList) {
buf.append(d.toString()).append('\n');
}
buf.append("#endif // __HEADER_").append(ifdefString).append('\n');
......
......@@ -22,6 +22,7 @@ import org.fortiss.af3.project.model.typesystem.IType;
/**
* Extension interface for conversion of IType instances to C code strings.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -22,6 +22,7 @@ import org.fortiss.af3.project.model.typesystem.IType;
/**
* Default type string generator, which uses {@link IType#toString()}.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -24,6 +24,7 @@ import org.fortiss.af3.generator.common.model.oldsource.SourceUnitBase;
/**
* Model for C implementation file.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -40,8 +41,7 @@ public class ImplementationFile extends SourceUnitBase {
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("/* generated by AutoFOCUS 3 (")
.append(new Date().toString()).append(") */\n");
buf.append("/* generated by AutoFOCUS 3 (").append(new Date().toString()).append(") */\n");
buf.append(super.toString());
return buf.toString();
}
......
......@@ -22,6 +22,7 @@ import org.fortiss.af3.generator.common.model.oldsource.ImportBase;
/**
* C header file include.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -20,6 +20,7 @@ package org.fortiss.af3.generator.common.model.oldc;
/**
* C modifier enumeration.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -35,13 +36,13 @@ public enum Modifier {
/** Returns textual modifier. */
public static String modifierString(Modifier modifier) {
switch (modifier) {
case STATIC:
return "static ";
case EXTERN:
return "extern ";
default:
return "";
switch(modifier) {
case STATIC:
return "static ";
case EXTERN:
return "extern ";
default:
return "";
}
}
}
......@@ -22,6 +22,7 @@ import org.fortiss.af3.generator.common.model.oldsource.DeclarationBase;
/**
* Model for <code>#define</code> pre-processor declarations.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -44,7 +45,6 @@ public final class PreProcessorDefine extends DeclarationBase {
/** {@inheritDoc} */
@Override
public String toString() {
return "#ifndef " + key + "\n#define " + key + " " + value
+ "\n#endif\n";
return "#ifndef " + key + "\n#define " + key + " " + value + "\n#endif\n";
}
}
......@@ -26,6 +26,7 @@ import org.fortiss.af3.project.model.typesystem.IType;
/**
* C statically initialized array model.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -28,6 +28,7 @@ import org.fortiss.af3.project.model.typesystem.IType;
/**
* C declaration for typed variables.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -48,8 +49,7 @@ public class Variable {
protected final ITypeStringGenerator generator;
/** Constructor. */
public Variable(Modifier modifier, IType type, String identifier,
ITypeStringGenerator generator) {
public Variable(Modifier modifier, IType type, String identifier, ITypeStringGenerator generator) {
this.modifier = modifier;
this.type = type;
this.identifier = identifier;
......@@ -59,8 +59,7 @@ public class Variable {
/** {@inheritDoc} */
@Override
public String toString() {
return Modifier.modifierString(modifier)
+ generator.getTypeString(type) + ' ' + identifier;
return Modifier.modifierString(modifier) + generator.getTypeString(type) + ' ' + identifier;
}
/** Returns C variable declaration. */
......@@ -81,10 +80,8 @@ public class Variable {
return new DefinitionBase() {
@Override
public String toString() {
String mod = EXTERN.equals(modifier) ? ""
: modifierString(modifier);
return mod + generator.getTypeString(type) + ' ' + identifier
+ ";\n";
String mod = EXTERN.equals(modifier) ? "" : modifierString(modifier);
return mod + generator.getTypeString(type) + ' ' + identifier + ";\n";
}
};
}
......
......@@ -23,6 +23,7 @@ import org.fortiss.af3.project.model.typesystem.impl.ITypeImpl;
/**
* C void type {@link IType} instance.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -21,6 +21,7 @@ package org.fortiss.af3.generator.common.model.oldsource;
* Model class for declarations such as C function forward declarations or Java
* class attributes.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -28,4 +29,4 @@ package org.fortiss.af3.generator.common.model.oldsource;
*/
public abstract class DeclarationBase {
// implementation is language-specific
}
\ No newline at end of file
}
......@@ -21,6 +21,7 @@ package org.fortiss.af3.generator.common.model.oldsource;
* Model class for definitions such as C function implementations or Java
* methods.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -23,6 +23,7 @@ package org.fortiss.af3.generator.common.model.oldsource;
* source package is written to disk each unit is asked to provide its content
* (via {@link SourceUnitBase#toString()}) and format it (via
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -18,9 +18,10 @@ $Id$
package org.fortiss.af3.generator.common.model.oldsource;
/**
* Base class for import declarations such as <code>import</code> in Java or
* <code>#include</code> in C.
* Base class for import declarations such as <code>import</code> in Java or <code>#include</code>
* in C.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -28,6 +28,7 @@ import java.util.Set;
/**
* Model class for source packages, i.e., collections of source units.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
......@@ -23,6 +23,7 @@ import java.util.List;
/**
* Model class for a unit of source code.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......@@ -72,8 +73,7 @@ public abstract class SourceUnitBase {
/**
* Returns the source unit's code formatter. Sub-classes may override, but
* must not return
* <code>null<code>. The default does not format the content.
* must not return <code>null<code>. The default does not format the content.
*/
protected IFormatter getFormatter() {
return new IFormatter() {
......@@ -102,13 +102,13 @@ public abstract class SourceUnitBase {
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
for (ImportBase ib : importList) {
for(ImportBase ib : importList) {
buf.append(ib.toString()).append('\n');
}
for (DeclarationBase db : declarationList) {
for(DeclarationBase db : declarationList) {
buf.append(db.toString()).append('\n');
}
for (DefinitionBase db : definitionList) {
for(DefinitionBase db : definitionList) {
buf.append(db.toString()).append('\n');
}
return buf.toString();
......
......@@ -21,6 +21,7 @@ package org.fortiss.af3.generator.common.model.oldsource;
* A {@link SourecUnitFilter} is used to filter source units contained in source
* packages.
*
* @deprecated
* @author hoelzl
* @author $Author$
* @version $Rev$
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment