kolibrios-gitea/programs/fs/kfar/trunk/api.txt
Evgeny Grechnikov (Diamond) d7512224b5 KFar 0.41 + KFar_Arc 0.11
git-svn-id: svn://kolibrios.org@631 a494cfbc-eb01-0410-851d-a64ba20cac60
2007-09-20 16:20:58 +00:00

150 lines
8.7 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<EFBFBD>« £¨­ ¯à¥¤áâ ¢«ï¥â ᮡ®© áâ ­¤ àâ­ãî ¤«ï Š®«¨¡à¨ ¤¨­ ¬¨ç¥áªãî ¡¨¡«¨®â¥ªã (ä®à¬ â  COFF),
íªá¯®àâ¨àãîéãî á«¥¤ãî騥 ä㭪樨 ¨ ¯¥à¥¬¥­­ë¥ (­¥ª®â®àë¥ ä㭪樨 ¬®£ãâ ®âáãâá⢮¢ âì).
”㭪樨 ¬®£ãâ à §àãè âì «î¡ë¥ ॣ¨áâàë. kfar £ à ­â¨àã¥â á¡à®è¥­­ë© ä« £ ­ ¯à ¢«¥­¨ï DF
¯à¨ ¢ë§®¢¥ íªá¯®àâ¨à㥬ëå ä㭪権 ¨ ®¦¨¤ ¥â ⮣® ¦¥ ¤«ï callback-ä㭪権.
int version;
‚¥àá¨ï ¨­â¥àä¥©á  kfar, ­  ª®â®àãî à ááç¨â ­ ¯« £¨­. ‘¥©ç á ¤®«¦­  ¡ëâì 2.
int __stdcall plugin_load(kfar_info* info);
‚ë§ë¢ ¥âáï ¯à¨ § £à㧪¥ ¯« £¨­ .
typedef struct
{
int StructSize; // = sizeof(kfar_info)
int kfar_ver; // 10000h*major + minor
/* ‚ᥠcallback-ä㭪樨 á®åà ­ïî⠢ᥠॣ¨áâàë, §  ¨áª«î祭¨¥¬ eax. */
/* ”㭪樨 à ¡®âë á ä ©« ¬¨: */
void* open; // HANDLE __stdcall open(const char* name, int mode);
// mode - ª®¬¡¨­ æ¨ï ¡¨â®¢ëå ä« £®¢
// O_READ = 1 - ¤®áâ㯠¤«ï ç⥭¨ï
// O_WRITE = 2 - ¤®áâ㯠¤«ï § ¯¨á¨
// O_CREATE = 4 - ¥á«¨ ä ©« ­¥ áãé¥áâ¢ã¥â, ᮧ¤ âì ¥£®
// O_TRUNCATE = 8 - ãá¥çì ä ©« ¤® ­ã«¥¢®© ¤«¨­ë
void* open2; // HANDLE __stdcall open2(int plugin_id, HANDLE plugin_instance,
// const char* name, int mode);
//  ­ «®£¨ç­® open, ­® ®âªà뢠¥â ä ©« á ¯ ­¥«¨ ¯« £¨­ 
// open2(0,<anything>,name,mode) = open(name,mode)
void* read; // unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
void* write; // ¥éñ ­¥ ॠ«¨§®¢ ­®
void* seek; // void __stdcall seek(HANDLE hFile, int method, __int64 newpos);
void* tell; // __int64 __stdcall tell(HANDLE hFile);
void* flush; // ¥éñ ­¥ ॠ«¨§®¢ ­®
void* filesize; // __int64 __stdcall filesize(HANDLE hFile);
void* close; // void __stdcall close(HANDLE hFile);
/* ”㭪樨 à ¡®âë á ¯ ¬ïâìî (¯®áâà ­¨ç­®): */
void* pgalloc; // in: ecx=size, out: eax=pointer or NULL
// ¯à¨ ­¥å¢ âª¥ ¯ ¬ï⨠ᮮ¡é ¥â ¯®«ì§®¢ â¥«î ¨ ¢®§¢à é ¥â NULL
void* pgrealloc; // in: edx=pointer, ecx=new size, out: eax=pointer or NULL
// ¯à¨ ­¥å¢ âª¥ ¯ ¬ï⨠ᮮ¡é ¥â ¯®«ì§®¢ â¥«î ¨ ¢®§¢à é ¥â NULL
void* pgfree; // in: ecx=pointer
void* getfreemem; // unsigned __stdcall getfreemem(void);
// ¢®§¢à é ¥â à §¬¥à ᢮¡®¤­®© ®¯¥à â¨¢­®© ¯ ¬ï⨠¢ Š¡
void* pgalloc2; // void* __stdcall pgalloc2(unsigned size);
void* pgrealloc2; // void* __stdcall pgrealloc2(void* pointer, unsigned size);
void* pgfree2; // void __stdcall pgfree2(void* pointer);
/* ”㭪樨 à ¡®âë á ¤¨ «®£ ¬¨: */
void* menu; // int __stdcall menu(void* variants, const char* title, unsigned flags);
// variants 㪠§ë¢ ¥â ­  ⥪ã騩 í«¥¬¥­â ¢ ¤¢ãá¢ï§­®¬ ᯨ᪥
void* menu_centered_in; // int __stdcall menu_centered_in(unsigned left, unsigned top,
// unsigned width, unsigned height,
// void* variants, const char* title, unsigned flags);
void* DialogBox; // int __stdcall DialogBox(DLGDATA* dlg);
void* SayErr; // int __stdcall SayErr(int num_strings, const char** strings,
// int num_buttons, const char** buttons);
void* Message; // int __stdcall Message(const char* title,
// int num_strings, const char** strings,
// int num_buttons, const char** buttons);
// may be x=-1 and/or y=-1
struct {unsigned width;unsigned height;}* cur_console_size;
} kfar_info;
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
0 = ãá¯¥è­ ï ¨­¨æ¨ «¨§ æ¨ï
1 = ®è¨¡ª  ¨­¨æ¨ «¨§ æ¨¨ (kfar ¢ë¤ áâ á®®¡é¥­¨¥ ¯®«ì§®¢ â¥«î)
2 = ®è¨¡ª  ¨­¨æ¨ «¨§ æ¨¨ (kfar ¯à®¤®«¦¨â ¡¥§ á®®¡é¥­¨©)
void __stdcall plugin_unload(void);
‚ë§ë¢ ¥âáï ¯à¨ ¢ë£à㧪¥ ¯« £¨­  (¢ ¯à®æ¥áᥠ§ ¢¥à襭¨ï à ¡®âë kfar).
HANDLE __stdcall OpenFilePlugin(HANDLE basefile,
const void* attr, const void* data, int datasize,
int baseplugin_id, HANDLE baseplugin_instance, const char* name);
Žâªà뢠¥â ¯« £¨­, í¬ã«¨àãî騩 ä ©«®¢ãî á¨á⥬㠭  ¡ §¥ ä ©«  (­ ¯à¨¬¥à,  à娢 ).
basefile - åí­¤« ä ©«  (ª ª®â®à®¬ã ¯à¨¬¥­¨¬ë ä㭪樨 read ¨ seek ¨§ kfar_info)
attr - 㪠§ â¥«ì ­  áâàãªâãàã á  âਡãâ ¬¨ ä ©«  ¢ ä®à¬ â¥ á¨á⥬­®© ä㭪樨 70.1
data - ¡ãä¥à, ᮤ¥à¦ é¨© ¤ ­­ë¥ ¨§ ­ ç «  ä ©«  (¬®¦¥â ¨á¯®«ì§®¢ âìáï ¤«ï ®¯à¥¤¥«¥­¨ï ⨯  ä ©« )
datasize - à §¬¥à ¤ ­­ëå ¢ data. ⥪ã饩 ॠ«¨§ æ¨¨ min(1024,à §¬¥à ä ©« )
baseplugin_id - ¨¤¥­â¨ä¨ª â®à ¯« £¨­ , ­  ¯ ­¥«¨ ª®â®à®£® à á¯®« £ ¥âáï ®âªà뢠¥¬ë© ä ©«;
0 ¢ á«ãç ¥ ®¡ëç­ëå ¯ ­¥«¥©
baseplugin_instance - åí­¤«, ¢®§¢à éñ­­ë© ¨§ ä㭪樨 GetOpenPluginInfo ¯« £¨­ ,
®¯à¥¤¥«ï¥¬®£® ¯® baseplugin_id
name - ¨¬ï ä ©«  (¢® ¢à¥¬¥­­®¬ ¡ãä¥à¥) (¯®«­®¥ ¨¬ï ®â­®á¨â¥«ì­® baseplugin)
…᫨ ¯« £¨­ ®¡à ¡ â뢠¥â ¯¥à¥¤ ­­ë© ä ©«, â® ®­ ¤®«¦¥­ ¢¥à­ãâì ­®¢ë© ®¯¨á â¥«ì,
ª®â®àë© ¢ ¤ «ì­¥©è¥¬ ¡ã¤¥â ¨á¯®«ì§®¢ âì kfar ¤«ï ®¡à é¥­¨ï ª ¯« £¨­ã. í⮬ á«ãç ¥
¯« £¨­ ¤®«¦¥­ á ¬®áâ®ï⥫쭮 § ªàëâì basefile ä㭪樥© close ¨§ kfar_info (­ ¯à¨¬¥à,
¯à¨ § ªàë⨨ ®¯¨á â¥«ï ¯« £¨­  ¢ ClosePlugin ¨«¨ ­¥¯®á।á⢥­­® ¢ OpenFilePlugin,
¥á«¨ basefile ¢®®¡é¥ ¢¯®á«¥¤á⢨¨ ­¥ ­ã¦¥­).
…᫨ ¯« £¨­ ­¥ ®¡à ¡ â뢠¥â ¯¥à¥¤ ­­ë© ä ©«, ¤®«¦¥­ ¢®§¢à é âìáï 0.
…᫨ ®¯¥à æ¨ï ¯à¥à¢ ­  ¯®«ì§®¢ â¥«¥¬, ¤®«¦­® ¢®§¢à é âìáï §­ ç¥­¨¥ -1.
void __stdcall ClosePlugin(HANDLE hPlugin);
‡ ªà뢠¥â ᮧ¤ ­­ë© ¢ OpenFilePlugin ®¯¨á â¥«ì.
void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* Info);
<EFBFBD>®«ãç¨âì ¨­ä®à¬ æ¨î ®¡ ®âªàë⮬ íª§¥¬¯«ïॠ¯« £¨­ .
typedef struct
{
unsigned flags; // ¡¨â 0: ¤®¡ ¢«ïâì í«¥¬¥­â '..', ¥á«¨ ®­ ®âáãâáâ¢ã¥â
// ¡¨â 1: ª®¯¨à®¢ ­¨¥ ®¡à ¡ â뢠¥âáï ä㭪樥© GetFiles
} OpenPluginInfo;
void __stdcall GetPanelTitle(HANDLE hPlugin, char title[1024],
const char* host_file, const char* curdir);
<EFBFBD>®«ãç¨âì § £®«®¢®ª ¯ ­¥«¨ ¯« £¨­ . <20> à ¬¥âà host_file ᮢ¯ ¤ ¥â á ¨¬¥­¥¬ ä ©« , ¯¥à¥¤ ­­ë¬
¢ OpenFilePlugin. <20> à ¬¥âà curdir ᮢ¯ ¤ ¥â á ⥪ã饩 ¯ ¯ª®©, ãáâ ­ ¢«¨¢ ¥¬®© ¢ SetFolder.
int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start,
unsigned dirinfo_size, void* dirdata);
—¨â ¥â ⥪ãéãî ¯ ¯ªã. hPlugin - ¢®§¢à éñ­­ë© ¨§ OpenFilePlugin ®¯¨á â¥«ì.
dirinfo_start - á ª ª®£® ä ©«  ç¨â âì, dirinfo_size - ᪮«ìª® ä ©«®¢ ç¨â âì.
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥ ¨ ¢®§¢à é ¥¬ë¥ ¢ dirdata ¤ ­­ë¥ ¤®«¦­ë ᮮ⢥âá⢮¢ âì ä㭪樨 70.1.
bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, const char* absolute_path);
“áâ ­®¢¨âì ⥪ãéãî ¯ ¯ªã. relative_path - ®â­®á¨â¥«ì­ë© ¯ãâì (".." ¨«¨ ¨¬ï ¯®¤¯ ¯ª¨),
absolute_path -  ¡á®«îâ­ë© ¯ãâì (¯ ¯ª  í¬ã«¨à㥬®© ¯« £¨­®¬ ä ©«®¢®© á¨á⥬ë).
void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir);
bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile);
bool __stdcall adddir(const char* name, void* bdfe_info);
‚ë§ë¢ ¥âáï ¤«ï ª®¯¨à®¢ ­¨ï, ¥á«¨ ¢® ä« £ å, ¢®§¢à é ¥¬ëå GetOpenPluginInfo, ãáâ ­®¢«¥­ ¡¨â 1.
<EFBFBD>âã äã­ªæ¨î ४®¬¥­¤ã¥âáï ॠ«¨§®¢ë¢ âì ¢ á«ãç ¥, ¥á«¨ áâ ­¤ àâ­ë© ४ãàᨢ­ë© ®¡å®¤ ¯ ¯®ª
­¥ã¤®¡¥­.
hPlugin - ®¯¨á â¥«ì, ᮧ¤ ­­ë© ¢ OpenFilePlugin.
NumItems - ç¨á«® ª®¯¨à㥬ëå í«¥¬¥­â®¢.
items - ¬ áᨢ ª®¯¨à㥬ëå í«¥¬¥­â®¢, ª ¦¤ë© ¨§ ª®â®àëå § ¤ ñâáï 㪠§ â¥«¥¬ ­  áâàãªâãàã BDFE.
‘¯¥æ¨ «ì­ë© á«ãç © NumItems=-1, items=NULL ®§­ ç ¥â "¢á¥ ä ©«ë" (¢ ⥪ã饩 ¯ ¯ª¥ ¨ ¯®¤¯ ¯ª å).
addfile, adddir - callback-ä㭪樨 kfar' . ‚®§¢à â false ®§­ ç ¥â "¯à¥à¢ âì ª®¯¨à®¢ ­¨¥".
<EFBFBD> à ¬¥âà name ¤®«¦¥­ § ¤ ¢ âì ¨¬ï ®â­®á¨â¥«ì­® ⥪ã饩 ¯ ¯ª¨. <20> à ¬¥âà bdfe_info -
㪠§ â¥«ì ­  ᮪à éñ­­ãî (40 ¡ ©â) § ¯¨áì ¢ ä®à¬ â¥ ä㭪樨 70.5.
Žâªàë⨥¬ ¨ § ªàë⨥¬ ®¯¨á â¥«ï hFile ¤®«¦¥­ § ­¨¬ âìáï ¯« £¨­. ”ã­ªæ¨ï addfile ¡ã¤¥â
¢ë§ë¢ âì ⮫쪮 äã­ªæ¨î read.
int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info);
<EFBFBD>®«ãç¨âì ¨­ä®à¬ æ¨î ® ä ©«¥. ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥ ¨ ¤ ­­ë¥ ¢ info ¤®«¦­ë ᮮ⢥âá⢮¢ âì
ä㭪樨 70.5.
HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode);
Žâªàëâì ä ©« filename. <20> à ¬¥âà mode § à¥§¥à¢¨à®¢ ­ ¨ ¢ ⥪ã饩 ¢¥àᨨ kfar ¢á¥£¤  à ¢¥­ 1.
unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
—⥭¨¥ size ¡ ©â ¢ ¡ãä¥à buf ¨§ ä ©«  hFile, à ­¥¥ ®âªàë⮣® ç¥à¥§ open.
kfar £ à ­â¨àã¥â, çâ® size ªà â¥­ 512 ¡ ©â.
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â, -1 ¯à¨ ®è¨¡ª¥.
void __stdcall setpos(HANDLE hFile, __int64 pos);
“áâ ­®¢¨âì ⥪ãéãî ¯®§¨æ¨î ¢ ä ©«¥ hFile, à ­¥¥ ®âªàë⮣® ç¥à¥§ open, ¢ pos.
ƒ à ­â¨àã¥âáï, çâ® pos ªà â­® 512 ¡ ©â.
void __stdcall close(HANDLE hFile);