8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
18#if ALIB_FILES_SCANNER_IMPL == ALIB_FILES_SCANNER_POSIX
54 #define ES ExpressionScope
55 #define FS dynamic_cast<FileExpressions::FexScope&>(scope)
56 #define AI ArgIterator
59 #define INTARG0 args->Unbox<integer>()
60 Box getType (ES& scope, AI , AI) {
return VAL->Type(); }
61 Box isDirectory(ES& scope, AI , AI) {
return VAL->IsDirectory(); }
62 Box isSymLink (ES& scope, AI , AI) {
return VAL->IsSymbolicLink(); }
63 Box getSize (ES& scope, AI , AI) {
return integer(VAL->Size()); }
64 Box getTime (ES& scope, AI , AI) {
return VAL->MDate(); }
65 Box getBTime (ES& scope, AI , AI) {
return VAL->BDate(); }
66 Box getCTime (ES& scope, AI , AI) {
return VAL->CDate(); }
67 Box getATime (ES& scope, AI , AI) {
return VAL->ADate(); }
68 Box getPerms (ES& scope, AI , AI) {
return VAL->Perms(); }
69 Box getOwner (ES& scope, AI , AI) {
return VAL->Owner(); }
70 Box getGroup (ES& scope, AI , AI) {
return VAL->Group(); }
71#if ALIB_FILES_SCANNER_IMPL == ALIB_FILES_SCANNER_POSIX
78 Box kiloBytes (ES& , AI args, AI) {
return INTARG0 *
integer(1024); }
79 Box megaBytes (ES& , AI args, AI) {
return INTARG0 *
integer(1024) *
integer(1024); }
86#if ALIB_PATH_CHARACTERS_WIDE == ALIB_CHARACTERS_WIDE
87 Box getName (ES& scope, AI , AI) {
return NODE.Name(); }
88 Box getPath (ES& scope, AI , AI) {
return FS.ParentPath; }
91 Box getName (ES& scope, AI , AI) {
return String(scope.Allocator,
String256(NODE.Name() )); }
92 Box getPath (ES& scope, AI , AI) {
return String(scope.Allocator,
String256(FS.ParentPath)); }
102 extern Box constOwnRead ;
Box constOwnRead ;
103 extern Box constOwnWrite ;
Box constOwnWrite;
104 extern Box constOwnExec ;
Box constOwnExec ;
105 extern Box constGrpRead ;
Box constGrpRead ;
106 extern Box constGrpWrite ;
Box constGrpWrite;
107 extern Box constGrpExec ;
Box constGrpExec ;
108 extern Box constOthRead ;
Box constOthRead ;
109 extern Box constOthWrite ;
Box constOthWrite;
110 extern Box constOthExec ;
Box constOthExec ;
112 extern Box constTDirectory ;
Box constTDirectory ;
113 extern Box constTSymbolicLinkDir ;
Box constTSymbolicLinkDir;
114 extern Box constTRegular ;
Box constTRegular ;
115 extern Box constTSymbolicLink ;
Box constTSymbolicLink ;
116 extern Box constTBlock ;
Box constTBlock ;
117 extern Box constTCharacter ;
Box constTCharacter ;
118 extern Box constTFifo ;
Box constTFifo ;
119 extern Box constTSocket ;
Box constTSocket ;
121 extern Box TypeUsrGrpID ;
Box TypeUsrGrpID ;
123#if ALIB_CHARACTERS_WIDE
161 constexpr int tableSize= 39;
162 Token functionNames[tableSize];
165 Token* descriptor= functionNames;
167#if ALIB_CHARACTERS_WIDE
168 TypeNameConverterTFP=
FILES.GetResource(
"TFP"); pCompiler.
AddType(constOwnRead , TypeNameConverterTFP);
169 TypeNameConverterTID=
FILES.GetResource(
"TID"); pCompiler.
AddType(TypeUsrGrpID , TypeNameConverterTID);
170 TypeNameConverterTTY=
FILES.GetResource(
"TTY"); pCompiler.
AddType(constTDirectory, TypeNameConverterTTY);
172 pCompiler.
AddType(constOwnRead ,
FILES.GetResource(
"TFP"));
173 pCompiler.
AddType(TypeUsrGrpID ,
FILES.GetResource(
"TID"));
174 pCompiler.
AddType(constTDirectory,
FILES.GetResource(
"TTY"));
180 { *descriptor++, constOwnRead },
181 { *descriptor++, constOwnWrite },
182 { *descriptor++, constOwnExec },
183 { *descriptor++, constGrpRead },
184 { *descriptor++, constGrpWrite },
185 { *descriptor++, constGrpExec },
186 { *descriptor++, constOthRead },
187 { *descriptor++, constOthWrite },
188 { *descriptor++, constOthExec },
190 { *descriptor++, constTDirectory },
191 { *descriptor++, constTSymbolicLinkDir },
192 { *descriptor++, constTRegular },
193 { *descriptor++, constTSymbolicLink },
194 { *descriptor++, constTBlock },
195 { *descriptor++, constTCharacter },
196 { *descriptor++, constTFifo },
197 { *descriptor++, constTSocket },
261 if( !
expression->ResultType().IsType<
bool>() )
262 throw std::runtime_error(
"Expression result type mismatch: expecting boolean result!" );
ALIB_DLL void AddType(Type sample, const NString &name)
uint32_t TOwnerAndGroupID
Type definition for owner and group ids.
static constexpr TOwnerAndGroupID UnknownID
Constant value for owner and group IDs to denote that the field was not determined.
@ DIRECTORY
Directory/folder.
@ CHARACTER
A character special file.
@ BLOCK
A block special file.
@ FIFO
A FIFO (also known as pipe) file.
@ GROUP_READ
Posix S_IRGRP: The file's user group has read permission.
@ GROUP_EXEC
Posix S_IXGRP: The file's user group has execute/search permission.
@ OTHERS_EXEC
Posix S_IXOTH: Other users have execute/search permission.
@ GROUP_WRITE
Posix S_IWGRP: The file's user group has write permission.
@ OWNER_READ
Posix S_IRUSR: File owner has read permission.
@ OWNER_EXEC
Posix S_IXUSR: File owner has execute/search permission.
@ OWNER_WRITE
Posix S_IWUSR: File owner has write permission.
@ OTHERS_READ
Posix S_IROTH: Other users have read permission.
@ OTHERS_WRITE
Posix S_IWOTH: Other users have write permission.
FileExpressions & fex
The scope used with this filter.
friend class FileExpressions
The outer class is our friend.
Expression expression
The compiled expression.
FileExpressions::FexScope scope
The scope used with this filter.
ALIB_DLL SPFileFilter CreateFilter(const String &expressionString)
ALIB_DLL FileExpressions()
Default constructor.
Plugin plugin
The file expression Plugin.
Compiler compiler
The expression compiler.
#define CALCULUS_DEFAULT_AUTOCAST
#define CALCULUS_CALLBACK(func)
#define CALCULUS_SIGNATURE(BoxPointerArray)
std::shared_ptr< FFilter > SPFileFilter
A shared pointer to a filter.
void LoadResourcedTokens(camp::Camp &module, const NString &resourceName, strings::util::Token *target, int dbgSizeVerifier, character outerSeparator=',', character innerSeparator=' ')
strings::util::Token Token
Type alias in namespace alib.
LocalString< 256 > String256
Type alias name for TLocalString<character,256>.
lang::integer integer
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
files::FilesCamp FILES
The singleton instance of ALib Camp class FilesCamp.
strings::TString< character > String
Type alias in namespace alib.
expressions::Compiler Compiler
Type alias in namespace alib.
NLocalString< 32 > NString32
Type alias name for TLocalString<nchar,32>.
static ALIB_DLL Box * I[1]
Function accepts one integral argument.
static ALIB_DLL Box Integer
Sample type-box for integer types. (Precisely for type integer.)
static ALIB_DLL Box Boolean
Sample type-box for C++ type bool.
static ALIB_DLL Box DateTime
Sample type-box for date and time values of type DateTime).
static ALIB_DLL Box String
static constexpr CTInvokable ETI
Calculus(const NString &name, Compiler &compiler, CompilePriorities pPriority)
std::vector< ConstantIdentifierEntry > ConstantIdentifiers
List of identifiers that return constant values to be compiled by this plug-in.
static constexpr CTInvokable CTI
std::vector< AutoCastEntry > AutoCasts
List of auto-casts to be compiled by this plug-in.
std::vector< FunctionEntry > Functions
List of functions to be compiled by this plug-in.