Commit 6dbd79d0 by kollo

FILESELECTOR improved: longer file names in Selection

improved manual (GLOB())
(John 2016-04-08)
parent ee788d46
Pipeline #1660315 skipped
......@@ -20,3 +20,4 @@ Release notes for Version 1.24 (Sept 2015 -- )
- fixed bug in FILL and ELLIPSE/PELLIPSE (for big screens)
- fixed power operator in compiler for integer operands
- little bugfix in compiler (PRINT #)
- improved FILESELECT
......@@ -172,22 +172,70 @@ SEE ALSO: GET_GEOMETRY, MOVEW
#############################################################################
Function: GLOB()
Syntax: <bool>=GLOB(name$,pattern$[,flags])
Syntax: <bool>=GLOB(name$,pattern$[,flags%])
DESCRIPTION:
GLOB() checks if name$ matches the wildcard pattern pattern$
and gives -1 (TRUE), else 0 (FALSE). The kind of check can be
specified with the flags parameter.
flags
and gives -1 (TRUE), else 0 (FALSE).
A wildcard pattern typically contains one or more of the characters
"?", "*" or "[".
* A '?' (not between brackets) matches any single character.
* A '*' (not between brackets) matches any string, including the empty
string.
* An expression "[...]" where the first character after the leading '['
is not an '!' matches a single character, namely any of the characters
enclosed by the brackets.
The string enclosed by the brackets cannot be empty; therefore ']' can
be allowed between the brackets, provided that it is the first
character. (Thus, "[][!]" matches the three characters
'[', ']' and '!'.)
There is one special convention: two characters separated by '-' denote
a range. (Thus, "[A-Fa-f0-9]" is equivalent to
"[ABCDEFabcdef0123456789]".)
One may include '-' in its literal meaning by making it the first or
last character between the brackets. (Thus, "[]-]" matches just the
two characters ']' and '-', and "[--0]" matches the three characters
'-', '.', '0', since '/' cannot be matched.)
An expression "[!...]" matches a single character, namely any
character that is not matched by the expression obtained by removing
the first '!' from it. (Thus, "[!]a-]" matches any single character
except ']', 'a' and '-'.)
One can remove the special meaning of '?', '*' and '[' by preceding
them by a backslash, or by enclosing them in quotes.
Between brackets these characters stand for themselves.
Thus, "[[?*\]" matches the four characters '[', '?', '*' and '\'.
The kind of check can be specified with the flags% parameter. The flags%
parameter can be a combination (+ or OR) of following values with
following meaning:
flags%
0 -- default, no extras
1 -- name$ is treated as a filename
(Chars '/' are not matched)
2 -- Backslashes quote special characters
4 -- special treatment of '.'
8 -- just check path of file name name$
16 -- case insensitive
1 -- name$ is treated as a filename, this means that a slash in
the string is mathced only with a slash in the pattern and
not by an asterisk (*) or a question mark (?).
2 -- treat backslashes as special escape characters
4 -- special treatment of '.', this means a leading period in the
string has to be matched exactly by a period in the pattern.
8 -- just check path of file name name$, this means the pattern is
considered to be matched if it matches an initial segment of
the string which is followed by a slash.
16 -- The pattern is matched case-insensitively.
If the flag%=1 is set, the pattern matching is applied on each of the
components of a pathname separately. In this case a '/' in a pathname
cannot be matched by a '?' or '*' wildcard, or by a range like "[.-0]".
If the flag%=1+4 is set,
if a filename starts with a '.', this character must be matched
explicitly.
EXAMPLES:
......@@ -195,6 +243,10 @@ GLOB("abcd","abc?") Result: -1
GLOB("abcd","*") -1
GLOB("abc","ab??") 0
GLOB("SA33333","*a[0-9]*",16) -1
GLOB("folder/testme.bas","*.bas",1) 0
GLOB(".testme.bas","*.bas",1) -1
GLOB(".testme.bas","*.bas",1+4) 0
GLOB(".testme.bas",".*.bas",1+4) -1
SEE ALSO: INSTR(), WORT_SEP
......
......@@ -24,7 +24,7 @@ INCDIR=@prefix@/include/x11basic
LIBNO=@version@
RELEASE=39
RELEASE=41
# Register variables (-ffixed-reg) -Wall
......
......@@ -1631,8 +1631,10 @@ char *fileselector(const char *titel, const char *pfad, const char *sel) {
TEDINFO tedinfo[4+ANZSHOW]={
{btitel,"","",FONT_BIGIBM,0,TE_CNTR,0x1200,0,0,0,0},
{mask,"","",FONT_IBM,0,TE_CNTR,0x113a,0,2,0,FWW},
{feld1,"__________________________________________________","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",FONT_IBM,0,TE_LEFT,0x1100,0,0,128,50},
{auswahl,"____________________","XXXXXXXXXXXXXXXXXXXX",FONT_IBM,0,TE_LEFT,0x1100,0,0,128,20}
{feld1, "__________________________________________________",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",FONT_IBM,0,TE_LEFT,0x1100,0,0,128,50},
{auswahl,"__________________________________________________",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",FONT_IBM,0,TE_LEFT,0x1100,0,0,128,20}
};
// int anztedinfo=sizeof(tedinfo)/sizeof(TEDINFO);
OBJECT objects[18+2*ANZSHOW]={
......@@ -1665,13 +1667,13 @@ char *fileselector(const char *titel, const char *pfad, const char *sel) {
/*10*/ {15,-1,-1,G_BOXTEXT, SELECTABLE|EXIT, NORMAL, {(LONG)&tedinfo[1]}, 2,0,FWW-2,1},
#ifdef GERMAN
/*11*/ {12,-1,-1,G_STRING,NONE, NORMAL, {(LONG)"Pfad:"}, 2,3,2,1},
/*12*/ {13,-1,-1,G_STRING,NONE, NORMAL, {(LONG)"Auswahl:"}, 32,5,2,1},
/*12*/ {13,-1,-1,G_STRING,NONE, NORMAL, {(LONG)"Auswahl:"}, 2,5,2,1},
#else
/*11*/ {12,-1,-1,G_STRING,NONE, NORMAL, {(LONG)"Directory:"}, 2,3,2,1},
/*12*/ {13,-1,-1,G_STRING,NONE, NORMAL, {(LONG)"Selection:"}, 32,5,2,1},
/*12*/ {13,-1,-1,G_STRING,NONE, NORMAL, {(LONG)"Selection:"}, 2,5,2,1},
#endif
/*13*/ {14,-1,-1,G_FTEXT, EDITABLE, NORMAL, {(LONG)&tedinfo[2]}, 2,4,50,1},
/*14*/ {0,-1,-1,G_FTEXT, EDITABLE, NORMAL, {(LONG)&tedinfo[3]}, 32,6,20,1},
/*14*/ {0,-1,-1,G_FTEXT, EDITABLE, NORMAL, {(LONG)&tedinfo[3]}, 2,6,50,1},
/*15*/ {17,16,16,G_BOX, TOUCHEXIT, NORMAL, {0x00ff1459}, FWW,2,2,ANZSHOW-2},
/*16*/ {15,-1,-1,G_BOX, TOUCHEXIT, NORMAL, {0x00ff1100}, 0,0,2,2},
/*17*/ {5,18,17+2*ANZSHOW,G_BOX, NONE, NORMAL, {0x00ff1100}, 0,1,FWW,ANZSHOW}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment