PageRenderTime 38ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/src/runtime/ext/ext_file.h

https://github.com/tmjnaid/hiphop-php
C Header | 161 lines | 116 code | 16 blank | 29 comment | 0 complexity | 2a6192e53bd42125e126b135f04ab163 MD5 | raw file
  1. /*
  2. +----------------------------------------------------------------------+
  3. | HipHop for PHP |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
  6. | Copyright (c) 1997-2010 The PHP Group |
  7. +----------------------------------------------------------------------+
  8. | This source file is subject to version 3.01 of the PHP license, |
  9. | that is bundled with this package in the file LICENSE, and is |
  10. | available through the world-wide-web at the following url: |
  11. | http://www.php.net/license/3_01.txt |
  12. | If you did not receive a copy of the PHP license and are unable to |
  13. | obtain it through the world-wide-web, please send a note to |
  14. | license@php.net so we can mail you a copy immediately. |
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifndef __EXT_FILE_H__
  18. #define __EXT_FILE_H__
  19. #include <runtime/base/base_includes.h>
  20. namespace HPHP {
  21. ///////////////////////////////////////////////////////////////////////////////
  22. // constants
  23. #define k_STDIN (BuiltinFiles::GetSTDIN())
  24. #define k_STDOUT (BuiltinFiles::GetSTDOUT())
  25. #define k_STDERR (BuiltinFiles::GetSTDERR())
  26. ///////////////////////////////////////////////////////////////////////////////
  27. // file handle based file operations
  28. Variant f_fopen(CStrRef filename, CStrRef mode, bool use_include_path = false,
  29. CObjRef context = null_object);
  30. Variant f_popen(CStrRef command, CStrRef mode);
  31. bool f_fclose(CObjRef handle);
  32. Variant f_pclose(CObjRef handle);
  33. Variant f_fseek(CObjRef handle, int64 offset, int64 whence = SEEK_SET);
  34. bool f_rewind(CObjRef handle);
  35. Variant f_ftell(CObjRef handle);
  36. bool f_feof(CObjRef handle);
  37. Variant f_fstat(CObjRef handle);
  38. Variant f_fread(CObjRef handle, int64 length);
  39. Variant f_fgetc(CObjRef handle);
  40. Variant f_fgets(CObjRef handle, int64 length = 1024);
  41. Variant f_fgetss(CObjRef handle, int64 length = 0,
  42. CStrRef allowable_tags = null_string);
  43. Variant f_fscanf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv = null_array);
  44. Variant f_fpassthru(CObjRef handle);
  45. Variant f_fwrite(CObjRef handle, CStrRef data, int64 length = 0);
  46. Variant f_fputs(CObjRef handle, CStrRef data, int64 length = 0);
  47. Variant f_fprintf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv = null_array);
  48. Variant f_vfprintf(CObjRef handle, CStrRef format, CArrRef args);
  49. bool f_fflush(CObjRef handle);
  50. bool f_ftruncate(CObjRef handle, int64 size);
  51. bool f_flock(CObjRef handle, int operation, Variant wouldblock = null);
  52. Variant f_fputcsv(CObjRef handle, CArrRef fields, CStrRef delimiter = ",",
  53. CStrRef enclosure = "\"");
  54. Variant f_fgetcsv(CObjRef handle, int64 length = 0, CStrRef delimiter = ",",
  55. CStrRef enclosure = "\"");
  56. ///////////////////////////////////////////////////////////////////////////////
  57. // file name based file operations
  58. Variant f_file_get_contents(CStrRef filename, bool use_include_path = false,
  59. CObjRef context = null_object, int64 offset = 0,
  60. int64 maxlen = 0);
  61. Variant f_file_put_contents(CStrRef filename, CVarRef data, int flags = 0,
  62. CObjRef context = null_object);
  63. Variant f_file(CStrRef filename, int flags = 0, CObjRef context = null_object);
  64. Variant f_readfile(CStrRef filename, bool use_include_path = false,
  65. CObjRef context = null_object);
  66. bool f_move_uploaded_file(CStrRef filename, CStrRef destination);
  67. Variant f_parse_ini_file(CStrRef filename, bool process_sections = false,
  68. int scanner_mode = k_INI_SCANNER_NORMAL);
  69. Variant f_parse_ini_string(CStrRef ini, bool process_sections = false,
  70. int scanner_mode = k_INI_SCANNER_NORMAL);
  71. Variant f_parse_hdf_file(CStrRef filename);
  72. Variant f_parse_hdf_string(CStrRef input);
  73. bool f_write_hdf_file(CArrRef data, CStrRef filename);
  74. String f_write_hdf_string(CArrRef data);
  75. Variant f_md5_file(CStrRef filename, bool raw_output = false);
  76. Variant f_sha1_file(CStrRef filename, bool raw_output = false);
  77. ///////////////////////////////////////////////////////////////////////////////
  78. // shell commands
  79. bool f_chmod(CStrRef filename, int64 mode);
  80. bool f_chown(CStrRef filename, CVarRef user);
  81. bool f_lchown(CStrRef filename, CVarRef user);
  82. bool f_chgrp(CStrRef filename, CVarRef group);
  83. bool f_lchgrp(CStrRef filename, CVarRef group);
  84. bool f_touch(CStrRef filename, int64 mtime = 0, int64 atime = 0);
  85. bool f_copy(CStrRef source, CStrRef dest, CObjRef context = null_object);
  86. bool f_rename(CStrRef oldname, CStrRef newname, CObjRef context = null_object);
  87. int f_umask(CVarRef mask = null_variant);
  88. bool f_unlink(CStrRef filename, CObjRef context = null_object);
  89. bool f_link(CStrRef target, CStrRef link);
  90. bool f_symlink(CStrRef target, CStrRef link);
  91. String f_basename(CStrRef path, CStrRef suffix = null_string);
  92. bool f_fnmatch(CStrRef pattern, CStrRef filename, int flags = 0);
  93. Variant f_glob(CStrRef pattern, int flags = 0);
  94. Variant f_tempnam(CStrRef dir, CStrRef prefix);
  95. Variant f_tmpfile();
  96. ///////////////////////////////////////////////////////////////////////////////
  97. // stats functions
  98. Variant f_fileperms(CStrRef filename);
  99. Variant f_fileinode(CStrRef filename);
  100. Variant f_filesize(CStrRef filename);
  101. Variant f_fileowner(CStrRef filename);
  102. Variant f_filegroup(CStrRef filename);
  103. Variant f_fileatime(CStrRef filename);
  104. Variant f_filemtime(CStrRef filename);
  105. Variant f_filectime(CStrRef filename);
  106. Variant f_filetype(CStrRef filename);
  107. Variant f_linkinfo(CStrRef filename);
  108. bool f_is_writable(CStrRef filename);
  109. bool f_is_writeable(CStrRef filename);
  110. bool f_is_readable(CStrRef filename);
  111. bool f_is_executable(CStrRef filename);
  112. bool f_is_file(CStrRef filename);
  113. bool f_is_dir(CStrRef filename);
  114. bool f_is_link(CStrRef filename);
  115. bool f_is_uploaded_file(CStrRef filename);
  116. bool f_file_exists(CStrRef filename);
  117. Variant f_stat(CStrRef filename);
  118. Variant f_lstat(CStrRef filename);
  119. void f_clearstatcache();
  120. Variant f_readlink_internal(CStrRef path, bool warning_compliance);
  121. Variant f_readlink(CStrRef path);
  122. Variant f_realpath(CStrRef path);
  123. Variant f_pathinfo(CStrRef path, int opt = 15);
  124. Variant f_disk_free_space(CStrRef directory);
  125. Variant f_diskfreespace(CStrRef directory);
  126. Variant f_disk_total_space(CStrRef directory);
  127. ///////////////////////////////////////////////////////////////////////////////
  128. // directory functions
  129. bool f_mkdir(CStrRef pathname, int64 mode = 0777, bool recursive = false,
  130. CObjRef context = null_object);
  131. bool f_rmdir(CStrRef dirname, CObjRef context = null_object);
  132. String f_dirname(CStrRef path);
  133. Variant f_getcwd();
  134. bool f_chdir(CStrRef directory);
  135. bool f_chroot(CStrRef directory);
  136. Variant f_dir(CStrRef directory);
  137. Variant f_opendir(CStrRef path, CObjRef context = null);
  138. Variant f_readdir(CObjRef dir_handle);
  139. void f_rewinddir(CObjRef dir_handle);
  140. Variant f_scandir(CStrRef directory, bool descending = false,
  141. CObjRef context = null);
  142. void f_closedir(CObjRef dir_handle);
  143. ///////////////////////////////////////////////////////////////////////////////
  144. }
  145. #endif // __EXT_FILE_H__