~ubuntu-branches/ubuntu/maverick/haxe/maverick

« back to all changes in this revision

Viewing changes to haxe/std/php/Lib.hx

  • Committer: Bazaar Package Importer
  • Author(s): Jens Peter Secher
  • Date: 2010-01-31 23:08:43 UTC
  • mfrom: (5.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100131230843-1cxte2x20ypk9c25
Tags: 1:2.5-1
New upstream version, taken from new upstream subversion repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        }
41
41
 
42
42
        public static function isCli() : Bool {
43
 
                return untyped __php__("0 == strncasecmp(PHP_SAPI, 'cli', 3)");
 
43
                return untyped __php__("(0 == strncasecmp(PHP_SAPI, 'cli', 3))");
44
44
        }
45
45
 
46
46
        public static function printFile(file : String) {
47
 
                var h = untyped __call__("fopen", file,  "r");
48
 
                return untyped __call__("fpassthru", h);
 
47
                return untyped __call__("fpassthru", __call__("fopen", file,  "r"));
49
48
        }
50
49
 
51
50
        public static inline function toPhpArray(a : Array<Dynamic>) : NativeArray {
52
 
                return untyped __php__("$a->�a");
 
51
                return untyped __field__(a, '�a');
53
52
        }
54
53
 
55
54
        public static inline function toHaxeArray(a : NativeArray) : Array<Dynamic> {
61
60
                untyped __php__("reset($arr); while(list($k, $v) = each($arr)) $h->set($k, $v)");
62
61
                return h;
63
62
        }
 
63
        
 
64
        public static function associativeArrayOfHash(hash : Hash<Dynamic>) : NativeArray {
 
65
                return untyped hash.h;
 
66
        }
64
67
 
65
68
        /**
66
69
                For neko compatibility only.
67
70
        **/
68
71
        public inline static function rethrow( e : Dynamic ) {
69
 
                untyped __php__("if(isset($__e__)) throw $__e__");
70
 
                if(Std.is(e, untyped __php__("Exception"))) {
 
72
                untyped __php__("if(isset($�e)) throw $�e");
 
73
                if(Std.is(e, Exception)) {
71
74
                        var __rtex__ = e;
72
75
                        untyped __php__("throw $__rtex__");
73
76
                }