Subversion Repositories Kolibri OS

Rev

Rev 5895 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef INCLUDE_LIBFS_H
  2. #define INCLUDE_LIBFS_H
  3. #print "[include <obj/fs.h>]\n"
  4.  
  5. #ifndef INCLUDE_KOLIBRI_H
  6. #include "../lib/kolibri.h"
  7. #endif
  8.  
  9. #ifndef INCLUDE_DLL_H
  10. #include "../lib/dll.h"
  11. #endif
  12.  
  13. :struct FILE_SYSTEM_FUNCTION
  14. {
  15.         dword remove_pointer;
  16.         byte remove(dword path);
  17.        
  18.         dword open_pointer;
  19.         dword open(dword path);
  20.        
  21.         dword read_pointer;
  22.         dword read(dword path);
  23.        
  24.         dword run_pointer;
  25.         dword run(dword path,arg);
  26.        
  27.         dword move_pointer;
  28.         byte move(dword path1,path2);
  29.        
  30.         dword copy_pointer;
  31.         byte copy(dword path1,path2);
  32.        
  33.         dword write_pointer;
  34.         byte write(dword path1,path2,path3);
  35.        
  36.         dword get_size_pointer;
  37.         qword get_size(dword path);
  38.        
  39.         dword callback_copy_pointer;
  40.         byte callback_copy(dword path1,path2,ptr);
  41. } fs;
  42.  
  43. :byte FILE_SYSTEM_FUNCTION::remove(dword path)
  44. {
  45.         dword tmp = path;
  46.         lib_init_fs();
  47.         remove_pointer stdcall(tmp);
  48.         return EAX;
  49. }
  50.  
  51. :dword FILE_SYSTEM_FUNCTION::read(dword path)
  52. {
  53.         dword tmp = path;
  54.         lib_init_fs();
  55.         read_pointer stdcall(tmp);
  56.         return EAX;
  57. }
  58.  
  59. :byte FILE_SYSTEM_FUNCTION::write(dword path1,path2,path3)
  60. {
  61.         dword tmp1 = path1;
  62.         dword tmp2 = path2;
  63.         dword tmp3 = path3;
  64.         lib_init_fs();
  65.         write_pointer stdcall(tmp1,tmp2,tmp3);
  66.         return EAX;
  67. }
  68.  
  69. :dword FILE_SYSTEM_FUNCTION::run(dword path,arg)
  70. {
  71.         dword tmp1 = path1;
  72.         dword tmp2 = arg;
  73.         lib_init_fs();
  74.         run_pointer stdcall(tmp1,tmp2);
  75.         return EAX;
  76. }
  77.  
  78. :qword FILE_SYSTEM_FUNCTION::get_size(dword path)
  79. {
  80.         dword tmp = path;
  81.         lib_init_fs();
  82.         //get_size_pointer stdcall(tmp);
  83.         $push tmp
  84.         $call get_size_pointer
  85.         $add esi,4
  86. }
  87.  
  88. :dword FILE_SYSTEM_FUNCTION::open(dword path)
  89. {
  90.         dword tmp = path;
  91.         lib_init_fs();
  92.         open_pointer stdcall(tmp);
  93.         return EAX;
  94. }
  95.  
  96. :byte FILE_SYSTEM_FUNCTION::move(dword path1,path2)
  97. {
  98.         dword tmp1 = path1;
  99.         dword tmp2 = path2;
  100.         lib_init_fs();
  101.         move_pointer stdcall(tmp1,tmp2);
  102.         return EAX;
  103. }
  104.  
  105. :byte FILE_SYSTEM_FUNCTION::copy(dword path1,path2)
  106. {
  107.         dword tmp1 = path1;
  108.         dword tmp2 = path2;
  109.         lib_init_fs();
  110.         copy_pointer stdcall(tmp1,tmp2);
  111.         return EAX;
  112. }
  113.  
  114. :byte FILE_SYSTEM_FUNCTION::callback_copy(dword path1,path2,ptr)
  115. {
  116.         dword tmp1 = path1;
  117.         dword tmp2 = path2;
  118.         lib_init_fs();
  119.         callback_copy_pointer stdcall(tmp1,tmp2,ptr);
  120.         return EAX;
  121. }
  122.  
  123.  
  124. :byte __CHECK_FS__ = 0;
  125. :void lib_init_fs()
  126. {
  127.         IF(__CHECK_FS__)return;
  128.         library.load("/sys/LIB/FS.OBJ");
  129.         fs.remove_pointer = library.get("fs.remove");
  130.         fs.get_size_pointer = library.get("fs.get_size");
  131.         fs.move_pointer = library.get("fs.move");
  132.         fs.open_pointer = library.get("fs.open");
  133.         fs.copy_pointer = library.get("fs.copy");
  134.         fs.read_pointer = library.get("fs.read");
  135.         fs.run_pointer = library.get("fs.execute");
  136.         fs.write_pointer = library.get("fs.write");
  137.         fs.callback_copy_pointer = library.get("fs.callback_copy");
  138.         __CHECK_FS__ = true;
  139. }
  140.  
  141. #endif