Преглед на файлове

removed unused PHP classes
added -D use_rtti_doc

Franco Ponticelli преди 17 години
родител
ревизия
1be4c368f2
променени са 7 файла, в които са добавени 8 реда и са изтрити 170 реда
  1. 2 0
      doc/CHANGES.txt
  2. 1 0
      genphp.ml
  3. 4 1
      main.ml
  4. 0 2
      std/haxe/ImportAll.hx
  5. 0 9
      std/php/IniHash.hx
  6. 1 0
      std/php/Session.hx
  7. 0 158
      std/php/db/DBase.hx

+ 2 - 0
doc/CHANGES.txt

@@ -1,6 +1,8 @@
 xxxx-xx-xx: 2.02 CVS
 	Std.is(MyInterface, Class) now returns true (haXe/PHP)
 	php arrays are wrapped into _hx_array instances, fixes issues with references (array cast, access out of bounds ...)
+	removed untested php classes (php.DBase, php.IniHash)
+	added -D use_rtti_doc
 
 2008-10-04: 2.01
 	fixed php.Sys

+ 1 - 0
genphp.ml

@@ -1,5 +1,6 @@
 (*
 TODO
+- check for static method name clashes
 - debug version
 - runtime check for undefined fields
 OPTIMIZATION

+ 4 - 1
main.ml

@@ -291,7 +291,10 @@ try
 			libs := l :: !libs;
 			Common.define com l;
 		),"<library[:version]> : use an haxelib library");
-		("-D",Arg.String (Common.define com),"<var> : define a conditional compilation flag");
+		("-D",Arg.String (fun var ->
+			if var = "use_rtti_doc" then Parser.use_doc := true;
+			Common.define com var
+		),"<var> : define a conditional compilation flag");
 		("-resource",Arg.String (fun res ->
 			let file, name = (match ExtString.String.nsplit res "@" with
 				| [file; name] -> file, name

+ 0 - 2
std/haxe/ImportAll.hx

@@ -543,7 +543,6 @@ import flash.system.JPEGLoaderContext;
 import php.Exception;
 import php.FileSystem;
 import php.HException;
-import php.IniHash;
 import php.Lib;
 import php.Session;
 import php.Sys;
@@ -551,7 +550,6 @@ import php.Utf8;
 import php.Web;
 
 import php.db.Connection;
-import php.db.DBase;
 import php.db.Manager;
 import php.db.Mysql;
 import php.db.Object;

+ 0 - 9
std/php/IniHash.hx

@@ -1,9 +0,0 @@
-package php;
-
-class IniHash extends Hash<String> {
-	public function new(file : String) {
-		super();
-		if(file == null) throw "File can't be null";
-		h = untyped __call__("parse_ini_file", file, false);
-	}
-}

+ 1 - 0
std/php/Session.hx

@@ -82,6 +82,7 @@ class Session {
 	
 	public static function get(name : String) : Dynamic {
 		start();
+		if(!untyped __call__('isset', __var__("_SESSION", name))) return null;
 		return untyped __var__("_SESSION", name);
 	}
 	

+ 0 - 158
std/php/db/DBase.hx

@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2005, The haXe Project Contributors
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *   - Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   - Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- */
-package php.db;
-
-private class DBaseConnection {
-
-	var c : Void;
-	var fields : Array<Field>;
-
-	public function new( file : String, mode : Int) {
-		c = untyped __call__("dbase_open", file, mode);
-		if(c == null) throw "Invalid dBase file: " + file;
-		var infos : ArrayAccess<Dynamic> = untyped __call__("dbase_get_header_info", c);
-		fields = [];
-		for(info in infos) {
-			fields.push({
-				name : info['name'],
-				type : getType(info)
-			});
-		}
-	}
-
-	public function close() {
-		untyped __call__("dbase_close", c);
-		untyped __call__("unset", c);
-	}
-
-	public function count() {
-		return untyped __call__("dbase_numrecords", c);
-	}
-
-	public function insert(values : Array<Dynamic>) : Bool {
-		return untyped __call__("dbase_add_record", c, values);
-	}
-
-	public function replace(index : Int, values : Array<Dynamic>) {
-		return untyped __call__("dbase_replace_record", c, values, index);
-	}
-
-	public function delete(index : Int) : Bool {
-		return untyped __call__("dbase_delete_record", c, index);
-	}
-
-	public function records() : Array<Dynamic> {
-		var arr = [];
-		for(i in 1...count()+1)
-			arr.push(record(i));
-		return arr;
-	}
-
-	public function rows() : Array<Array<Dynamic>> {
-		var arr = [];
-		for(i in 1...count()+1)
-			arr.push(row(i));
-		return arr;
-	}
-
-	public function row(index : Int) : Array<Dynamic> {
-		var r = untyped __call__("dbase_get_record", c, index);
-		if(untyped __php__("isset($r['deleted'])")) {
-			untyped __php__("unset($r['deleted'])");
-		}
-		return untyped __call__("new _hx_array", r);
-	}
-
-	public function record(index : Int) : Dynamic {
-		var row = row(index);
-		var record = {};
-		for(j in 0...fields.length)
-			Reflect.setField(record, fields[j].name, row[j]);
-		return record;
-	}
-
-	private function getType(info : Array<Dynamic>) {
-		switch(info[untyped 'type']) {
-			case 'D': return DateField;
-			case 'N': return NumberField(info[untyped 'length'], info[untyped 'precision']);
-			case 'C': return StringField(info[untyped 'length']);
-			case 'L': return BooleanField;
-			case 'F': return FloatField;
-		}
-		return null;
-	}
-}
-
-class DBase {
-
-	public static function open( file : String ) : DBaseConnection {
-		return new DBaseConnection(file, 2);
-	}
-
-	public static function openReadOnly( file : String ) : DBaseConnection {
-		return new DBaseConnection(file, 0);
-	}
-
-	public static function create(file : String, fields : Array<Field>) : Void {
-		var flds : Array<Array<Dynamic>> = [];
-		for(field in fields) {
-			var fld : Array<Dynamic>= [];
-			fld.push(field.name);
-			switch(field.type) {
-				case DateField:
-					fld.push('D');
-				case NumberField(len, precision):
-					fld.push('N');
-					fld.push(len);
-					fld.push(precision);
-				case StringField(len):
-					fld.push('C');
-					fld.push(len);
-				case BooleanField:
-					fld.push('L');
-				case FloatField:
-					fld.push('F');
-			}
-			flds.push(fld);
-		}
-		var h = untyped __call__("dbase_create", file, flds);
-		if(h == false) throw "Error creating: " + file;
-		untyped __call__("dbase_close", h);
-	}
-}
-
-typedef Field = {
-	name : String, // max 10 chars
-	type : FieldType
-}
-
-enum FieldType {
-//	MemoField;
-	DateField;
-	NumberField(len : Int, precision : Int);
-	StringField(len : Int);
-	BooleanField;
-	FloatField;
-}