13 #define ES ExpressionScope
14 #define FS dynamic_cast<FileExpressions::FexScope&>(scope)
15 #define AI ArgIterator
18 #define INTARG0 args->Unbox<integer>()
19Box getType (ES& scope, AI , AI) {
return VAL->Type(); }
20Box isDirectory(ES& scope, AI , AI) {
return VAL->IsDirectory(); }
21Box isSymLink (ES& scope, AI , AI) {
return VAL->IsSymbolicLink(); }
22Box getSize (ES& scope, AI , AI) {
return integer(VAL->Size()); }
23Box getTime (ES& scope, AI , AI) {
return VAL->MDate(); }
24Box getBTime (ES& scope, AI , AI) {
return VAL->BDate(); }
25Box getCTime (ES& scope, AI , AI) {
return VAL->CDate(); }
26Box getATime (ES& scope, AI , AI) {
return VAL->ADate(); }
27Box getPerms (ES& scope, AI , AI) {
return VAL->Perms(); }
28Box getOwner (ES& scope, AI , AI) {
return VAL->Owner(); }
29Box getGroup (ES& scope, AI , AI) {
return VAL->Group(); }
30#if ALIB_SYSTEM_FILE_STATUS_IMPL == ALIB_SYSTEM_FILE_POSIX_STATUS
37Box kiloBytes (ES& , AI args, AI) {
return INTARG0 *
integer(1024); }
38Box megaBytes (ES& , AI args, AI) {
return INTARG0 *
integer(1024) *
integer(1024); }
45#if ALIB_PATH_CHARACTERS_WIDE == ALIB_CHARACTERS_WIDE
46Box getName (ES& scope, AI , AI) {
return NODE.Name(); }
47Box getPath (ES& scope, AI , AI) {
return FS.ParentPath; }
50 Box getName (ES& scope, AI , AI) {
return String(scope.Allocator,
String256(NODE.Name() )); }
51 Box getPath (ES& scope, AI , AI) {
return String(scope.Allocator,
String256(FS.ParentPath)); }
61 extern Box constOwnRead ;
Box constOwnRead ;
62 extern Box constOwnWrite ;
Box constOwnWrite;
63 extern Box constOwnExec ;
Box constOwnExec ;
64 extern Box constGrpRead ;
Box constGrpRead ;
65 extern Box constGrpWrite ;
Box constGrpWrite;
66 extern Box constGrpExec ;
Box constGrpExec ;
67 extern Box constOthRead ;
Box constOthRead ;
68 extern Box constOthWrite ;
Box constOthWrite;
69 extern Box constOthExec ;
Box constOthExec ;
71 extern Box constTDirectory ;
Box constTDirectory ;
72 extern Box constTSymbolicLinkDir ;
Box constTSymbolicLinkDir;
73 extern Box constTRegular ;
Box constTRegular ;
74 extern Box constTSymbolicLink ;
Box constTSymbolicLink ;
75 extern Box constTBlock ;
Box constTBlock ;
76 extern Box constTCharacter ;
Box constTCharacter ;
77 extern Box constTFifo ;
Box constTFifo ;
78 extern Box constTSocket ;
Box constTSocket ;
80 extern Box TypeUsrGrpID ;
Box TypeUsrGrpID ;
112#if ALIB_CHARACTERS_WIDE
124 constexpr int tableSize= 39;
125 Token functionNames[tableSize];
128 Token* descriptor= functionNames;
133 { *descriptor++, constOwnRead },
134 { *descriptor++, constOwnWrite },
135 { *descriptor++, constOwnExec },
136 { *descriptor++, constGrpRead },
137 { *descriptor++, constGrpWrite },
138 { *descriptor++, constGrpExec },
139 { *descriptor++, constOthRead },
140 { *descriptor++, constOthWrite },
141 { *descriptor++, constOthExec },
143 { *descriptor++, constTDirectory },
144 { *descriptor++, constTSymbolicLinkDir },
145 { *descriptor++, constTRegular },
146 { *descriptor++, constTSymbolicLink },
147 { *descriptor++, constTBlock },
148 { *descriptor++, constTCharacter },
149 { *descriptor++, constTFifo },
150 { *descriptor++, constTSocket },
206 if( !
expression->ResultType().IsType<
bool>() )
207 throw std::runtime_error(
"Expression result type mismatch: expecting boolean result!" );
void AddType(Type sample, const NString &name)
MonoAllocator & GetAllocator()
Expression expression
The compiled expression.
FileExpressions::FexScope scope
The scope used with this filter.
FileExpressions()
Default constructor.
SPFileFilter CreateFilter(const String &expressionString)
Plugin plugin
The file expression Plugin.
Compiler compiler
The expression compiler.
@ 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.
static constexpr TOwnerAndGroupID UnknownID
Constant value for owner and group IDs to denote that the field was not determined.
uint32_t TOwnerAndGroupID
Type definition for owner and group ids.
#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::TString< nchar > NString
Type alias in namespace #"%alib".
filetree::FilesCamp FILETREE
The singleton instance of ALib Camp class #"FilesCamp".
lang::integer integer
Type alias in namespace #"%alib".
boxing::Box Box
Type alias in namespace #"%alib".
expressions::Compiler Compiler
Type alias in namespace #"%alib".
strings::TString< character > String
Type alias in namespace #"%alib".
NLocalString< 256 > NString256
Type alias name for #"TLocalString;TLocalString<nchar,256>".
LocalString< 256 > String256
Type alias name for #"TLocalString;TLocalString<character,256>".
strings::util::Token Token
Type alias in namespace #"%alib".
static Box * I[1]
Function accepts one integral argument.
static Box Integer
Sample type-box for integer types. (Precisely for type #"lang::integer".).
static Box Boolean
Sample type-box for C++ type bool.
static Box DateTime
Sample type-box for date and time values of type #"time::DateTime").
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.