# # This file is part of gtkDS. # # gtkD is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # gtkD is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with gtkDS; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ### ##### # Definitions for wrapping phobos.. ##### ### # wrap: phobos ########################################################### ### GL #################################################### ########################################################### #file: class: File jsClass: File import: std.file import: std.date import: std.c.linux.linux import: dmdscript.darray import: dmdscript.ddate pconst: READ FileMode.In pconst: WRITE FileMode.Out pconst: NEW FileMode.OutNew pconst: APPEND FileMode.Append pdoc: File.read(String filename) String pstatic: read char[] _ret = cast(char[]) std.file.read(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pdoc: File.write(String filename, String data) pstatic:write std.file.write(arglist[0].toString(),arglist[1].toString()); ret.putVundefined(); pstatic: end pdoc: File.append(String filename, String data) pstatic: append std.file.append(arglist[0].toString(),arglist[1].toString()); ret.putVundefined(); pstatic: end pdoc: File.rename(String fromFilename, String toFilename) pstatic: rename std.file.append(arglist[0].toString(),arglist[1].toString()); ret.putVundefined(); pstatic: end pdoc: File.copy(String fromFilename, String toFilename) pstatic: copy std.file.copy(arglist[0].toString(),arglist[1].toString()); ret.putVundefined(); pstatic: end pdoc: File.remove(String filename) pstatic: remove std.file.remove(arglist[0].toString()); ret.putVundefined(); pstatic: end pdoc: File.getTimes(String filename) Array[Date change,Date accessed,Date modified] pstatic: getTimes d_time ftc, fta, ftm; std.file.getTimes(arglist[0].toString(), ftc, fta, ftm); auto _ret = new Darray(); _ret.Put(0, Value.newObject(new Ddate(ftc)),0); _ret.Put(1, Value.newObject(new Ddate(fta)),0); _ret.Put(2, Value.newObject(new Ddate(ftm)),0); ret.putVobject(_ret); pstatic: end pdoc: File.exists(String filename) Number pstatic: exists int _ret = std.file.exists(arglist[0].toString()); ret.putVnumber(_ret); pstatic: end pdoc: File.getAttributes(String filename) Number pstatic: getAttributes int _ret = std.file.getAttributes(arglist[0].toString()); ret.putVnumber(_ret); pstatic: end pdoc: File.isFile(String filename) Number pstatic: isFile int _ret = std.file.isfile(arglist[0].toString()); ret.putVnumber(_ret); pstatic: end pdoc: File.isDir(String filename) Number pstatic: isDir int _ret = std.file.isdir(arglist[0].toString()); ret.putVnumber(_ret); pstatic: end pdoc: File.chdir(String dirname) pstatic: chdir std.file.chdir(arglist[0].toString()); ret.putVundefined(); pstatic: end pdoc: File.mkdir(String dirname) pstatic: mkdir std.file.mkdir(arglist[0].toString()); ret.putVundefined(); pstatic: end pdoc: File.rmdir(String dirname) pstatic: rmdir std.file.rmdir(arglist[0].toString()); ret.putVundefined(); pstatic: end pdoc: File.getcwd() String pstatic: getcwd char[] _ret = std.file.getcwd(); ret.putVstring(_ret); pstatic: end pdoc: File.listdir(String name, String [pattern]) Array pstatic: listdir char[][] _ret; if (arglist.length > 1) { _ret = std.file.listdir(arglist[0].toString(), arglist[1].toString()); } else { _ret = std.file.listdir(arglist[0].toString()); } Darray _ra = new Darray(); foreach(i, s;_ret) { _ra.Put(i, s, 0); } ret.putVobject(_ra); pstatic: end #from std. stream.. #pextends: IO.Stream? import: std.stream struct: File pdoc: Constructor(String filename, ENUM FileMode? mode) pcode: new ret.putVobject( new dsWrapped_File( new File(arglist[0].toString(), cast(FileMode)arglist[1].toNumber()) )); pcode: end pdoc: close() pcode: close (cast(File) othis.getStruct()).close(); pcode:end pdoc: write(String data) void pcode: write (cast(File) othis.getStruct()).writeString(arglist[0].toString()); pcode:end pdoc: read(int len) String pcode: read int rlen = arglist.length > 0 ? cast(int) arglist[0].toNumber() : 4096; ret.putVstring((cast(File) othis.getStruct()).readString(rlen)); pcode:end pdoc: available() Int pcode: available ret.putVnumber((cast(File) othis.getStruct()).available()); pcode:end pdoc: File.chmod(String filename, Int mode) pstatic: chmod int _ret = std.c.linux.linux.chmod( std.string.toStringz(arglist[0].toString()), cast(int) arglist[1].toNumber() ); ret.putVnumber(_ret); pstatic: end pout: File ######################################################################## class: Path jsClass: Path import: std.path import: std.utf import: dmdscript.darray pdoc: Path.getExt(String fullname) String pstatic: getExt char[] _ret = cast(char[]) std.path.getExt(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pdoc: Path.getName(String fullname) String pstatic: getName char[] _ret = cast(char[]) std.path.getName(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pdoc: Path.getBaseName(String fullname) String pstatic: getBaseName char[] _ret = cast(char[]) std.path.getBaseName(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pdoc: Path.getDirName(String fullname) String pstatic: getDirName char[] _ret = cast(char[]) std.path.getDirName(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pdoc: Path.getDrive(String fullname) String pstatic: getDrive char[] _ret = cast(char[]) std.path.getDrive(arglist[0].toString()); if (_ret) { ret.putVstring(_ret); } else { ret.putVnull(); } pstatic: end pdoc: Path.defaultExt(String fullname, String ext) String pstatic: defaultExt char[] _ret = cast(char[]) std.path.defaultExt(arglist[0].toString(),arglist[1].toString()); ret.putVstring(_ret); pstatic: end pdoc: Path.addExt(String fullname, String ext) String pstatic: defaultExt char[] _ret = cast(char[]) std.path.addExt(arglist[0].toString(),arglist[1].toString()); ret.putVstring(_ret); pstatic: end pdoc: Path.isabs(String path) String pstatic: isabs int _ret = cast(int) std.path.isabs(arglist[0].toString()); ret.putVboolean(_ret); pstatic: end pdoc: Path.join(String path1, String path2) String pstatic: join char[] _ret = cast(char[]) std.path.join(arglist[0].toString(),arglist[1].toString()); ret.putVstring(_ret); pstatic: end pdoc: Path.fnmatch(String filename1, String pattern) Boolean pstatic: fnmatch int _ret = cast(int) std.path.fnmatch(arglist[0].toString(),arglist[1].toString()); ret.putVboolean(_ret); pstatic: end pdoc: Path.expandTilde(String filename1) String pstatic: expandTilde char[] _ret = cast(char[]) std.path.expandTilde(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pout: Path ######################################################################## class: Base64 jsClass: String.Base64 import: std.base64 #import: dmdscript.darray pdoc: Base64.encode(String toEncode) String pstatic: encode char[] _ret = std.base64.encode(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pdoc: Base64.decode(String toDecode) String pstatic: decode char[] _ret = std.base64.decode(arglist[0].toString()); ret.putVstring(_ret); pstatic: end pout: Base64 ######################################################################## class: System jsClass: System import: std.process #import: dmdscript.darray pdoc: System.run(String cmdline) int pstatic: run int _ret = std.process.system(arglist[0].toString()); ret.putVnumber(_ret); pstatic: end pout: System