| 1 | #---------------------------------------------------------------------------- |
| 2 | # Name: lang.py |
| 3 | # Purpose: Active grid language specific utilities -- provides portability |
| 4 | # for common idiom's that have language specific implementations |
| 5 | # |
| 6 | # Author: Jeff Norton |
| 7 | # |
| 8 | # Created: 04/27/05 |
| 9 | # CVS-ID: $Id$ |
| 10 | # Copyright: (c) 2004-2005 ActiveGrid, Inc. |
| 11 | # License: wxWindows License |
| 12 | #---------------------------------------------------------------------------- |
| 13 | |
| 14 | def isMain(caller): |
| 15 | return caller == '__main__' |
| 16 | |
| 17 | def ag_className(obj): |
| 18 | return obj.__class__.__name__ |
| 19 | |
| 20 | def asDict(src): |
| 21 | return src |
| 22 | |
| 23 | def asList(src): |
| 24 | return src |
| 25 | |
| 26 | def asTuple(src): |
| 27 | return src |
| 28 | |
| 29 | def asString(src): |
| 30 | return src |
| 31 | |
| 32 | def asInt(src): |
| 33 | return src |
| 34 | |
| 35 | def asBool(src): |
| 36 | return src |
| 37 | |
| 38 | def asObject(src): |
| 39 | return src |
| 40 | |
| 41 | def cast(src, type): |
| 42 | return src |
| 43 | |
| 44 | def asRef(src): |
| 45 | return src |
| 46 | |
| 47 | def asClass(src): |
| 48 | return src |
| 49 | |
| 50 | def localize(text): |
| 51 | return text |
| 52 | |
| 53 | # Pass in Python code as a string. The cross-compiler will convert to PHP |
| 54 | # and in-line the result. |
| 55 | def pyToPHP(expr): |
| 56 | pass |
| 57 | |
| 58 | # Pass in PHP code as a string. The cross-compiler will drop it in-line verbatim. |
| 59 | def PHP(expr): |
| 60 | pass |
| 61 | |
| 62 | # Bracket Python only code. The Cross-compiler will ignore the bracketed code. |
| 63 | def ifDefPy(comment=False): |
| 64 | pass |
| 65 | |
| 66 | def endIfDef(): |
| 67 | pass |
| 68 | |
| 69 | def ag_isPHP(): |
| 70 | return False |
| 71 | |
| 72 | def ag_isPython(): |
| 73 | return True |