### Configure Function Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/exported_functions/configure.html An example implementation of the Configure function. ```APIDOC ### Example int WINAPI \_export Configure(int ItemNumber) { switch(ItemNumber) { case 0: return(Config()); } return(FALSE); } ``` -------------------------------- ### Example Control Statements Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/language/control_statements.html A combined example demonstrating the usage of .Language, .PluginContents, and a custom content structure. ```plaintext .Language=English,English .PluginContents=FTP client @Contents $ #FTP client# ~Connecting to an FTP server~@FTPConnect@ ~Working with server names~@FTPNames@ ~FTP client commands~@FTPCmd@ ~FTP client configuration~@FTPCfg@ ~FTP client panel modes~@FTPPanel ``` -------------------------------- ### Configure Function Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/exported_functions/configure.html Example implementation of the Configure function. It uses a switch statement to handle different menu items and calls a Config() function for item 0. Returns TRUE on success, FALSE on cancellation. ```c int WINAPI _export Configure(int ItemNumber) { switch(ItemNumber) { case 0: return(Config()); } return(FALSE); } ``` -------------------------------- ### Menu Function Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/menu.html An example demonstrating the usage of the Menu function. ```APIDOC ### Example This example is taken from the EditCase plugin: ```c struct FarMenuItem MenuItems[2]; memset(MenuItems,0,sizeof(MenuItems)); strcpy(MenuItems[0].Text,GetMsg(MCaseLower)); strcpy(MenuItems[1].Text,GetMsg(MCaseUpper)); MenuItems[0].Selected=TRUE; int MenuCode=Info.Menu(Info.ModuleNumber,-1, -1,0,FMENU_AUTOHIGHLIGHT|FMENU_WRAPMODE, GetMsg(MCaseConversion),NULL, "Contents",NULL,NULL, MenuItems, sizeof(MenuItems)/sizeof(MenuItems[0])); if (MenuCode<0) return(INVALID_HANDLE_VALUE); // ... ``` Info is defined as a global variable: ```c struct PluginStartupInfo Info; ...and is initialized in the [SetStartupInfo](../exported_functions/setstartupinfo.html) function: void WINAPI _export SetStartupInfo(struct PluginStartupInfo *Info) { ... ::Info=*Info; ... } ``` ``` -------------------------------- ### Prompt for Password Input and Display Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/functions.html Example of using the prompt function to get a password input, masking the input with asterisks. The entered password is then displayed using the $Text command. ```MacroScript %s=prompt("Password","Input password:",0x02); $Text %s ``` -------------------------------- ### Install uchardet executable Source: https://github.com/fargroup/farmanager/blob/master/far/thirdparty/uchardet/tools/CMakeLists.txt Installs the uchardet executable to the binary directory and configures export targets. ```cmake install( TARGETS ${UCHARDET_BINARY} EXPORT UchardetTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ``` -------------------------------- ### Example: GetLastWriteTime Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/winapi/getfiletime.html This example demonstrates how to retrieve the last-write time for a file and format it as a string. ```APIDOC ## GetLastWriteTime Example ### Description This function retrieves the last-write time for a file and formats it into a string. ### Parameters - **hFile** (HANDLE) - Handle to the file. - **lpszString** (LPSTR) - Pointer to a buffer to store the formatted time string. ### Return Value - TRUE if the time was successfully retrieved and formatted. - FALSE if GetFileTime fails. ### Code ```c BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString) { FILETIME ftCreate, ftAccess, ftWrite; SYSTEMTIME stUTC, stLocal; // get file time and date if (!GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite)) return FALSE; // convert modification time to local time. FileTimeToSystemTime(&ftWrite, &stUTC); SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal); // convert retrieved time to string wsprintf(lpszString, "%02d/%02d/%d %02d:%02d", stLocal.wDay, stLocal.wMonth, stLocal.wYear, stLocal.wHour, stLocal.wMinute); return TRUE; } ``` ``` -------------------------------- ### JAR Archive Header Dump Example Source: https://github.com/fargroup/farmanager/blob/master/plugins/multiarc/arc.doc/jar.txt This example shows the text-based format of a JAR archive header dump, as generated by the 'lt' command. It illustrates the hierarchical structure using indentation and key-value pairs. ```text Chapter=1 Created=1996-09-01 17:55:05.9800000 Modified=1996-09-01 17:55:05.9800000 Comment="Some\r\ncomment" Flags=0 File=FIRST.BAT Created=1996-09-01 17:20:41.4400000 Modified=1996-09-01 16:37:00.0000000 LastAccess=1996-09-01 00:00:00.0000000 Size=2160 ChaptersRange=1-2 Attributes=1 File=SECOND.BAT Created=1996-09-01 17:20:41.4400000 Modified=1996-09-01 16:37:00.0000000 LastAccess=1996-09-01 00:00:00.0000000 Size=2160 ChaptersRange=1-2 Attributes=1 ``` -------------------------------- ### Editor Drawing and Input Loop Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/examples.html This example demonstrates how to draw pseudo-graphics lines and tables in the FAR editor using an infinite loop. It utilizes ECTL_READINPUT and ECTL_PROCESSINPUT commands for processing user input within the editor. ```cpp HANDLE WINAPI _export OpenPlugin(int OpenFrom,INT_PTR Item) { ... while (!Done) { Info.EditorControl(ECTL_READINPUT,&rec); ... Info.EditorControl(ECTL_PROCESSINPUT,&rec); } ... } ``` -------------------------------- ### Example Usage of InitDialogItems in Config Function Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/addons/initdialogitems.html This C example demonstrates how to use the InitDialogItems function within a plugin's configuration dialog. It shows the declaration and initialization of an InitDialogItem array, the creation of a corresponding FarDialogItem array, the call to InitDialogItems, and finally, the invocation of the Far Manager dialog API. ```c int Config() { struct InitDialogItem InitItems []={ DI_DOUBLEBOX,3,1,72,8,0,0,0,0,(char *)MConfigTitle, DI_CHECKBOX,5,2,0,0,0,0,0,0,(char *)MConfigAddToDisksMenu, . . . DI_BUTTON,0,7,0,0,0,0,DIF_CENTERGROUP,1,(char *)MOk, DI_BUTTON,0,7,0,0,0,0,DIF_CENTERGROUP,0,(char *)MCancel }; struct FarDialogItem DialogItems[sizeof(InitItems)/sizeof(InitItems[0])]; . . . InitDialogItems(InitItems,DialogItems,sizeof(InitItems)/sizeof(InitItems[0])); . . . int ExitCode=Info.Dialog(Info.ModuleNumber, -1,-1,76,10, "TempCfg",DialogItems, sizeof(DialogItems)/sizeof(DialogItems[0])); if (ExitCode != 7) return(FALSE); . . . } ``` -------------------------------- ### ACTL_GETDESCSETTINGS Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/advcontrol.html Returns information about file description settings as a DWORD with FarDescriptionSettings flags. Param is ignored. ```C++ DWORD Descriptions = AdvControl(ModuleNumber, ACTL_GETDESCSETTINGS, 0); ``` -------------------------------- ### Example Macro Sequence with $MMode Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/mmode.html This example shows how to insert the current time into a macro sequence, utilizing $MMode 1 to control screen refreshing during the process. It's defined within the Windows Registry. ```ini REGEDIT4 ;insert the current time [HKEY_CURRENT_USER\Software\Far\KeyMacros\Common\CtrlT] "Sequence"="$If (Editor || Dialog) $Date \"%H:%M:%S\" CtrlU Space $Else $MMode 1 CtrlT $End" "DisableOutput"=dword:00000001 ``` -------------------------------- ### While Loop Example in Registry Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/while.html This example demonstrates how to set a macro to repeatedly move the cursor down as long as the current panel displays a folder and has not reached the end of the file list. This is typically configured within the Windows Registry. ```ini ;set the cursor to the nearest file in the panel [HKEY_CURRENT_USER\Software\Far\KeyMacros\Shell\AltAdd] "Sequence"="$While (APanel.Folder && !APanel.Eof) Down $End" "DisableOutput"=dword:00000001 ``` -------------------------------- ### ACTL_GETPANELSETTINGS Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/advcontrol.html Returns information about panel settings as a DWORD with FarPanelSettings flags. Param is ignored. ```C++ DWORD Panels = AdvControl(ModuleNumber, ACTL_GETPANELSETTINGS, 0); ``` -------------------------------- ### ACTL_KEYMACRO Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/advcontrol.html Performs various actions with macro commands. Param points to an ActlKeyMacro structure. ```C++ ActlKeyMacro MacroInfo; // ... fill MacroInfo structure ... AdvControl(ModuleNumber, ACTL_KEYMACRO, &MacroInfo); ``` -------------------------------- ### Directly Calling FSF.itoa64 Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/fsf/itoa64.html This example shows the direct invocation of the FSF.itoa64 function to convert a 64-bit integer to a string. ```C Info.FSF->itoa64(Value64,Str,10); ``` -------------------------------- ### ACTL_GETCONFIRMATIONS Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/advcontrol.html Returns information about confirmation settings as a DWORD with FarConfirmationsSettings flags. Param is ignored. ```C++ DWORD Confirmations = AdvControl(ModuleNumber, ACTL_GETCONFIRMATIONS, 0); ``` -------------------------------- ### SetStartupInfo Initialization Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/showhelp.html Example of how the global 'Info' structure is initialized within the SetStartupInfo function, which is crucial for the convenience ShowHelp wrapper to function correctly. ```c void WINAPI _export SetStartupInfo(const struct PluginStartupInfo *Info) { . . . ::Info=*Info; . . . } ``` -------------------------------- ### CharTable Function Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/chartable.html The CharTable function retrieves information about installed character tables. It can be used to autodetect the character table for a given text or to get details about a specific character table. ```APIDOC ## CharTable Function ### Description Retrieves information about installed character tables. Supports autodetecting character tables for given text and retrieving details about specific character tables. ### Signature ```c int WINAPI CharTable( int Command, char *Buffer, int BufferSize ); ``` ### Parameters #### Command - **Command** (int) - Required - Either the number of the requested character table or one of the following commands (the FARCHARTABLE_COMMAND enum): - **FCT_DETECT**: Autodetect the character table for given text. #### Buffer - **Buffer** (char*) - Required - If `Command` is equal to `FCT_DETECT`, specifies the address of a buffer with text data. Otherwise, specifies the address of a `CharTableSet` structure that receives information about the requested character table. #### BufferSize - **BufferSize** (int) - Required - If `Command` is `FCT_DETECT`, `BufferSize` should contain the size of the buffer with text data to analyze. Otherwise, it is the size of the `CharTableSet` structure. ### Return Value - Returns -1 if the requested table is not present or autodetection failed. - If successful, returns the number of the requested table and fills the structure pointed by `Buffer`. - In `FCT_DETECT` mode, returns the number of the detected table and does not change `Buffer` data. ### Remarks 1. To enumerate all FAR character tables, start with `Command` equal to 0 and increment it until the return value will be -1. 2. The `CharTableSet` structure is filled with OEM data if there were problems while reading settings of some table (when `Command` does not equal `FCT_DETECT`). ``` -------------------------------- ### Initializing PluginStartupInfo Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/menu.html Shows how the global PluginStartupInfo variable 'Info' is initialized using the SetStartupInfo function. ```c void WINAPI _export SetStartupInfo(struct PluginStartupInfo *Info) { ... ::Info=*Info; ... } ``` -------------------------------- ### Example Usage of LocMsg for Boolean String Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/addons/locmsg.html This snippet demonstrates how to use LocMsg to retrieve a string value and interpret it as a boolean. It calls LocMsg to get the value of 'IsSkipNoWord', and then converts the first character of the returned string to a boolean. ```C BOOL IsSkipNoWord; char *p; p=LocMsg("IsSkipNoWord",NULL,1); IsSkipNoWord=(\*p != '0')?TRUE:FALSE; ``` -------------------------------- ### Creating and Displaying a Simple Menu Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/menu.html Example from the EditCase plugin showing how to initialize FarMenuItem structures and call the Menu function. ```c struct FarMenuItem MenuItems[2]; memset(MenuItems,0,sizeof(MenuItems)); strcpy(MenuItems[0].Text,GetMsg(MCaseLower)); strcpy(MenuItems[1].Text,GetMsg(MCaseUpper)); MenuItems[0].Selected=TRUE; int MenuCode=Info.Menu(Info.ModuleNumber,-1,- 1,0,FMENU_AUTOHIGHLIGHT|FMENU_WRAPMODE, GetMsg(MCaseConversion),NULL, "Contents",NULL,NULL, MenuItems, sizeof(MenuItems)/sizeof(MenuItems[0])); if (MenuCode<0) return(INVALID_HANDLE_VALUE); . . . ``` -------------------------------- ### Manipulate Text Blocks Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/functions.html Provides actions for managing blocks of text, including getting block parameters (start/end lines/positions, type) and manipulating the cursor within a block. Also allows setting block start and end positions. ```Macro V=Editor.Sel(Action\[,Opt\]) ``` -------------------------------- ### Initialize Plugin Startup Info and FSF Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/fsf/index.html This code initializes the global PluginStartupInfo and FarStandardFunctions structures. It's crucial for plugins to store and access FSF locally to ensure correct addressing. ```c static struct PluginStartupInfo Info; static struct FarStandardFunctions FSF; void _export SetStartupInfo(struct PluginStartupInfo *psInfo) { Info=*psInfo; FSF=*psInfo->FSF; Info.FSF=&FSF; // now Info.FSF will point to the correct local address ... ``` -------------------------------- ### Using FSF.itoa64 via Function Pointer Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/fsf/itoa64.html This example demonstrates how to define a function pointer for FSF.itoa64, initialize it, and then use it to convert a 64-bit integer to a string. ```C FARSTDITOA64 FarItoa64; ... FarItoa64=Info.FSF->itoa64; ... FarItoa64(Value64,Str,10); ``` -------------------------------- ### Dialog Initialization and Call Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/dialogapi/dialog.html Demonstrates initializing dialog items and calling the Dialog function. The ExitCode is checked to determine user interaction. ```c struct FarDialogItem DialogItems[sizeof(InitItems)/sizeof(InitItems[0])]; . . . InitDialogItems(InitItems,DialogItems, sizeof(InitItems)/sizeof(InitItems[0])); . . . int ExitCode=Info.Dialog(Info.ModuleNumber, -1,-1,76,10, "TempCfg",DialogItems, sizeof(DialogItems)/sizeof(DialogItems[0])); **if (ExitCode != 7)** return(FALSE); . . . ``` -------------------------------- ### PluginStartupInfo Structure and Initialization Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/getmsg.html Demonstrates the declaration of the global PluginStartupInfo structure and its initialization within the SetStartupInfo function, which is crucial for GetMsg to access plugin information. ```c struct PluginStartupInfo Info; void WINAPI _export SetStartupInfo(struct PluginStartupInfo *Info) { ... ::Info=*Info; ... } ``` -------------------------------- ### ACTL_GETFARVERSION - Get Version Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/advcontrol.html Gets the FAR version. Param can point to a DWORD or be NULL. Returns the FAR version. ```C++ DWORD Version = AdvControl(ModuleNumber, ACTL_GETFARVERSION, NULL); ``` -------------------------------- ### EditorSelect Structure Definition Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/structures/editorselect.html Defines the structure for text selection in the FAR editor. Fields specify block type, start line, start position, width, and height. ```c struct EditorSelect { int BlockType; int BlockStartLine; int BlockStartPos; int BlockWidth; int BlockHeight; }; ``` -------------------------------- ### Shannon-Fano Tree Example Decoding Source: https://github.com/fargroup/farmanager/blob/master/plugins/multiarc/arc.doc/ZIP.Appnote.PKWARE.6.3.2.txt Demonstrates the decoding of a small Shannon-Fano tree example. It shows how the encoded bytes translate into bit lengths and then into the original bit length array. ```plaintext Example: 0x02, 0x42, 0x01, 0x13 The first byte indicates 3 values in this table. Decoding the bytes: 0x42 = 5 codes of 3 bits long 0x01 = 1 code of 2 bits long 0x13 = 2 codes of 4 bits long This would generate the original bit length array of: (3, 3, 3, 3, 3, 2, 4, 4) ``` -------------------------------- ### PPMd Parameter Packing Example Source: https://github.com/fargroup/farmanager/blob/master/plugins/multiarc/arc.doc/ZIP.Appnote.PKWARE.6.3.2.txt Illustrates how to pack Model order, Sub-allocator size, and Model restoration method into a 2-byte storage field for PPMd compression. Values are stored in Intel low-byte/high-byte order. ```C wPPMd = (Model order - 1) + ((Sub-allocator size - 1) << 4) + (Model restoration method << 12) ``` -------------------------------- ### Get Current Viewer File Name Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/faq.html This code snippet retrieves the name of the file currently loaded in the FarManager viewer. It uses the AdvControl function to get window information. ```c WindowInfo wi; wi.Pos=-1; Info.AdvControl(Info.ModuleNumber,ACTL_GETWINDOWINFO,&wi); // File name is in wi.Name. ``` -------------------------------- ### Save and Restore Command Line with Eval Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/functions.html This example demonstrates saving and restoring the command line using Eval with predefined macro sequences. It handles cases where the command line is not empty and preserves cursor position. ```MacroScript %%CmdSave=$If (!CmdLine.Empty) %Flg_Cmd=1; %CmdCurPos=CmdLine.ItemCount-CmdLine.CurPos+1; %CmdVal=CmdLine.Value; Esc $End ``` ```MacroScript %%CmdRestore=$If (%Flg_Cmd==1) $Text %CmdVal %Flg_Cmd=0; %Num=%CmdCurPos; $While (%Num!=0) %Num=%Num-1; CtrlS $End $End ``` -------------------------------- ### Get Active Panel Short Information Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/service_functions/control.html Use FCTL_GETPANELSHORTINFO to get general information about the active panel without details on individual items. The PanelItems and SelectedItems fields in PanelInfo will be NULL. ```C++ PanelInfo PInfo; Info.Control(INVALID_HANDLE_VALUE, FCTL_GETPANELSHORTINFO, &PInfo); ``` -------------------------------- ### DLL Entry Point with Initialization Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/articles/bonus/figures.hood0101.html A custom DLL entry point (`_DllMainCRTStartup`) that initializes the atexit table and calls C++ constructors using `_initterm` on process attachment. It also ensures cleanup via `_DoExit` on process detachment. ```cpp #include #include "initterm.h" // Force the linker to include KERNEL32.LIB #pragma comment(linker, "/defaultlib:kernel32.lib") // Force 512 byte section alignment in the PE file #pragma comment(linker, "/OPT:NOWIN98") // #pragma comment(linker, "/nodefaultlib:libc.lib") // #pragma comment(linker, "/nodefaultlib:libcmt.lib") // User routine DllMain is called on all notifications extern BOOL WINAPI DllMain( HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved ) ; // // Modified version of the Visual C++ startup code. Simplified to // make it easier to read. Only supports ANSI programs. // extern "C" BOOL WINAPI _DllMainCRTStartup( HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved ) { if ( dwReason == DLL_PROCESS_ATTACH ) { // set up our minimal cheezy atexit table _atexit_init(); // Call C++ constructors _initterm( __xc_a, __xc_z ); } BOOL retcode = DllMain(hDllHandle, dwReason, lpreserved); if ( dwReason == DLL_PROCESS_DETACH ) { _DoExit(); } return retcode ; } ``` -------------------------------- ### FAR Manager Macro Assignment Dialog Color Change Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/dialogapi/dmsg/dn_ctlcolordlgitem.html This example demonstrates how the FAR Manager macro assignment dialog modifies the color of an input field using the DN_CTLCOLORDLGITEM event. ```c case DN_CTLCOLORDLGITEM: // Unchanged resides in the Lo byte of the Hi word. Param2&=0xFF00FFFFU; Param2|=(Param2&0xFF)<<16; return Param2; ``` -------------------------------- ### Get FAR Module Path Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/faq.html Retrieve the full path of the FAR Manager module from within a plugin. This uses Win32 API functions to get the module's filename and then its full path. ```C++ char lpName[\_MAX_PATH], lpFullPath[_MAX_PATH]; LPTSTR lpFile; [GetModuleFileName](win32/GetModuleFileName.html)(NULL,lpName,sizeof(lpName)); [GetFullPathName](win32/GetFullPathName.html)(lpName,sizeof(lpFullPath),lpFullPath,&lpFile); *lpFile='\0'; ``` -------------------------------- ### MakeDirectory Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/exported_functions/index_panel.html Creates a new directory. ```APIDOC ## MakeDirectory ### Description Creates a new directory. ### Method [Not specified in source] ### Endpoint [Not specified in source] ``` -------------------------------- ### Simple Hello World Program Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/articles/bonus/msdnmag-issues-01-01-hood-default.aspx.html A basic C program that prints "Hello World!" to the console. This example is used to illustrate the code size of a minimal program using the standard C runtime library. ```c #include void main() { printf ("Hello World!\n" ); } ``` -------------------------------- ### Minimal DLL Startup Code (_DllMainCRTStartup) Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/articles/bonus/msdnmag-issues-01-01-hood-default.aspx.html This is the minimal DLL startup code that executes before your DllMain routine when a DLL is loaded. It handles initialization and notification calls. ```c++ #pragma comment(linker, "/OPT:NOWIN98") ``` -------------------------------- ### ARJ Archive Header Example (Hex Dump) Source: https://github.com/fargroup/farmanager/blob/master/plugins/multiarc/arc.doc/arj.txt A hexadecimal dump of an ARJ archive header, showing the byte-level representation of the file's metadata and structure. This example includes header IDs, sizes, flags, and the filename. ```hex 000000: 60 EA 2C 00 22 66 01 0B 10 00 02 1B 1B A1 90 2E `.,."f.......... ``` ```hex 000010: 1B A1 90 2E 00 00 00 00 00 00 00 00 00 00 00 00 ................ ``` ```hex 000020: 00 00 00 00 00 00 74 65 73 74 2E 41 52 4A 00 00 ......test.ARJ.. ``` ```hex 000030: DB CE 25 E7 00 00 ..% ``` ```hex 000036: 60 EA 32 00 2E 66 01 0B 10 00 `.2..f.... 000040: 00 00 1B 18 A1 90 2E 08 00 00 00 08 00 00 00 F9 C3 ................ 000050: 3E B9 00 00 20 00 00 00 00 00 00 00 18 A1 90 2E >... ................ 000060: 50 98 90 2E 08 00 00 00 61 61 00 00 75 4A 10 30 P.......aa..uJ.0 000070: 00 00 54 75 72 62 6F 58 58 58 ..TurboXXX 00007A: 60 EA 00 00 `... ``` -------------------------------- ### Example Symbols and Bit Lengths Source: https://github.com/fargroup/farmanager/blob/master/plugins/newarc.ex/Modules/d5d/Source/zlib/algorithm.txt Illustrates a set of symbols with their corresponding bit representations and lengths, used to demonstrate the inflate algorithm's table construction. ```text A: 0 B: 10 C: 1100 D: 11010 E: 11011 F: 11100 G: 11101 H: 11110 I: 111110 J: 111111 ``` -------------------------------- ### DM_LISTGETCURPOS Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/dialogapi/dmsg/index_dm.html Gets the current position in a list. ```APIDOC ## DM_LISTGETCURPOS ### Description Retrieves the current position (index) of the selected item or cursor within a list control. ### Method Not specified (likely a function call or message passing mechanism). ### Endpoint N/A ### Parameters N/A (Specific parameters depend on the underlying implementation) ### Request Example N/A ### Response N/A ``` -------------------------------- ### DM_GETTEXTLENGTH Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/dialogapi/dmsg/index_dm.html Gets the length of a text string. ```APIDOC ## DM_GETTEXTLENGTH ### Description Gets the length (number of characters) of a text string associated with an edit control or dialog item. ### Method Not specified (likely a function call or message passing mechanism). ### Endpoint N/A ### Parameters N/A (Specific parameters depend on the underlying implementation) ### Request Example N/A ### Response N/A ``` -------------------------------- ### Switch Between Windows using CapsLock Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/functions.html This example shows a robust way to implement a hotkey (Ctrl+CapsLock) for switching between windows, ensuring stability by checking and reversing the CapsLock state within a loop. It uses 'flock' and 'sleep'. ```MacroScript CtrlShiftTab %a=flock(1,-1)&1; $while((flock(1,-1)&1)==%a) sleep(50) flock(1,2) $end ``` -------------------------------- ### DM_GETCURSORSIZE Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/dialogapi/dmsg/index_dm.html Gets the current cursor size. ```APIDOC ## DM_GETCURSORSIZE ### Description Retrieves the current size of the cursor. ### Method Not specified (likely a function call or message passing mechanism). ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Conditional Macro Exit Example Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/exit.html This registry example demonstrates using $Exit within a conditional block to stop macro execution based on specific criteria. It shows how to integrate macro commands into the registry for custom key bindings. ```registry REGEDIT4 ;remove the selected characters from the command line [HKEY_CURRENT_USER\Software\Far\KeyMacros\Common\ShiftDel] "Sequence"="$If (Qview || Shell) $If (!APanel.Visible) ShiftDel $Exit $End CtrlO ShiftDel CtrlO $Else ShiftDel $End" "DisableOutput"=dword:00000001 "NotEmptyCommandLine"=dword:00000001 ``` -------------------------------- ### Example $Rep Macro Command Usage Source: https://github.com/fargroup/farmanager/blob/master/enc/enc_eng/meta/macro/macrocmd/rep.html This example demonstrates how to use the $Rep command within a FAR Manager macro to repeat a sequence of actions. It shows how to define a loop that executes twice, conditionally executing 'Esc' if the shell is not active. ```macro REGEDIT4 ;exit FAR Manager [HKEY_CURRENT_USER\Software\Far\KeyMacros\Common\AltX] "Sequence"="$If (Editor && (Editor.State & 0x8)) F2 $End $Rep (2) $If (!Shell) Esc $End $End F10" ``` ```macro "DisableOutput"=dword:00000001 ``` -------------------------------- ### Include Headers for zlib and File I/O Source: https://github.com/fargroup/farmanager/blob/master/plugins/newarc.ex/Modules/d5d/Source/zlib/examples/zlib_how.html Includes necessary headers for standard input/output, string manipulation, assertions, and the zlib library functions. ```c #include #include #include #include "zlib.h" ```