From 9b4322ce440f4d7a657044321914a0b848efb218 Mon Sep 17 00:00:00 2001 From: Francis Russell Date: Wed, 28 Mar 2012 18:30:37 +0100 Subject: [PATCH] Work on building types for code generation. --- src/ofc/codegen/IterationTemplate.scala | 2 +- src/ofc/codegen/LoopRange.scala | 4 ++++ src/ofc/codegen/Record.scala | 3 +++ src/ofc/codegen/Statement.scala | 4 ++++ src/ofc/codegen/Symbol.scala | 1 + src/ofc/codegen/Type.scala | 3 +++ src/ofc/generators/onetep/PPDFunctionSet.scala | 6 ++++++ 7 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/ofc/codegen/LoopRange.scala create mode 100644 src/ofc/codegen/Record.scala create mode 100644 src/ofc/codegen/Statement.scala create mode 100644 src/ofc/codegen/Type.scala diff --git a/src/ofc/codegen/IterationTemplate.scala b/src/ofc/codegen/IterationTemplate.scala index 723c045..c7ea71e 100644 --- a/src/ofc/codegen/IterationTemplate.scala +++ b/src/ofc/codegen/IterationTemplate.scala @@ -1,4 +1,4 @@ package ofc.codegen -class IterationTemplate { +class IterationTemplate(statement: Statement) { } diff --git a/src/ofc/codegen/LoopRange.scala b/src/ofc/codegen/LoopRange.scala new file mode 100644 index 0000000..985b09e --- /dev/null +++ b/src/ofc/codegen/LoopRange.scala @@ -0,0 +1,4 @@ +package ofc.codegen + +class LoopRange(index: VariableSymbol, start: Expression, count: Expression, statement: Statement) extends Statement { +} diff --git a/src/ofc/codegen/Record.scala b/src/ofc/codegen/Record.scala new file mode 100644 index 0000000..c8341a1 --- /dev/null +++ b/src/ofc/codegen/Record.scala @@ -0,0 +1,3 @@ +package ofc.codegen + +class RecordType extends Type diff --git a/src/ofc/codegen/Statement.scala b/src/ofc/codegen/Statement.scala new file mode 100644 index 0000000..4028f7d --- /dev/null +++ b/src/ofc/codegen/Statement.scala @@ -0,0 +1,4 @@ +package ofc.codegen + +trait Statement +class NullStatement extends Statement diff --git a/src/ofc/codegen/Symbol.scala b/src/ofc/codegen/Symbol.scala index 424c052..5993e19 100644 --- a/src/ofc/codegen/Symbol.scala +++ b/src/ofc/codegen/Symbol.scala @@ -1,3 +1,4 @@ package ofc.codegen class Symbol(name: String) +class VariableSymbol(name: String) extends Symbol(name) diff --git a/src/ofc/codegen/Type.scala b/src/ofc/codegen/Type.scala new file mode 100644 index 0000000..0094ef0 --- /dev/null +++ b/src/ofc/codegen/Type.scala @@ -0,0 +1,3 @@ +package ofc.codegen + +trait Type diff --git a/src/ofc/generators/onetep/PPDFunctionSet.scala b/src/ofc/generators/onetep/PPDFunctionSet.scala index ebd2537..37a771d 100644 --- a/src/ofc/generators/onetep/PPDFunctionSet.scala +++ b/src/ofc/generators/onetep/PPDFunctionSet.scala @@ -1,6 +1,12 @@ package ofc.generators.onetep +import ofc.codegen._ class PPDFunctionSet(val basis : String, data : String) extends FunctionSet { + def getReader = { + new IterationTemplate(new NullStatement()) + } + def getDiscreteIndices = List.empty + def getSpatialIndices = List.empty /* class SphereIndex(parent: PPDFunctionSet) extends DiscreteIndex { def getName = "sphere_index" -- 2.47.3