Subversion Repositories Kolibri OS

Rev

Rev 5894 | 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 read_pointer;
  19.         dword read(dword path);
  20.        
  21.         dword run_pointer;
  22.         dword run(dword path,arg);
  23.        
  24.         dword move_pointer;
  25.         byte move(dword path1,path2);
  26.        
  27.         dword copy_pointer;
  28.         byte copy(dword path1,path2);
  29.        
  30.         dword get_size_pointer;
  31.         qword get_size(dword path);
  32.        
  33.         dword callback_copy;
  34. } fs;
  35.  
  36. :byte FILE_SYSTEM_FUNCTION::remove(dword path)
  37. {
  38.         dword tmp = path;
  39.         lib_init_fs();
  40.         remove_pointer stdcall(tmp);
  41.         return EAX;
  42. }
  43.  
  44. :dword FILE_SYSTEM_FUNCTION::read(dword path)
  45. {
  46.         dword tmp = path;
  47.         lib_init_fs();
  48.         read_pointer stdcall(tmp);
  49.         return EAX;
  50. }
  51.  
  52. :dword FILE_SYSTEM_FUNCTION::run(dword path,arg)
  53. {
  54.         dword tmp1 = path1;
  55.         dword tmp2 = arg;
  56.         lib_init_fs();
  57.         run_pointer stdcall(tmp1,tmp2);
  58.         return EAX;
  59. }
  60.  
  61. :qword FILE_SYSTEM_FUNCTION::get_size(dword path)
  62. {
  63.         dword tmp = path;
  64.         lib_init_fs();
  65.         get_size_pointer stdcall(tmp);
  66.         return EAX;
  67. }
  68.  
  69. :byte FILE_SYSTEM_FUNCTION::move(dword path1,path2)
  70. {
  71.         dword tmp1 = path1;
  72.         dword tmp2 = path2;
  73.         lib_init_fs();
  74.         move_pointer stdcall(tmp1,tmp2);
  75.         return EAX;
  76. }
  77.  
  78. :byte FILE_SYSTEM_FUNCTION::copy(dword path1,path2)
  79. {
  80.         dword tmp1 = path1;
  81.         dword tmp2 = path2;
  82.         lib_init_fs();
  83.         copy_pointer stdcall(tmp1,tmp2);
  84.         return EAX;
  85. }
  86.  
  87. :byte __CHECK_FS__ = 0;
  88. :void lib_init_fs()
  89. {
  90.         IF(__CHECK_FS__)return;
  91.         library.load("/sys/LIB/FS.OBJ");
  92.         fs.remove_pointer = library.get("fs.remove");
  93.         fs.get_size_pointer = library.get("fs.get_size");
  94.         fs.move_pointer = library.get("fs.move");
  95.         fs.copy_pointer = library.get("fs.copy");
  96.         fs.read_pointer = library.get("fs.read");
  97.         fs.run_pointer = library.get("fs.execute");
  98.         fs.callback_copy = library.get("fs.callback_copy");
  99.         __CHECK_FS__ = true;
  100. }
  101.  
  102. #endif