--------------------------------------------------------------------------------
-- Far Manager's sets of globals
-- version: 1.7-far6498.lm882
--------------------------------------------------------------------------------
local empty, read_write = {}, {read_only=false}
local mutable = {other_fields=true,read_only=false}

local function def_fields(t,default)
  local fields = {}
  for _,field in ipairs(t) do
    if type(field)=="table" then --unpack
      fields[field.name] = field.props
    else
      fields[field] = default or empty
    end
  end
  return {fields=fields}
end

local function pack(field,props)
  return {name=field,props=props}
end

local function include(field,default)
  return function(t)
    return pack(field,def_fields(t,default))
  end
end

local function read_globals(t)
  return {read_globals=def_fields(t).fields}
end

local function combine(dest,source)
  for k,v in pairs(source.read_globals) do dest.read_globals[k] = v end
  return dest
end

-------------------------------
local function rw_field(field)
  return pack(field,read_write)
end

local function mu_table(field)
  return pack(field,mutable)
end

--------------------------------------------------------------------------------
local utf8_str = def_fields {
  "byte","char","charpattern","charpos","clean","codepoint","codes","dump","escape",
  "find","fold","format","gmatch","gsub","insert","invalidoffset","isnfc","isvalid",
  "len","lower","match","ncasecmp","next","normalize_nfc","offset","reformat",
  "remove","rep","reverse","sub","title","upper","utf8valid","width","widthindex",
}
local utf8_rw_str = {fields=utf8_str.fields,read_only=false}
local function str(field) return pack(field,utf8_str) end
local function rw_str(field) return pack(field,utf8_rw_str) end

--------------------------------------------------------------------------------
local lflua = read_globals {

  include "bit64" {
    "add","arshift","band","bnot","bor","bxor","div","eq","le","lshift","lt","mod",
    "mul","new","rshift","sub","type",
  },
  pack("utf8",utf8_str),

  include "win" {
    "CompareString","CopyFile","CreateDir","DeleteFile","DeleteRegKey","DeleteRegValue",
    "EnumRegKey","EnumRegValue","EnumSystemCodePages","ExtractKey","ExtractKeyEx",
    "FileTimeToLocalFileTime","FileTimeToSystemTime","GetACP","GetCPInfo","GetConsoleCP",
    "GetConsoleOutputCP","GetConsoleScreenBufferInfo","GetCurrentDir","GetDriveType",
    "GetEnv","GetFileAttr","GetFileInfo","GetFileTimes","GetKeyState","GetLocalTime",
    "GetLogicalDriveStrings","GetOEMCP","GetRegKey","GetSystemTime","GetSystemTimeAsFileTime",
    "GetVirtualKeys","GlobalMemoryStatus","IsProcess64bit","IsWinVersion","JoinPath",
    "MoveFile","MultiByteToWideChar","OemToUtf8","OutputDebugString","RemoveDir",
    "RenameFile","ReplaceFile","SHGetFolderPath","SearchPath","SetConsoleCP","SetConsoleOutputCP",
    "SetCurrentDir","SetEnv","SetFileAttr","SetFileTimes","SetRegKey","ShellExecute",
    "Sleep","SystemTimeToFileTime","Utf16ToUtf8","Utf8ToOem","Utf8ToUtf16","Uuid",
    "WideCharToMultiByte","WriteConsole","lenW","subW","system","wcscmp",
  },
}
--------------------------------------------------------------------------------
local luafar = read_globals {
  rw_field "IsLuaStateRecreated",rw_field "RecreateLuaState","_luaplug",
  include "actl" {
    "Commit","GetArrayColor","GetColor","GetCursorPos","GetFarHwnd","GetFarManagerVersion",
    "GetFarRect","GetWindowCount","GetWindowInfo","GetWindowType","ProgressNotify",
    "Quit","RedrawAll","SetArrayColor","SetCurrentWindow","SetCursorPos","SetProgressState",
    "SetProgressValue","Synchro","Waitkey",
  },
  include "editor" {
    "AddColor","AddSessionBookmark","ClearSessionBookmarks","DelColor","DeleteBlock",
    "DeleteChar","DeleteSessionBookmark","DeleteString","Editor","ExpandTabs","GetBookmarks",
    "GetColor","GetFileName","GetInfo","GetSelection","GetSessionBookmarks","GetString",
    "GetStringW","GetTitle","InsertString","InsertText","InsertTextW","NextSessionBookmark",
    "PrevSessionBookmark","ProcessInput","Quit","ReadInput","RealToTab","Redraw",
    "SaveFile","Select","SetKeyBar","SetParam","SetPosition","SetString","SetStringW",
    "SetTitle","SubscribeChangeEvent","TabToReal","UndoRedo",
  },
  include ("export",read_write) {
    "Analyse","CloseAnalyse","ClosePanel","Compare","Configure","DeleteFiles","ExitFAR",
    "FreeFindData","GetContentData","GetContentFields","GetFiles","GetFindData",
    "GetGlobalInfo","GetOpenPanelInfo","GetPluginInfo","MakeDirectory","OnError",
    "Open","ProcessConsoleInput","ProcessDialogEvent","ProcessEditorEvent","ProcessEditorInput",
    "ProcessHostFile","ProcessPanelEvent","ProcessPanelInput","ProcessSynchroEvent",
    "ProcessViewerEvent","PutFiles","SetDirectory","SetFindList","SetStartupInfo",
  },
  include "far" {
    "AdvControl","CPluginStartupInfo","CheckMask","CmpName","CmpNameList","ColorDialog",
    "ConvertPath","CopyToClipboard","CreateFileFilter","CreateSettings","CreateUserControl",
    "DetectCodePage","Dialog","DialogFree","DialogInit","DialogRun","FarClock",
    "FileTimeResolution","FindPlugin","ForcedLoadPlugin","FormatFileSize","FreeScreen",
    "FreeSettings","GenerateName","GetCurrentDirectory","GetDirList","GetDlgItem",
    "GetFileOwner","GetLuafarVersion","GetMsg","GetNumberOfLinks","GetPathRoot",
    "GetPluginDirList","GetPluginId","GetPluginInformation","GetPlugins","GetReparsePointInfo",
    "InputBox","InputRecordToName","IsPluginLoaded","LIsAlpha","LIsAlphanum","LIsLower",
    "LIsUpper","LLowerBuf","LStricmp","LStrnicmp","LUpperBuf","LoadPlugin","MacroAdd",
    "MacroCheck","MacroDelete","MacroExecute","MacroGetArea","MacroGetLastError",
    "MacroGetState","MacroLoadAll","MacroPost","MacroSaveAll","MakeMenuItems","Menu",
    "Message","MkLink","MkTemp","NameToInputRecord","PasteFromClipboard","PluginStartupInfo",
    "ProcessName","RecursiveSearch",rw_field "ReloadDefaultScript","RestoreScreen",
    "RunDefaultScript","SaveScreen","SendDlgMessage","SetDlgItem","Show","ShowHelp",
    "SubscribeDialogDrawEvents","Text","Timer","TruncPathStr","TruncStr","UnloadPlugin",
    "XLat",
    include "Colors" {
      "COL_CLOCK","COL_COMMANDLINE","COL_COMMANDLINEPREFIX","COL_COMMANDLINESELECTED",
      "COL_COMMANDLINEUSERSCREEN","COL_DIALOGBOX","COL_DIALOGBOXTITLE","COL_DIALOGBUTTON",
      "COL_DIALOGCOMBOARROWS","COL_DIALOGCOMBOARROWSDISABLED","COL_DIALOGCOMBOARROWSSELECTED",
      "COL_DIALOGCOMBOBOX","COL_DIALOGCOMBODISABLED","COL_DIALOGCOMBOGRAY","COL_DIALOGCOMBOHIGHLIGHT",
      "COL_DIALOGCOMBOSCROLLBAR","COL_DIALOGCOMBOSELECTEDGRAYTEXT","COL_DIALOGCOMBOSELECTEDHIGHLIGHT",
      "COL_DIALOGCOMBOSELECTEDTEXT","COL_DIALOGCOMBOTEXT","COL_DIALOGCOMBOTITLE",
      "COL_DIALOGDEFAULTBUTTON","COL_DIALOGDISABLED","COL_DIALOGEDIT","COL_DIALOGEDITDISABLED",
      "COL_DIALOGEDITSELECTED","COL_DIALOGEDITUNCHANGED","COL_DIALOGHIGHLIGHTBOXTITLE",
      "COL_DIALOGHIGHLIGHTBUTTON","COL_DIALOGHIGHLIGHTDEFAULTBUTTON","COL_DIALOGHIGHLIGHTSELECTEDBUTTON",
      "COL_DIALOGHIGHLIGHTSELECTEDDEFAULTBUTTON","COL_DIALOGHIGHLIGHTTEXT","COL_DIALOGLISTARROWS",
      "COL_DIALOGLISTARROWSDISABLED","COL_DIALOGLISTARROWSSELECTED","COL_DIALOGLISTBOX",
      "COL_DIALOGLISTDISABLED","COL_DIALOGLISTGRAY","COL_DIALOGLISTHIGHLIGHT","COL_DIALOGLISTSCROLLBAR",
      "COL_DIALOGLISTSELECTEDGRAYTEXT","COL_DIALOGLISTSELECTEDHIGHLIGHT","COL_DIALOGLISTSELECTEDTEXT",
      "COL_DIALOGLISTTEXT","COL_DIALOGLISTTITLE","COL_DIALOGSELECTEDBUTTON","COL_DIALOGSELECTEDDEFAULTBUTTON",
      "COL_DIALOGTEXT","COL_EDITORCLOCK","COL_EDITORSCROLLBAR","COL_EDITORSELECTEDTEXT",
      "COL_EDITORSTATUS","COL_EDITORTEXT","COL_HELPBOX","COL_HELPBOXTITLE","COL_HELPHIGHLIGHTTEXT",
      "COL_HELPSCROLLBAR","COL_HELPSELECTEDTOPIC","COL_HELPTEXT","COL_HELPTOPIC",
      "COL_HMENUHIGHLIGHT","COL_HMENUSELECTEDHIGHLIGHT","COL_HMENUSELECTEDTEXT",
      "COL_HMENUTEXT","COL_KEYBARBACKGROUND","COL_KEYBARNUM","COL_KEYBARTEXT","COL_LASTPALETTECOLOR",
      "COL_MENUARROWS","COL_MENUARROWSDISABLED","COL_MENUARROWSSELECTED","COL_MENUBOX",
      "COL_MENUDISABLEDTEXT","COL_MENUGRAYTEXT","COL_MENUHIGHLIGHT","COL_MENUSCROLLBAR",
      "COL_MENUSELECTEDGRAYTEXT","COL_MENUSELECTEDHIGHLIGHT","COL_MENUSELECTEDTEXT",
      "COL_MENUTEXT","COL_MENUTITLE","COL_PANELBOX","COL_PANELCOLUMNTITLE","COL_PANELCURSOR",
      "COL_PANELDRAGTEXT","COL_PANELHIGHLIGHTTEXT","COL_PANELINFOTEXT","COL_PANELSCREENSNUMBER",
      "COL_PANELSCROLLBAR","COL_PANELSELECTEDCURSOR","COL_PANELSELECTEDINFO","COL_PANELSELECTEDTEXT",
      "COL_PANELSELECTEDTITLE","COL_PANELTEXT","COL_PANELTITLE","COL_PANELTOTALINFO",
      "COL_VIEWERARROWS","COL_VIEWERCLOCK","COL_VIEWERSCROLLBAR","COL_VIEWERSELECTEDTEXT",
      "COL_VIEWERSTATUS","COL_VIEWERTEXT","COL_WARNDIALOGBOX","COL_WARNDIALOGBOXTITLE",
      "COL_WARNDIALOGBUTTON","COL_WARNDIALOGCOMBOARROWS","COL_WARNDIALOGCOMBOARROWSDISABLED",
      "COL_WARNDIALOGCOMBOARROWSSELECTED","COL_WARNDIALOGCOMBOBOX","COL_WARNDIALOGCOMBODISABLED",
      "COL_WARNDIALOGCOMBOGRAY","COL_WARNDIALOGCOMBOHIGHLIGHT","COL_WARNDIALOGCOMBOSCROLLBAR",
      "COL_WARNDIALOGCOMBOSELECTEDGRAYTEXT","COL_WARNDIALOGCOMBOSELECTEDHIGHLIGHT",
      "COL_WARNDIALOGCOMBOSELECTEDTEXT","COL_WARNDIALOGCOMBOTEXT","COL_WARNDIALOGCOMBOTITLE",
      "COL_WARNDIALOGDEFAULTBUTTON","COL_WARNDIALOGDISABLED","COL_WARNDIALOGEDIT",
      "COL_WARNDIALOGEDITDISABLED","COL_WARNDIALOGEDITSELECTED","COL_WARNDIALOGEDITUNCHANGED",
      "COL_WARNDIALOGHIGHLIGHTBOXTITLE","COL_WARNDIALOGHIGHLIGHTBUTTON","COL_WARNDIALOGHIGHLIGHTDEFAULTBUTTON",
      "COL_WARNDIALOGHIGHLIGHTSELECTEDBUTTON","COL_WARNDIALOGHIGHLIGHTSELECTEDDEFAULTBUTTON",
      "COL_WARNDIALOGHIGHLIGHTTEXT","COL_WARNDIALOGLISTARROWS","COL_WARNDIALOGLISTARROWSDISABLED",
      "COL_WARNDIALOGLISTARROWSSELECTED","COL_WARNDIALOGLISTBOX","COL_WARNDIALOGLISTDISABLED",
      "COL_WARNDIALOGLISTGRAY","COL_WARNDIALOGLISTHIGHLIGHT","COL_WARNDIALOGLISTSCROLLBAR",
      "COL_WARNDIALOGLISTSELECTEDGRAYTEXT","COL_WARNDIALOGLISTSELECTEDHIGHLIGHT",
      "COL_WARNDIALOGLISTSELECTEDTEXT","COL_WARNDIALOGLISTTEXT","COL_WARNDIALOGLISTTITLE",
      "COL_WARNDIALOGSELECTEDBUTTON","COL_WARNDIALOGSELECTEDDEFAULTBUTTON","COL_WARNDIALOGTEXT",
    },
    include "Flags" {
      "ACTL_COMMIT","ACTL_GETARRAYCOLOR","ACTL_GETCOLOR","ACTL_GETCURSORPOS","ACTL_GETFARHWND",
      "ACTL_GETFARMANAGERVERSION","ACTL_GETFARRECT","ACTL_GETWINDOWCOUNT","ACTL_GETWINDOWINFO",
      "ACTL_GETWINDOWTYPE","ACTL_PROGRESSNOTIFY","ACTL_QUIT","ACTL_REDRAWALL","ACTL_SETARRAYCOLOR",
      "ACTL_SETCURRENTWINDOW","ACTL_SETCURSORPOS","ACTL_SETPROGRESSSTATE","ACTL_SETPROGRESSVALUE",
      "ACTL_SYNCHRO","ACTL_WAITKEY","AKMFLAGS_NONE","ALPHAMASK","BACKGROUND_BLUE",
      "BACKGROUND_GREEN","BACKGROUND_INTENSITY","BACKGROUND_RED","BSTATE_3STATE",
      "BSTATE_CHECKED","BSTATE_TOGGLE","BSTATE_UNCHECKED","BTYPE_COLUMN","BTYPE_NONE",
      "BTYPE_STREAM","CAPSLOCK_ON","CBET_KEY","CBET_MOUSE","CDF_NONE","COLORMASK",
      "CPM_FULL","CPM_NATIVE","CPM_REAL","CP_DEFAULT","CP_REDETECT","CP_REVERSEBOM",
      "CP_UNICODE","CP_UTF16BE","CP_UTF16LE","CTRL_BREAK_EVENT","CTRL_CLOSE_EVENT",
      "CTRL_C_EVENT","CTRL_LOGOFF_EVENT","CTRL_SHUTDOWN_EVENT","CURRENT_EDITOR",
      "DE_DEFDLGPROCINIT","DE_DLGPROCEND","DE_DLGPROCINIT","DIF_3STATE","DIF_BOXCOLOR",
      "DIF_BTNNOCLOSE","DIF_CENTERGROUP","DIF_CENTERTEXT","DIF_DEFAULTBUTTON","DIF_DISABLE",
      "DIF_DROPDOWNLIST","DIF_EDITEXPAND","DIF_EDITOR","DIF_EDITPATH","DIF_EDITPATHEXEC",
      "DIF_FOCUS","DIF_GROUP","DIF_HIDDEN","DIF_HISTORY","DIF_HOMEITEM","DIF_LEFTTEXT",
      "DIF_LISTAUTOHIGHLIGHT","DIF_LISTNOAMPERSAND","DIF_LISTNOBOX","DIF_LISTNOCLOSE",
      "DIF_LISTTRACKMOUSE","DIF_LISTTRACKMOUSEINFOCUS","DIF_LISTWRAPMODE","DIF_MANUALADDHISTORY",
      "DIF_MASKEDIT","DIF_MOVESELECT","DIF_NOAUTOCOMPLETE","DIF_NOBRACKETS","DIF_NOFOCUS",
      "DIF_NONE","DIF_READONLY","DIF_RIGHTTEXT","DIF_SELECTONENTRY","DIF_SEPARATOR",
      "DIF_SEPARATOR2","DIF_SEPARATORUSER","DIF_SETSHIELD","DIF_SHOWAMPERSAND",
      "DIF_USELASTHISTORY","DIF_WORDWRAP","DI_BUTTON","DI_CHECKBOX","DI_COMBOBOX",
      "DI_DOUBLEBOX","DI_EDIT","DI_FIXEDIT","DI_LISTBOX","DI_PSWEDIT","DI_RADIOBUTTON",
      "DI_SINGLEBOX","DI_TEXT","DI_USERCONTROL","DI_VTEXT","DM_ADDHISTORY","DM_CLOSE",
      "DM_EDITUNCHANGEDFLAG","DM_ENABLE","DM_ENABLEREDRAW","DM_FIRST","DM_GETCHECK",
      "DM_GETCOMBOBOXEVENT","DM_GETCONSTTEXTPTR","DM_GETCURSORPOS","DM_GETCURSORSIZE",
      "DM_GETDIALOGINFO","DM_GETDIALOGTITLE","DM_GETDLGDATA","DM_GETDLGITEM","DM_GETDLGITEMSHORT",
      "DM_GETDLGRECT","DM_GETDROPDOWNOPENED","DM_GETEDITPOSITION","DM_GETFOCUS",
      "DM_GETITEMDATA","DM_GETITEMPOSITION","DM_GETSELECTION","DM_GETTEXT","DM_KEY",
      "DM_LISTADD","DM_LISTADDSTR","DM_LISTDELETE","DM_LISTFINDSTRING","DM_LISTGETCURPOS",
      "DM_LISTGETDATA","DM_LISTGETDATASIZE","DM_LISTGETITEM","DM_LISTGETTITLES",
      "DM_LISTINFO","DM_LISTINSERT","DM_LISTSET","DM_LISTSETCURPOS","DM_LISTSETDATA",
      "DM_LISTSETTITLES","DM_LISTSORT","DM_LISTUPDATE","DM_MOVEDIALOG","DM_REDRAW",
      "DM_RESIZEDIALOG","DM_SET3STATE","DM_SETCHECK","DM_SETCOMBOBOXEVENT","DM_SETCURSORPOS",
      "DM_SETCURSORSIZE","DM_SETDLGDATA","DM_SETDLGITEM","DM_SETDLGITEMSHORT","DM_SETDROPDOWNOPENED",
      "DM_SETEDITPOSITION","DM_SETFOCUS","DM_SETHISTORY","DM_SETINPUTNOTIFY","DM_SETITEMDATA",
      "DM_SETITEMPOSITION","DM_SETMAXTEXTLENGTH","DM_SETMOUSEEVENTNOTIFY","DM_SETSELECTION",
      "DM_SETTEXT","DM_SETTEXTPTR","DM_SHOWDIALOG","DM_SHOWITEM","DM_USER","DN_BTNCLICK",
      "DN_CLOSE","DN_CONTROLINPUT","DN_CTLCOLORDIALOG","DN_CTLCOLORDLGITEM","DN_CTLCOLORDLGLIST",
      "DN_DRAGGED","DN_DRAWDIALOG","DN_DRAWDIALOGDONE","DN_DRAWDLGITEM","DN_DRAWDLGITEMDONE",
      "DN_DROPDOWNOPENED","DN_EDITCHANGE","DN_FIRST","DN_GETVALUE","DN_GOTFOCUS",
      "DN_HELP","DN_HOTKEY","DN_INITDIALOG","DN_INPUT","DN_KILLFOCUS","DN_LISTCHANGE",
      "DN_LISTHOTKEY","DN_RESIZECONSOLE","DOUBLE_CLICK","ECF_AUTODELETE","ECF_NONE",
      "ECF_TABMARKCURRENT","ECF_TABMARKFIRST","ECSTATE_LOCKED","ECSTATE_MODIFIED",
      "ECSTATE_SAVED","ECTYPE_ADDED","ECTYPE_CHANGED","ECTYPE_DELETED","EDITOR_COLOR_NORMAL_PRIORITY",
      "EEC_LOADING_INTERRUPTED","EEC_MODIFIED","EEC_NOT_MODIFIED","EEC_OPEN_ERROR",
      "EEREDRAW_ALL","EE_CHANGE","EE_CLOSE","EE_GOTFOCUS","EE_KILLFOCUS","EE_READ",
      "EE_REDRAW","EE_SAVE","EF_CREATENEW","EF_DELETEONCLOSE","EF_DELETEONLYFILEONCLOSE",
      "EF_DISABLEHISTORY","EF_DISABLESAVEPOS","EF_ENABLE_F6","EF_IMMEDIATERETURN",
      "EF_LOCKED","EF_NONMODAL","EF_OPENMODE_BREAKIFOPEN","EF_OPENMODE_MASK","EF_OPENMODE_NEWIFOPEN",
      "EF_OPENMODE_QUERY","EF_OPENMODE_RELOADIFOPEN","EF_OPENMODE_USEEXISTING",
      "ENABLE_AUTO_POSITION","ENABLE_ECHO_INPUT","ENABLE_EXTENDED_FLAGS","ENABLE_INSERT_MODE",
      "ENABLE_LINE_INPUT","ENABLE_MOUSE_INPUT","ENABLE_PROCESSED_INPUT","ENABLE_PROCESSED_OUTPUT",
      "ENABLE_QUICK_EDIT_MODE","ENABLE_WINDOW_INPUT","ENABLE_WRAP_AT_EOL_OUTPUT",
      "ENHANCED_KEY","EN_NONE","EOPT_AUTODETECTCODEPAGE","EOPT_AUTOINDENT","EOPT_BOM",
      "EOPT_CURSORBEYONDEOL","EOPT_DELREMOVESBLOCKS","EOPT_EXPANDALLTABS","EOPT_EXPANDONLYNEWTABS",
      "EOPT_PERSISTENTBLOCKS","EOPT_SAVEFILEPOSITION","EOPT_SHOWKEYBAR","EOPT_SHOWLINEBREAK",
      "EOPT_SHOWSCROLLBAR","EOPT_SHOWTITLEBAR","EOPT_SHOWWHITESPACE","ESPT_AUTOINDENT",
      "ESPT_CHARCODEBASE","ESPT_CODEPAGE","ESPT_CURSORBEYONDEOL","ESPT_EXPANDTABS",
      "ESPT_GETWORDDIV","ESPT_LOCKMODE","ESPT_SAVEFILEPOSITION","ESPT_SETBOM","ESPT_SETWORDDIV",
      "ESPT_SHOWWHITESPACE","ESPT_TABSIZE","EUR_BEGIN","EUR_END","EUR_REDO","EUR_UNDO",
      "EXPAND_ALLTABS","EXPAND_NEWTABS","EXPAND_NOTABS","FARMANAGERVERSION_BUILD",
      "FARMANAGERVERSION_MAJOR","FARMANAGERVERSION_MINOR","FARMANAGERVERSION_REVISION",
      "FARMANAGERVERSION_STAGE","FCF_4BITMASK","FCF_BG_4BIT","FCF_BG_INDEX","FCF_FG_4BIT",
      "FCF_FG_BLINK","FCF_FG_BOLD","FCF_FG_FAINT","FCF_FG_INDEX","FCF_FG_INVISIBLE",
      "FCF_FG_ITALIC","FCF_FG_OVERLINE","FCF_FG_STRIKEOUT","FCF_FG_UNDERLINE_INDEX",
      "FCF_FG_UNDERLINE_MASK","FCF_FG_U_DATA0","FCF_FG_U_DATA1","FCF_FG_U_DATA2",
      "FCF_INDEXMASK","FCF_INHERIT_STYLE","FCF_INVERSE","FCF_NONE","FCF_RAWATTR_MASK",
      "FCF_STYLE_MASK","FCT_ANY","FCT_COLUMN","FCT_STREAM","FDLG_KEEPCONSOLETITLE",
      "FDLG_NODRAWPANEL","FDLG_NODRAWSHADOW","FDLG_NONE","FDLG_NONMODAL","FDLG_SMALLDIALOG",
      "FDLG_STAY_ON_TOP","FDLG_WARNING","FE_BREAK","FE_CHANGESORTPARAMS","FE_CHANGEVIEWMODE",
      "FE_CLOSE","FE_COMMAND","FE_GOTFOCUS","FE_IDLE","FE_KILLFOCUS","FE_REDRAW",
      "FFFS_COMMAS","FFFS_ECONOMIC","FFFS_FLOATSIZE","FFFS_MINSIZEINDEX","FFFS_MINSIZEINDEX_MASK",
      "FFFS_NONE","FFFS_SHOWBYTESINDEX","FFFS_THOUSAND","FFT_COPY","FFT_CUSTOM",
      "FFT_FINDFILE","FFT_PANEL","FFT_SELECT","FHELP_CUSTOMFILE","FHELP_CUSTOMPATH",
      "FHELP_FARHELP","FHELP_GUID","FHELP_NONE","FHELP_NOSHOWERROR","FHELP_SELFHELP",
      "FHELP_USECONTENTS","FIB_BUTTONS","FIB_EDITPATH","FIB_EDITPATHEXEC","FIB_ENABLEEMPTY",
      "FIB_EXPANDENV","FIB_NOAMPERSAND","FIB_NONE","FIB_NOUSELASTHISTORY","FIB_PASSWORD",
      "FMENU_AUTOHIGHLIGHT","FMENU_CHANGECONSOLETITLE","FMENU_NODRAWSHADOW","FMENU_NONE",
      "FMENU_REVERSEAUTOHIGHLIGHT","FMENU_SHOWAMPERSAND","FMENU_SHOWNOBOX","FMENU_SHOWSHORTBOX",
      "FMENU_SHOWSINGLEBOX","FMENU_WRAPMODE","FMSG_ALLINONE","FMSG_ERRORTYPE","FMSG_KEEPBACKGROUND",
      "FMSG_LEFTALIGN","FMSG_MB_ABORTRETRYIGNORE","FMSG_MB_OK","FMSG_MB_OKCANCEL",
      "FMSG_MB_RETRYCANCEL","FMSG_MB_YESNO","FMSG_MB_YESNOCANCEL","FMSG_NONE","FMSG_WARNING",
      "FMVT_ARRAY","FMVT_BINARY","FMVT_BOOLEAN","FMVT_DOUBLE","FMVT_ERROR","FMVT_INTEGER",
      "FMVT_NIL","FMVT_PANEL","FMVT_POINTER","FMVT_STRING","FMVT_UNKNOWN","FOCUS_EVENT",
      "FOREGROUND_BLUE","FOREGROUND_GREEN","FOREGROUND_INTENSITY","FOREGROUND_RED",
      "FOSF_ACTIVE","FOSF_NONE","FPF_ANSI","FPF_LOADED","FPF_NONE","FROM_LEFT_1ST_BUTTON_PRESSED",
      "FROM_LEFT_2ND_BUTTON_PRESSED","FROM_LEFT_3RD_BUTTON_PRESSED","FROM_LEFT_4TH_BUTTON_PRESSED",
      "FRS_NONE","FRS_RECUR","FRS_RETUPDIR","FRS_SCANSYMLINK","FSETCLR_NONE","FSETCLR_REDRAW",
      "FSSF_CONFIRMATIONS","FSSF_DIALOG","FSSF_EDITOR","FSSF_FOLDERSHORTCUT_0",
      "FSSF_FOLDERSHORTCUT_1","FSSF_FOLDERSHORTCUT_2","FSSF_FOLDERSHORTCUT_3","FSSF_FOLDERSHORTCUT_4",
      "FSSF_FOLDERSHORTCUT_5","FSSF_FOLDERSHORTCUT_6","FSSF_FOLDERSHORTCUT_7","FSSF_FOLDERSHORTCUT_8",
      "FSSF_FOLDERSHORTCUT_9","FSSF_HISTORY_CMD","FSSF_HISTORY_EDIT","FSSF_HISTORY_EXTERNAL",
      "FSSF_HISTORY_FOLDER","FSSF_HISTORY_VIEW","FSSF_INTERFACE","FSSF_PANEL","FSSF_PANELLAYOUT",
      "FSSF_ROOT","FSSF_SCREEN","FSSF_SYSTEM","FST_DATA","FST_QWORD","FST_STRING",
      "FST_SUBKEY","FST_UNKNOWN","INDEXMASK","IPLFLAGS_NONE","IPLFLAGS_SEPARATOR",
      "KEY_EVENT","KEY_WOW64_32KEY","KEY_WOW64_64KEY","KMFLAGS_ENABLEOUTPUT","KMFLAGS_LANGMASK",
      "KMFLAGS_LUA","KMFLAGS_MOONSCRIPT","KMFLAGS_NONE","KMFLAGS_NOSENDKEYSTOPLUGINS",
      "KMFLAGS_SILENTCHECK","LEFT_ALT_PRESSED","LEFT_CTRL_PRESSED","LIFIND_EXACTMATCH",
      "LIFIND_NONE","LIF_CHECKED","LIF_DELETEUSERDATA","LIF_DISABLE","LIF_GRAYED",
      "LIF_HIDDEN","LIF_NONE","LIF_SELECTED","LIF_SEPARATOR","LINFO_AUTOHIGHLIGHT",
      "LINFO_NONE","LINFO_REVERSEHIGHLIGHT","LINFO_SHOWAMPERSAND","LINFO_SHOWNOBOX",
      "LINFO_WRAPMODE","LINK_HARDLINK","LINK_JUNCTION","LINK_SYMLINK","LINK_SYMLINKDIR",
      "LINK_SYMLINKFILE","LINK_VOLMOUNT","MACROAREA_COMMON","MACROAREA_DESKTOP",
      "MACROAREA_DIALOG","MACROAREA_DIALOGAUTOCOMPLETION","MACROAREA_DISKS","MACROAREA_EDITOR",
      "MACROAREA_FINDFOLDER","MACROAREA_GRABBER","MACROAREA_HELP","MACROAREA_INFOPANEL",
      "MACROAREA_MAINMENU","MACROAREA_MENU","MACROAREA_OTHER","MACROAREA_QVIEWPANEL",
      "MACROAREA_SEARCH","MACROAREA_SHELL","MACROAREA_SHELLAUTOCOMPLETION","MACROAREA_TREEPANEL",
      "MACROAREA_USERMENU","MACROAREA_VIEWER","MACROSTATE_EXECUTING","MACROSTATE_EXECUTING_COMMON",
      "MACROSTATE_NOMACRO","MACROSTATE_RECORDING","MACROSTATE_RECORDING_COMMON",
      "MCT_ADDMACRO","MCT_CANPANELSORT","MCT_DELMACRO","MCT_ENUMMACROS","MCT_EXECSTRING",
      "MCT_GETCUSTOMSORTMODES","MCT_GETMACRO","MCT_KEYMACRO","MCT_LOADMACROS","MCT_MACROPARSE",
      "MCT_PANELSORT","MCT_RECORDEDMACRO","MCT_RUNSTARTMACRO","MCT_WRITEMACROS",
      "MENU_EVENT","MIF_CHECKED","MIF_DISABLE","MIF_GRAYED","MIF_HIDDEN","MIF_NONE",
      "MIF_SELECTED","MIF_SEPARATOR","MLF_DONOTUPDATEPANEL","MLF_HOLDTARGET","MLF_NONE",
      "MLF_SHOWERRMSG","MOUSE_EVENT","MOUSE_HWHEELED","MOUSE_MOVED","MOUSE_WHEELED",
      "MPEC_ERROR","MPEC_SUCCESS","MPRT_ERRORFINISH","MPRT_ERRORPARSE","MPRT_FILEASSOCIATIONS",
      "MPRT_FILEHIGHLIGHT","MPRT_FILEMASKGROUPS","MPRT_FILEPANELMODES","MPRT_FOLDERSHORTCUTS",
      "MPRT_HASNOMACRO","MPRT_KEYS","MPRT_NORMALFINISH","MPRT_PLUGINCALL","MPRT_PLUGINCOMMAND",
      "MPRT_PLUGINCONFIG","MPRT_PLUGINMENU","MPRT_PRINT","MPRT_USERMENU","MSSC_CHECK",
      "MSSC_POST","NUMLOCK_ON","OPEN_ANALYSE","OPEN_COMMANDLINE","OPEN_DIALOG",
      "OPEN_EDITOR","OPEN_FILEPANEL","OPEN_FINDLIST","OPEN_FROMMACRO","OPEN_LEFTDISKMENU",
      "OPEN_LUAMACRO","OPEN_PLUGINSMENU","OPEN_RIGHTDISKMENU","OPEN_SHORTCUT","OPEN_VIEWER",
      "OPIF_ADDDOTS","OPIF_COMPAREFATTIME","OPIF_DELETEDIRONCLOSE","OPIF_DELETEFILEONCLOSE",
      "OPIF_DISABLEFILTER","OPIF_DISABLEHIGHLIGHTING","OPIF_DISABLESORTGROUPS",
      "OPIF_EXTERNALDELETE","OPIF_EXTERNALGET","OPIF_EXTERNALMKDIR","OPIF_EXTERNALPUT",
      "OPIF_NONE","OPIF_RAWSELECTION","OPIF_REALNAMES","OPIF_RECURSIVEPANEL","OPIF_SHORTCUT",
      "OPIF_SHOWNAMESONLY","OPIF_SHOWPRESERVECASE","OPIF_SHOWRIGHTALIGNNAMES","OPIF_USEATTRHIGHLIGHTING",
      "OPIF_USECRC32","OPIF_USEFREESIZE","OPM_COMMANDS","OPM_DESCR","OPM_EDIT",
      "OPM_FIND","OPM_NONE","OPM_PGDN","OPM_QUICKVIEW","OPM_SILENT","OPM_TOPLEVEL",
      "OPM_VIEW","PANEL_ACTIVE","PANEL_NONE","PANEL_PASSIVE","PANEL_STOP","PCIF_NONE",
      "PFLAGS_ALTERNATIVENAMES","PFLAGS_DIRECTORIESFIRST","PFLAGS_FOCUS","PFLAGS_HIGHLIGHT",
      "PFLAGS_NONE","PFLAGS_PANELLEFT","PFLAGS_PLUGIN","PFLAGS_REALNAMES","PFLAGS_REVERSESORTORDER",
      "PFLAGS_SELECTEDFIRST","PFLAGS_SHORTCUT","PFLAGS_SHOWHIDDEN","PFLAGS_USECRC32",
      "PFLAGS_USESORTGROUPS","PFLAGS_VISIBLE","PFM_GUID","PFM_MODULENAME","PF_DIALOG",
      "PF_DISABLEPANELS","PF_EDITOR","PF_FULLCMDLINE","PF_NONE","PF_PRELOAD","PF_VIEWER",
      "PLT_PATH","PMFLAGS_ALIGNEXTENSIONS","PMFLAGS_CASECONVERSION","PMFLAGS_DETAILEDSTATUS",
      "PMFLAGS_FULLSCREEN","PMFLAGS_NONE","PN_CHECKMASK","PN_CMPNAME","PN_CMPNAMELIST",
      "PN_GENERATENAME","PN_NONE","PN_SHOWERRORMESSAGE","PN_SKIPPATH","PPIF_NONE",
      "PPIF_PROCESSDESCR","PPIF_SELECTED","PSL_LOCAL","PSL_ROAMING","PTYPE_FILEPANEL",
      "PTYPE_INFOPANEL","PTYPE_QVIEWPANEL","PTYPE_TREEPANEL","RIGHTMOST_BUTTON_PRESSED",
      "RIGHT_ALT_PRESSED","RIGHT_CTRL_PRESSED","SCROLLLOCK_ON","SE_COMMONSYNCHRO",
      "SE_FOLDERCHANGED","SHIFT_PRESSED","SM_ATIME","SM_CHTIME","SM_COMPRESSEDSIZE",
      "SM_COUNT","SM_CTIME","SM_DEFAULT","SM_DESCR","SM_EXT","SM_FULLNAME","SM_MTIME",
      "SM_NAME","SM_NAMEONLY","SM_NUMLINKS","SM_NUMSTREAMS","SM_OWNER","SM_SIZE",
      "SM_STREAMSSIZE","SM_UNSORTED","SM_USER","TBPS_ERROR","TBPS_INDETERMINATE",
      "TBPS_NOPROGRESS","TBPS_NORMAL","TBPS_PAUSED","UNDERLINE_CURLY","UNDERLINE_DASH",
      "UNDERLINE_DOT","UNDERLINE_DOUBLE","UNDERLINE_NONE","UNDERLINE_SINGLE","VE_CLOSE",
      "VE_GOTFOCUS","VE_KILLFOCUS","VE_READ","VF_DELETEONCLOSE","VF_DELETEONLYFILEONCLOSE",
      "VF_DISABLEHISTORY","VF_ENABLE_F6","VF_IMMEDIATERETURN","VF_NONE","VF_NONMODAL",
      "VMF_NONE","VMF_WORDWRAP","VMF_WRAP","VMT_DUMP","VMT_HEX","VMT_TEXT","VOPT_AUTODETECTCODEPAGE",
      "VOPT_NONE","VOPT_QUICKVIEW","VOPT_SAVEFILEPOSITION","VOPT_SHOWKEYBAR","VOPT_SHOWSCROLLBAR",
      "VOPT_SHOWTITLEBAR","VSMFL_NONE","VSMFL_REDRAW","VSMT_VIEWMODE","VSMT_WORDWRAP",
      "VSMT_WRAP","VSP_NONE","VSP_NOREDRAW","VSP_NORETNEWPOS","VSP_PERCENT","VSP_RELATIVE",
      "VS_ALPHA","VS_BETA","VS_PRIVATE","VS_RC","VS_RELEASE","VS_SPECIAL","WIF_CURRENT",
      "WIF_MODAL","WIF_MODIFIED","WIF_NONE","WINDOW_BUFFER_SIZE_EVENT","WTYPE_COMBOBOX",
      "WTYPE_DESKTOP","WTYPE_DIALOG","WTYPE_EDITOR","WTYPE_GRABBER","WTYPE_HELP",
      "WTYPE_HMENU","WTYPE_PANELS","WTYPE_UNKNOWN","WTYPE_VIEWER","WTYPE_VMENU",
      "XLAT_CONVERTALLCMDLINE","XLAT_NONE","XLAT_SWITCHKEYBBEEP","XLAT_SWITCHKEYBLAYOUT",
      "XLAT_USEKEYBLAYOUTNAME",
    },
    include "Guids" {
      "AdvancedConfigId","ApplyCommandId","AskInsertMenuOrCommandId","BadEditorCodePageId",
      "CannotRecycleFileId","CannotRecycleFolderId","ChangeDiskMenuId","ChangeDriveCannotReadDiskErrorId",
      "ChangeDriveModeId","CodePagesMenuId","CopyCurrentOnlyFileId","CopyFilesId",
      "CopyOverwriteId","CopyProgressId","CopyReadOnlyId","DeleteAskDeleteROId",
      "DeleteAskWipeROId","DeleteFileFolderId","DeleteFolderId","DeleteFolderRecycleId",
      "DeleteLinkId","DeleteRecycleId","DeleteWipeId","DescribeFileId","DisconnectDriveId",
      "EditAskSaveExtId","EditAskSaveId","EditMaskGroupId","EditUserMenuId","EditorAskOverwriteId",
      "EditorCanNotEditDirectoryId","EditorConfirmReplaceId","EditorFileGetSizeErrorId",
      "EditorFileLongId","EditorFindAllListId","EditorOpenRSHId","EditorReloadId",
      "EditorReloadModalId","EditorReplaceId","EditorSaveExitDeletedId","EditorSaveF6DeletedId",
      "EditorSavedROId","EditorSearchId","EditorSwitchUnicodeCPDisabledId","EjectHotPlugMediaErrorId",
      "FarAskQuitId","FileAssocMenuId","FileAssocModifyId","FileAttrDlgId","FileOpenCreateId",
      "FileSaveAsId","FiltersConfigId","FiltersMenuId","FindFileId","FindFileResultId",
      "FolderShortcutsDlgId","FolderShortcutsId","FolderShortcutsMoreId","GetNameAndPasswordId",
      "HardSymLinkId","HelpSearchId","HighlightConfigId","HighlightMenuId","HistoryCmdId",
      "HistoryEditViewId","HistoryFolderId","MakeFolderId","MaskGroupsMenuId","MoveCurrentOnlyFileId",
      "MoveFilesId","PanelViewModesEditId","PanelViewModesId","PluginInformationId",
      "PluginsConfigMenuId","PluginsMenuId","RecycleFolderConfirmDeleteLinkId",
      "RemoteDisconnectDriveError1Id","RemoteDisconnectDriveError2Id","SUBSTDisconnectDriveError1Id",
      "SUBSTDisconnectDriveError2Id","SUBSTDisconnectDriveId","ScreensSwitchId",
      "SelectAssocMenuId","SelectDialogId","SelectFromEditHistoryId","SelectSortModeId",
      "UnSelectDialogId","UserMenuUserInputId","VHDDisconnectDriveErrorId","VHDDisconnectDriveId",
      "ViewerSearchId","WipeFolderId","WipeHardLinkId",
    },
    include "Host" {
      "FreeUserData","GetFiles","GetFindData","PutFiles","SetDirectory",
    },
  },
  include "panel" {
    "BeginSelection","CheckPanelsExist","ClearSelection","ClosePanel","EndSelection",
    "GetCmdLine","GetCmdLinePos","GetCmdLineSelection","GetColumnTypes","GetColumnWidths",
    "GetCurrentPanelItem","GetPanelDirectory","GetPanelFormat","GetPanelHostFile",
    "GetPanelInfo","GetPanelItem","GetPanelPrefix","GetSelectedPanelItem","GetUserScreen",
    "InsertCmdLine","IsActivePanel","RedrawPanel","SetActivePanel","SetCmdLine",
    "SetCmdLinePos","SetCmdLineSelection","SetDirectoriesFirst","SetPanelDirectory",
    "SetSelection","SetSortMode","SetSortOrder","SetUserScreen","SetViewMode","UpdatePanel",
  },
  include "regex" {
    "exec","execW","find","findW","gmatch","gmatchW","gsub","gsubW","match","matchW",
    "new","tfind","tfindW",
  },
  include "viewer" {
    "GetFileName","GetInfo","Quit","Redraw","Select","SetKeyBar","SetMode","SetPosition",
    "Viewer",
  },
}

--------------------------------------------------------------------------------
local _Panel = def_fields {
  "Bof","ColumnCount","CurPos",str "Current","DriveType","Empty","Eof","FilePanel",
  "Filter","Folder",str "Format","Height",str "HostFile","ItemCount","LFN","Left",
  "OPIFlags",str "Path",str "Path0","Plugin",str "Prefix","Root","SelCount","Selected",
  "Type",str "UNCPath","Visible","Width",
}
local luamacro = read_globals {
  "CommandLine","ContentColumns","Event","Keys","Macro","MenuItem","NoCommandLine",
  "NoContentColumns","NoEvent","NoMacro","NoMenuItem","NoPanelModule","PanelModule",
  rw_str "_filename","akey","band","bnot","bor","bxor","eval","exit","lshift","mmode",
  "msgbox","prompt","rshift",

  pack("APanel",_Panel),

  pack("PPanel",_Panel),

  include "Area" {
    str "Current","Desktop","Dialog","DialogAutoCompletion","Disks","Editor","FindFolder",
    "Grabber","Help","Info","MainMenu","Menu","Other","QView","Search","Shell",
    "ShellAutoCompletion","Tree","UserMenu","Viewer",
  },
  include "BM" {
    "Add","Back","Clear","Del","Get","Goto","Next","Pop","Prev","Push","Stat",
  },
  include "CmdLine" {
    "Bof","CurPos","Empty","Eof","ItemCount",mu_table "Result","Selected",str "Value",
  },
  include "Dlg" {
    "CurPos","GetValue",str "Id","ItemCount","ItemType",str "Owner","PrevPos","SetFocus",
  },
  include "Drv" {
    "ShowMode","ShowPos",
  },
  include "Editor" {
    "CurLine","CurPos","DelLine",str "FileName","GetStr","InsStr","Lines","Pos",
    "RealPos","Sel",str "SelValue","Set","SetStr","SetTitle","State","Undo",str "Value",
  },
  include "Far" {
    "Cfg_Get","DisableHistory","FullScreen","GetConfig","Height","IsUserAdmin",
    "KbdLayout","KeyBar_Show","PID",str "Title","UpTime","Width","Window_Scroll",
  },
  include "Help" {
    str "FileName",str "SelTopic",str "Topic",
  },
  include "Menu" {
    "Filter","FilterStr","GetValue","HorizontalAlignment",str "Id","ItemStatus",
    "Select","Show",str "Value",
  },
  include "Mouse" {
    "Button","CtrlState","EventFlags","LastCtrlState","X","Y",
  },
  include "Object" {
    "Bof","CheckHotkey","CurPos","Empty","Eof","GetHotkey","Height","ItemCount",
    "Selected",str "Title","Width",
  },
  include "Panel" {
    "CustomSortMenu","FAttr","FExist","Item","LoadCustomSortMode","Select","SetCustomSortMode",
    "SetPath","SetPos","SetPosIdx",
  },
  include "Plugin" {
    "Call","Command","Config","Exist","Load","Menu","SyncCall","Unload",
  },
  include "Viewer" {
    str "FileName","State",
  },
  include "mf" {
    "AddExitHandler","EnumScripts","GetMacroCopy","Keys","abs","acall","akey","asc",
    "atoi","beep","chr","clip","date","deserialize","env","eval","exit","fattr",
    "fexist","float","flock","fmatch","fsplit","iif","index","int","itoa","key",
    "lcase","len","mainmenu","max","mdelete","min","mload","mmode","mod","msave",
    "msgbox","postmacro","print","printconsole","prompt","replace","rindex","serialize",
    "size2str","sleep","string","strpad","strwrap","substr","testfolder","trim",
    "ucase","usermenu","waitkey","xlat",
  },
  include "package" {
    rw_str "moonpath",mu_table "nounload",
  },
}

local lm = {
  read_globals={
    "bit64","utf8","win",                                  --lflua
    "far","editor","panel","regex","viewer",               --luafar
    "_luaplug",
    --luamacro
    "Area","BM","CmdLine","Dlg","Drv","Editor","Far","Help","Mouse","Menu","Object",
    "Panel","APanel","PPanel","Plugin","Viewer","mf",
    "eval","msgbox","prompt","Keys","exit","mmode","akey", --mf
    "lshift","bnot","band","bor","rshift","bxor",          --bit64
                                                           --load
    "CommandLine","Event","Macro","MenuItem","PanelModule","ContentColumns",
    "NoCommandLine","NoEvent","NoMacro","NoMenuItem","NoPanelModule","NoContentColumns",
  },
  globals={
    "_filename",                                           --luamacro
    "export",                                              --luafar
    "RecreateLuaState","IsLuaStateRecreated",
  },
}

return {
  stds={
    lflua   = lflua,
    luafar  = combine(luafar,  lflua),
    luamacro= combine(luamacro,luafar),
    lm      = lm, --legacy
  },
  __version="1.6",
  __target="far6461.lm872",
}
