summaryrefslogtreecommitdiff
path: root/numpy/f2py/lib/parser/base_classes.py
diff options
context:
space:
mode:
authorPearu Peterson <pearu.peterson@gmail.com>2006-10-06 04:57:17 +0000
committerPearu Peterson <pearu.peterson@gmail.com>2006-10-06 04:57:17 +0000
commit2c406001966f201617c463633dc1ab67d396d0c0 (patch)
tree43c026ed7f23302a040895da8276db38fa4a3df9 /numpy/f2py/lib/parser/base_classes.py
parent30cdb1624fe86b26b480b4c262ae1c8a24ab35d8 (diff)
downloadnumpy-2c406001966f201617c463633dc1ab67d396d0c0.tar.gz
F2PY G3: fixed bugs, started adding features.
Diffstat (limited to 'numpy/f2py/lib/parser/base_classes.py')
-rw-r--r--numpy/f2py/lib/parser/base_classes.py37
1 files changed, 35 insertions, 2 deletions
diff --git a/numpy/f2py/lib/parser/base_classes.py b/numpy/f2py/lib/parser/base_classes.py
index 76a26b666..e79584ca5 100644
--- a/numpy/f2py/lib/parser/base_classes.py
+++ b/numpy/f2py/lib/parser/base_classes.py
@@ -229,6 +229,39 @@ class Variable:
'POINTER', 'PROTECTED', 'SAVE', 'TARGET', 'VALUE',
'VOLATILE', 'REQUIRED']
+ def is_intent_in(self):
+ if not self.intent: return True
+ if 'HIDE' in self.intent: return False
+ if 'INPLACE' in self.intent: return False
+ if 'IN' in self.intent: return True
+ if 'OUT' in self.intent: return False
+ if 'INOUT' in self.intent: return False
+ if 'OUTIN' in self.intent: return False
+ return True
+
+ def is_intent_inout(self):
+ if 'INOUT' in self.intent:
+ if 'IN' in self.intent or 'HIDE' in self.intent or 'INPLACE' in self.intent:
+ self.warning('INOUT ignored in INPUT(%s)' % (', '.join(self.intent)))
+ return False
+ return True
+ return False
+
+ def is_intent_hide(self):
+ if 'HIDE' in self.intent: return True
+ if 'OUT' in self.intent:
+ return 'IN' not in self.intent and 'INPLACE' not in self.intent and 'INOUT' not in self.intent
+ return False
+
+ def is_intent_inplace(self): return 'INPLACE' in self.intent
+ def is_intent_out(self): return 'OUT' in self.intent
+ def is_intent_c(self): return 'C' in self.intent
+ def is_intent_cache(self): return 'CACHE' in self.intent
+ def is_intent_copy(self): return 'COPY' in self.intent
+ def is_intent_overwrite(self): return 'OVERWRITE' in self.intent
+ def is_intent_callback(self): return 'CALLBACK' in self.intent
+ def is_intent_aux(self): return 'AUX' in self.intent
+
def is_private(self):
if 'PUBLIC' in self.attributes: return False
if 'PRIVATE' in self.attributes: return True
@@ -242,8 +275,8 @@ class Variable:
def is_external(self): return 'EXTERNAL' in self.attributes
def is_intrinsic(self): return 'INTRINSIC' in self.attributes
def is_parameter(self): return 'PARAMETER' in self.attributes
- def is_optional(self): return 'OPTIONAL' in self.attributes
- def is_required(self): return 'REQUIRED' in self.attributes
+ def is_optional(self): return 'OPTIONAL' in self.attributes and 'REQUIRED' not in self.attributes and not self.is_intent_hide()
+ def is_required(self): return self.is_optional() and not self.is_intent_hide()
def is_pointer(self): return 'POINTER' in self.attributes
def is_array(self): return not not (self.bounds or self.dimension)