[DEVELOPMENT ENVIRONMENT]
* NEW: The state of a component is now a string: "Stable", "NotFinished", or "Experimental". * NEW: Fix the state of many components. [GB.PCRE] * NEW: Some code cleanups. git-svn-id: svn://localhost/gambas/trunk@3625 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
3c1b87fab0
commit
0a8e939976
@ -254,7 +254,7 @@ msgstr ""
|
|||||||
msgid "OpenGL display"
|
msgid "OpenGL display"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: CComponent.class:436
|
#: CComponent.class:445
|
||||||
msgid "Loading information on component &1..."
|
msgid "Loading information on component &1..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -263,7 +263,16 @@ Static Private Sub InitComponent(sFile As String)
|
|||||||
Else If sKey = "Alpha" Then
|
Else If sKey = "Alpha" Then
|
||||||
.State = UNSTABLE
|
.State = UNSTABLE
|
||||||
Else If sKey = "State" Then
|
Else If sKey = "State" Then
|
||||||
|
Select Case LCase(sLig)
|
||||||
|
Case "stable", "finished"
|
||||||
|
.State = STABLE
|
||||||
|
Case "notfinished"
|
||||||
|
.State = STABLE_NOT_FINISHED
|
||||||
|
Case "experimental", "unstable"
|
||||||
|
.State = UNSTABLE
|
||||||
|
Default
|
||||||
.State = CInt(sLig)
|
.State = CInt(sLig)
|
||||||
|
End Select
|
||||||
Else If sKey = "Version" Then
|
Else If sKey = "Version" Then
|
||||||
.Version = sLig
|
.Version = sLig
|
||||||
Else If sKey = "Hidden" Then
|
Else If sKey = "Hidden" Then
|
||||||
|
@ -6,4 +6,3 @@ Authors=Fabien Bodard
|
|||||||
Needs=Form
|
Needs=Form
|
||||||
Requires=gb.form
|
Requires=gb.form
|
||||||
|
|
||||||
[Change]
|
|
||||||
|
@ -1,8 +1,2 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Icon=./.icon.png
|
Icon=./.icon.png
|
||||||
|
|
||||||
[Dolphin]
|
|
||||||
Timestamp=2010,3,25,15,8,6
|
|
||||||
|
|
||||||
[Settings]
|
|
||||||
ShowDotFiles=true
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 3.7 KiB |
@ -1,6 +1,5 @@
|
|||||||
[Component]
|
[Component]
|
||||||
Key=gb.eval.highlight
|
Key=gb.eval.highlight
|
||||||
Version=0.0.4
|
Version=0.0.62
|
||||||
State=1
|
|
||||||
Requires=gb.eval
|
Requires=gb.eval
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 3.7 KiB |
@ -2,7 +2,7 @@
|
|||||||
# Compiled with Gambas 2.99.0
|
# Compiled with Gambas 2.99.0
|
||||||
Title=gb.eval.highlight
|
Title=gb.eval.highlight
|
||||||
Startup=Main
|
Startup=Main
|
||||||
Version=0.0.61
|
Version=0.0.62
|
||||||
Component=gb.eval
|
Component=gb.eval
|
||||||
TabSize=2
|
TabSize=2
|
||||||
MakeComponent=1
|
MakeComponent=1
|
||||||
|
@ -12,11 +12,11 @@ SearchComment=False
|
|||||||
SearchString=True
|
SearchString=True
|
||||||
|
|
||||||
[OpenFile]
|
[OpenFile]
|
||||||
|
Active=1
|
||||||
File[1]=".src/Highlight.class:30.21"
|
File[1]=".src/Highlight.class:30.21"
|
||||||
File[2]=".src/HighlightHTML.module:67.0"
|
File[2]=".src/HighlightHTML.module:67.0"
|
||||||
File[3]=".src/Main.module:10.0"
|
File[3]=".src/Main.module:10.0"
|
||||||
File[4]=".src/HighlightDiff.module:24.30"
|
File[4]=".src/HighlightDiff.module:24.30"
|
||||||
Active=5
|
|
||||||
File[5]=".src/HighlightJavascript.module:142.17"
|
File[5]=".src/HighlightJavascript.module:142.17"
|
||||||
Count=5
|
Count=5
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ Main
|
|||||||
gb.eval.highlight
|
gb.eval.highlight
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
0.0.61
|
0.0.62
|
||||||
|
|
||||||
gb.eval
|
gb.eval
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
[Component]
|
[Component]
|
||||||
Key=gb.cairo
|
Key=gb.cairo
|
||||||
Author=Benoît Minisini
|
Author=Benoît Minisini
|
||||||
State=1
|
|
||||||
Requires=gb.image
|
Requires=gb.image
|
@ -1,5 +1,5 @@
|
|||||||
[Component]
|
[Component]
|
||||||
Key=gb.image.imlib
|
Key=gb.image.imlib
|
||||||
Author=Benoît Minisini
|
Author=Benoît Minisini
|
||||||
State=2
|
State=NotFinished
|
||||||
Requires=gb.image
|
Requires=gb.image
|
||||||
|
@ -4,4 +4,4 @@ Name=Perl-compatible Regular Expression Matching
|
|||||||
Name[fr]=Expressions rationnelles compatibles avec Perl
|
Name[fr]=Expressions rationnelles compatibles avec Perl
|
||||||
Name[tr]=Perl-uyumlu Düzenli İfade Eşleme
|
Name[tr]=Perl-uyumlu Düzenli İfade Eşleme
|
||||||
Author=Benoît Minisini,Rob Kudla
|
Author=Benoît Minisini,Rob Kudla
|
||||||
Alpha=1
|
State=Stable
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
GB_INTERFACE GB EXPORT;
|
GB_INTERFACE GB EXPORT;
|
||||||
|
|
||||||
GB_DESC *GB_CLASSES[] EXPORT =
|
GB_DESC *GB_CLASSES[] EXPORT =
|
||||||
@ -43,17 +42,13 @@ GB_DESC *GB_CLASSES[] EXPORT =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int EXPORT GB_INIT(void)
|
int EXPORT GB_INIT(void)
|
||||||
{
|
{
|
||||||
REGEXP_init();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EXPORT GB_EXIT()
|
void EXPORT GB_EXIT()
|
||||||
{
|
{
|
||||||
REGEXP_exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,291 +28,195 @@
|
|||||||
#include "regexp.h"
|
#include "regexp.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
static int init = 0;
|
|
||||||
|
|
||||||
void REGEXP_init(void)
|
|
||||||
{
|
|
||||||
init++;
|
|
||||||
if (init > 1)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void REGEXP_exit(void)
|
|
||||||
{
|
|
||||||
init--;
|
|
||||||
if (init > 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
Regexp
|
Regexp
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
BEGIN_METHOD_VOID(CREGEXP_private_compile)
|
static void compile(void *_object)
|
||||||
|
{
|
||||||
// fprintf(stderr, "debug 21\n");
|
|
||||||
int errptr;
|
int errptr;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
|
|
||||||
// fprintf(stderr, "debug 22\n");
|
|
||||||
// compile the pattern
|
|
||||||
// fprintf(stderr, "debug 22\n");
|
|
||||||
|
|
||||||
// fprintf(stderr, "debug 23\n");
|
|
||||||
|
|
||||||
// fprintf(stderr, "debug 24\n");
|
|
||||||
THIS->code = pcre_compile(THIS->pattern, THIS->copts, &errstr, &errptr, NULL);
|
THIS->code = pcre_compile(THIS->pattern, THIS->copts, &errstr, &errptr, NULL);
|
||||||
|
|
||||||
// fprintf(stderr, "debug 25\n");
|
if (!THIS->code)
|
||||||
if (THIS->code) {
|
|
||||||
THIS->compiled = 1;
|
|
||||||
// fprintf(stderr, "compiled OK\n");
|
|
||||||
// fprintf(stderr, "compiled is %d\n", THIS->compiled);
|
|
||||||
} else {
|
|
||||||
GB.Error(errstr);
|
GB.Error(errstr);
|
||||||
// fprintf(stderr, "didn't compile: %s\n", errstr);
|
}
|
||||||
}
|
|
||||||
// fprintf(stderr, "debug 26\n");
|
|
||||||
|
|
||||||
END_METHOD
|
static void exec(void *_object)
|
||||||
|
{
|
||||||
BEGIN_METHOD_VOID(CREGEXP_private_exec)
|
if (!THIS->code)
|
||||||
|
{
|
||||||
// fprintf(stderr, "debug 11\n");
|
|
||||||
if (!THIS->code) {
|
|
||||||
GB.Error("No pattern compiled yet");
|
GB.Error("No pattern compiled yet");
|
||||||
// fprintf(stderr, "No pattern, compiled is %d\n", THIS->compiled);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!THIS->subject) {
|
|
||||||
|
if (!THIS->subject)
|
||||||
|
{
|
||||||
GB.Error("No subject provided");
|
GB.Error("No subject provided");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int *ovector = THIS->ovector;
|
THIS->count = pcre_exec(THIS->code,
|
||||||
|
|
||||||
// fprintf(stderr, "debug 12\n");
|
|
||||||
// fprintf(stderr, "debug 13\n");
|
|
||||||
// do the actual match
|
|
||||||
// fprintf(stderr, "debug 14\n");
|
|
||||||
THIS->rc = pcre_exec(THIS->code,
|
|
||||||
NULL,
|
NULL,
|
||||||
THIS->subject,
|
THIS->subject,
|
||||||
strlen(THIS->subject),
|
GB.StringLength(THIS->subject),
|
||||||
0,
|
0,
|
||||||
THIS->eopts,
|
THIS->eopts,
|
||||||
ovector,
|
THIS->ovector,
|
||||||
99);
|
99);
|
||||||
|
|
||||||
// fprintf(stderr, "debug 15\n");
|
// TODO: if count == 0, it means that ovector is too small, and count is 99/3 then.
|
||||||
|
}
|
||||||
|
|
||||||
END_METHOD
|
static void return_match(void *_object, int index)
|
||||||
|
{
|
||||||
|
if (index < 0 || index >= THIS->count)
|
||||||
|
{
|
||||||
|
GB.Error("Out of bounds");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_METHOD(CREGEXP_compile, GB_STRING pattern; GB_INTEGER coptions)
|
index *= 2;
|
||||||
|
GB.ReturnNewString(&THIS->subject[THIS->ovector[index]], THIS->ovector[index + 1] - THIS->ovector[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_METHOD(RegExp_Compile, GB_STRING pattern; GB_INTEGER coptions)
|
||||||
|
|
||||||
THIS->copts = VARGOPT(coptions, 0);
|
THIS->copts = VARGOPT(coptions, 0);
|
||||||
|
|
||||||
GB.FreeString(&THIS->pattern);
|
GB.FreeString(&THIS->pattern);
|
||||||
THIS->pattern = GB.NewString(STRING(pattern), LENGTH(pattern));
|
THIS->pattern = GB.NewString(STRING(pattern), LENGTH(pattern));
|
||||||
CALL_METHOD_VOID(CREGEXP_private_compile);
|
compile(THIS);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
BEGIN_METHOD(CREGEXP_exec, GB_STRING subject; GB_INTEGER eoptions)
|
|
||||||
|
BEGIN_METHOD(RegExp_Exec, GB_STRING subject; GB_INTEGER eoptions)
|
||||||
|
|
||||||
THIS->eopts = VARGOPT(eoptions, 0);
|
THIS->eopts = VARGOPT(eoptions, 0);
|
||||||
|
|
||||||
GB.FreeString(&THIS->subject);
|
GB.FreeString(&THIS->subject);
|
||||||
THIS->subject = GB.NewString(STRING(subject), LENGTH(subject));
|
THIS->subject = GB.NewString(STRING(subject), LENGTH(subject));
|
||||||
CALL_METHOD_VOID(CREGEXP_private_exec);
|
exec(THIS);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
BEGIN_METHOD(CREGEXP_new, GB_STRING subject; GB_STRING pattern; GB_INTEGER coptions; GB_INTEGER eoptions)
|
|
||||||
|
|
||||||
GB.NewArray((void *) &(THIS->smcache), sizeof(*(THIS->smcache)), 0); // smcache is where i keep track of what to free later
|
BEGIN_METHOD(RegExp_new, GB_STRING subject; GB_STRING pattern; GB_INTEGER coptions; GB_INTEGER eoptions)
|
||||||
THIS->compiled = 0;
|
|
||||||
THIS->ovector = NULL;
|
|
||||||
THIS->rc = 0;
|
|
||||||
|
|
||||||
int *ovector = NULL;
|
GB.Alloc(POINTER(&THIS->ovector), sizeof(int) * 99);
|
||||||
// fprintf(stderr, "debug 11a\n");
|
|
||||||
GB.Alloc((void *) &ovector, sizeof(int) * 99);
|
|
||||||
THIS->ovector = ovector;
|
|
||||||
|
|
||||||
// fprintf(stderr, "debug 1\n");
|
if (MISSING(pattern)) // the user didn't provide a pattern.
|
||||||
if (MISSING(pattern)) { // the user didn't provide a pattern.
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// fprintf(stderr, "debug 2\n");
|
THIS->copts = VARGOPT(coptions, 0);
|
||||||
if (MISSING(coptions)) { // the user didn't provide any execute options.
|
|
||||||
THIS->copts = 0;
|
|
||||||
} else {
|
|
||||||
THIS->copts = VARG(coptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (THIS->pattern) {
|
|
||||||
GB.FreeString(&THIS->pattern);
|
|
||||||
}
|
|
||||||
THIS->pattern = GB.NewString(STRING(pattern), LENGTH(pattern));
|
THIS->pattern = GB.NewString(STRING(pattern), LENGTH(pattern));
|
||||||
|
|
||||||
// fprintf(stderr, "debug 3\n");
|
compile(THIS);
|
||||||
CALL_METHOD_VOID(CREGEXP_private_compile);
|
if (!THIS->code) // we didn't get a compiled pattern back.
|
||||||
// CREGEXP_compile(ARG(pattern), ARG(coptions));
|
|
||||||
// fprintf(stderr, "compiled is %d\n", THIS->compiled);
|
|
||||||
|
|
||||||
// fprintf(stderr, "debug 4\n");
|
|
||||||
if (!THIS->code) { // we didn't get a compiled pattern back.
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// fprintf(stderr, "debug 5\n");
|
if (MISSING(subject)) // the user didn't specify any subject text.
|
||||||
if (MISSING(subject)) { // the user didn't specify any subject text.
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// fprintf(stderr, "compiled is %d\n", THIS->compiled);
|
THIS->eopts = VARGOPT(eoptions, 0);
|
||||||
// fprintf(stderr, "debug 6\n");
|
|
||||||
if (MISSING(eoptions)) { // the user didn't provide any execute options.
|
|
||||||
THIS->eopts = 0;
|
|
||||||
} else {
|
|
||||||
THIS->eopts = VARG(eoptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (THIS->subject) {
|
|
||||||
GB.FreeString(&THIS->subject);
|
|
||||||
}
|
|
||||||
THIS->subject = GB.NewString(STRING(subject), LENGTH(subject));
|
THIS->subject = GB.NewString(STRING(subject), LENGTH(subject));
|
||||||
|
|
||||||
// fprintf(stderr, "debug 7\n");
|
exec(THIS);
|
||||||
// fprintf(stderr, "compiled is %d\n", THIS->compiled);
|
|
||||||
// fprintf(stderr, "Subject contains %s\n", THIS->subject);
|
|
||||||
CALL_METHOD_VOID(CREGEXP_private_exec);
|
|
||||||
// fprintf(stderr, "debug 8\n");
|
|
||||||
// fprintf(stderr, "debug 9\n");
|
|
||||||
return;
|
|
||||||
// fprintf(stderr, "debug 10\n");
|
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
BEGIN_METHOD_VOID(CREGEXP_free)
|
|
||||||
|
|
||||||
GB.FreeString(&(THIS->subject));
|
BEGIN_METHOD_VOID(RegExp_free)
|
||||||
GB.FreeString(&(THIS->pattern));
|
|
||||||
int i = 0;
|
GB.FreeString(&THIS->subject);
|
||||||
for (i = 0; i < GB.Count(THIS->smcache); i++) {
|
GB.FreeString(&THIS->pattern);
|
||||||
GB.FreeString(&(THIS->smcache[i]));
|
GB.Free(POINTER(&THIS->ovector));
|
||||||
}
|
|
||||||
GB.FreeArray((void *) &(THIS->smcache));
|
|
||||||
GB.Free((void *) &(THIS->ovector));
|
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
BEGIN_PROPERTY(CREGEXP_Offset)
|
|
||||||
|
|
||||||
GB.ReturnInteger((THIS->ovector)[0]);
|
BEGIN_PROPERTY(RegExp_Pattern)
|
||||||
|
|
||||||
|
GB.ReturnString(THIS->pattern);
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
BEGIN_PROPERTY(CREGEXPSUBMATCH_Count)
|
|
||||||
|
|
||||||
GB.ReturnInteger(THIS->rc - 1);
|
BEGIN_PROPERTY(RegExp_Subject)
|
||||||
|
|
||||||
|
GB.ReturnString(THIS->subject);
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
BEGIN_PROPERTY(CREGEXP_Text)
|
|
||||||
|
|
||||||
const char *substring_start = THIS->subject + (THIS->ovector)[0];
|
BEGIN_PROPERTY(RegExp_Offset)
|
||||||
int substring_length = (THIS->ovector)[1] - (THIS->ovector)[0];
|
|
||||||
char *str;
|
|
||||||
|
|
||||||
*(char **)GB.Add((void *)&(THIS->smcache)) = str = GB.NewString(substring_start, substring_length);
|
GB.ReturnInteger(THIS->ovector[0]);
|
||||||
GB.ReturnString(str);
|
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
BEGIN_PROPERTY(CREGEXPSUBMATCH_Text)
|
|
||||||
|
|
||||||
int i = THIS->_submatch;
|
BEGIN_PROPERTY(RegExp_Text)
|
||||||
int *ovector = THIS->ovector;
|
|
||||||
int rc = THIS->rc;
|
|
||||||
const char *str = NULL;
|
|
||||||
char *submatch = NULL;
|
|
||||||
char **tmp = NULL;
|
|
||||||
|
|
||||||
if (i < rc) {
|
if (THIS->count == 0)
|
||||||
pcre_get_substring(THIS->subject, ovector, rc, i, &str);
|
GB.ReturnNull();
|
||||||
submatch = GB.NewZeroString(str);
|
else
|
||||||
tmp = (char **) GB.Add((void *) &(THIS->smcache));
|
return_match(THIS, 0);
|
||||||
*tmp = submatch;
|
|
||||||
pcre_free_substring(str);
|
END_PROPERTY
|
||||||
} else {
|
|
||||||
GB.Error("Submatch index out of bounds");
|
|
||||||
|
BEGIN_PROPERTY(RegExp_Submatches_Count)
|
||||||
|
|
||||||
|
GB.ReturnInteger(THIS->count - 1);
|
||||||
|
|
||||||
|
END_PROPERTY
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_METHOD(RegExp_Submatches_get, GB_INTEGER index)
|
||||||
|
|
||||||
|
int index = VARG(index);
|
||||||
|
|
||||||
|
if (index < 0 || index >= (THIS->count - 1))
|
||||||
|
{
|
||||||
|
GB.Error("Out of bounds");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GB.ReturnString(submatch);
|
THIS->_submatch = index;
|
||||||
return;
|
|
||||||
|
|
||||||
END_PROPERTY
|
|
||||||
|
|
||||||
BEGIN_PROPERTY(CREGEXPSUBMATCHES_count)
|
|
||||||
|
|
||||||
GB.ReturnInteger(THIS->rc - 1);
|
|
||||||
|
|
||||||
END_PROPERTY
|
|
||||||
|
|
||||||
BEGIN_PROPERTY(CREGEXPSUBMATCH_Offset)
|
|
||||||
|
|
||||||
int i = THIS->_submatch;
|
|
||||||
int *ovector = THIS->ovector;
|
|
||||||
int rc = THIS->rc;
|
|
||||||
|
|
||||||
if (i < rc) {
|
|
||||||
GB.ReturnInteger(ovector[2*i]);
|
|
||||||
} else {
|
|
||||||
GB.Error("Submatch index out of bounds");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
END_PROPERTY
|
|
||||||
|
|
||||||
BEGIN_METHOD(CREGEXPSUBMATCHES_get, GB_INTEGER index)
|
|
||||||
|
|
||||||
int i = VARG(index);
|
|
||||||
int rc = THIS->rc;
|
|
||||||
|
|
||||||
if (i < rc && i >= 0) {
|
|
||||||
THIS->_submatch = i;
|
|
||||||
RETURN_SELF();
|
|
||||||
} else {
|
|
||||||
GB.Error("Submatch index out of bounds");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
END_METHOD
|
|
||||||
|
|
||||||
BEGIN_PROPERTY(CREGEXP_submatches)
|
|
||||||
|
|
||||||
RETURN_SELF();
|
RETURN_SELF();
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROPERTY(RegExp_Submatch_Text)
|
||||||
|
|
||||||
|
return_match(THIS, THIS->_submatch + 1);
|
||||||
|
|
||||||
|
END_PROPERTY
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROPERTY(RegExp_Submatch_Offset)
|
||||||
|
|
||||||
|
GB.ReturnInteger(THIS->ovector[2 * (THIS->_submatch + 1)]);
|
||||||
|
|
||||||
|
END_PROPERTY
|
||||||
|
|
||||||
|
|
||||||
GB_DESC CRegexpDesc[] =
|
GB_DESC CRegexpDesc[] =
|
||||||
{
|
{
|
||||||
GB_DECLARE("Regexp", sizeof(CREGEXP)),
|
GB_DECLARE("Regexp", sizeof(CREGEXP)),
|
||||||
|
|
||||||
GB_METHOD("_new", NULL, CREGEXP_new, "[(Subject)s(Pattern)s(CompileOptions)i(ExecOptions)i]"),
|
GB_METHOD("_new", NULL, RegExp_new, "[(Subject)s(Pattern)s(CompileOptions)i(ExecOptions)i]"),
|
||||||
GB_METHOD("_free", NULL, CREGEXP_free, NULL),
|
GB_METHOD("_free", NULL, RegExp_free, NULL),
|
||||||
GB_METHOD("Compile", NULL, CREGEXP_compile, "(Pattern)s[(CompileOptions)i]"),
|
|
||||||
GB_METHOD("Exec", NULL, CREGEXP_exec, "(Subject)s[(ExecOptions)i]"),
|
GB_METHOD("Compile", NULL, RegExp_Compile, "(Pattern)s[(CompileOptions)i]"),
|
||||||
|
GB_METHOD("Exec", NULL, RegExp_Exec, "(Subject)s[(ExecOptions)i]"),
|
||||||
|
|
||||||
GB_CONSTANT("Caseless", "i", PCRE_CASELESS),
|
GB_CONSTANT("Caseless", "i", PCRE_CASELESS),
|
||||||
GB_CONSTANT("MultiLine", "i", PCRE_MULTILINE),
|
GB_CONSTANT("MultiLine", "i", PCRE_MULTILINE),
|
||||||
GB_CONSTANT("DotAll", "i", PCRE_DOTALL),
|
GB_CONSTANT("DotAll", "i", PCRE_DOTALL),
|
||||||
@ -342,10 +246,13 @@ GB_DESC CRegexpDesc[] =
|
|||||||
#else
|
#else
|
||||||
GB_CONSTANT("BadUTF8Offset", "i", PCRE_ERROR_BADUTF8_OFFSET),
|
GB_CONSTANT("BadUTF8Offset", "i", PCRE_ERROR_BADUTF8_OFFSET),
|
||||||
#endif
|
#endif
|
||||||
//GB_METHOD("SubMatch", ".RegexpSubmatches", CREGEXP_submatch, "(Index)i"),
|
|
||||||
GB_PROPERTY_SELF("SubMatches", ".RegExpSubmatches"),
|
GB_PROPERTY_SELF("SubMatches", ".RegExpSubmatches"),
|
||||||
GB_PROPERTY_READ("Text", "s", CREGEXP_Text), /* this is the string matched by the entire pattern */
|
|
||||||
GB_PROPERTY_READ("Offset", "i", CREGEXP_Offset), /* this is the string matched by the entire pattern */
|
GB_PROPERTY_READ("Text", "s", RegExp_Text), /* this is the string matched by the entire pattern */
|
||||||
|
GB_PROPERTY_READ("Offset", "i", RegExp_Offset), /* this is the string matched by the entire pattern */
|
||||||
|
GB_PROPERTY_READ("Pattern", "s", RegExp_Pattern),
|
||||||
|
GB_PROPERTY_READ("Subject", "s", RegExp_Subject),
|
||||||
|
|
||||||
GB_END_DECLARE
|
GB_END_DECLARE
|
||||||
};
|
};
|
||||||
@ -354,8 +261,8 @@ GB_DESC CRegexpSubmatchesDesc[] =
|
|||||||
{
|
{
|
||||||
GB_DECLARE(".RegexpSubmatches", 0), GB_VIRTUAL_CLASS(),
|
GB_DECLARE(".RegexpSubmatches", 0), GB_VIRTUAL_CLASS(),
|
||||||
|
|
||||||
GB_METHOD("_get", ".RegexpSubmatch", CREGEXPSUBMATCHES_get, "(Index)i"),
|
GB_METHOD("_get", ".RegexpSubmatch", RegExp_Submatches_get, "(Index)i"),
|
||||||
GB_PROPERTY_READ("Count", "i", CREGEXPSUBMATCHES_count),
|
GB_PROPERTY_READ("Count", "i", RegExp_Submatches_Count),
|
||||||
|
|
||||||
GB_END_DECLARE
|
GB_END_DECLARE
|
||||||
};
|
};
|
||||||
@ -364,9 +271,8 @@ GB_DESC CRegexpSubmatchDesc[] =
|
|||||||
{
|
{
|
||||||
GB_DECLARE(".RegexpSubmatch", 0), GB_VIRTUAL_CLASS(),
|
GB_DECLARE(".RegexpSubmatch", 0), GB_VIRTUAL_CLASS(),
|
||||||
|
|
||||||
GB_PROPERTY_READ("Offset", "i", CREGEXPSUBMATCH_Offset),
|
GB_PROPERTY_READ("Offset", "i", RegExp_Submatch_Offset),
|
||||||
GB_PROPERTY_READ("Text", "s", CREGEXPSUBMATCH_Text),
|
GB_PROPERTY_READ("Text", "s", RegExp_Submatch_Text),
|
||||||
GB_PROPERTY_READ("Count", "i", CREGEXPSUBMATCH_Count),
|
|
||||||
|
|
||||||
GB_END_DECLARE
|
GB_END_DECLARE
|
||||||
};
|
};
|
||||||
|
@ -37,26 +37,22 @@ extern GB_DESC CRegexpSubmatchDesc[];
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
GB_BASE ob;
|
GB_BASE ob;
|
||||||
char *subject;
|
char *subject;
|
||||||
char *pattern;
|
char *pattern;
|
||||||
int *ovector;
|
int *ovector;
|
||||||
int rc;
|
int count;
|
||||||
int compiled;
|
|
||||||
int eopts;
|
int eopts;
|
||||||
int copts;
|
int copts;
|
||||||
pcre *code;
|
pcre *code;
|
||||||
char **smcache;
|
|
||||||
int _submatch;
|
int _submatch;
|
||||||
}
|
}
|
||||||
CREGEXP;
|
CREGEXP;
|
||||||
|
|
||||||
#define THIS OBJECT(CREGEXP)
|
#define THIS OBJECT(CREGEXP)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void REGEXP_init(void);
|
|
||||||
void REGEXP_exit(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@ Key=gb.qt4.webkit
|
|||||||
Author=Benoît Minisini
|
Author=Benoît Minisini
|
||||||
Type=Form
|
Type=Form
|
||||||
Require=gb.qt4
|
Require=gb.qt4
|
||||||
State=2
|
State=NotFinished
|
||||||
|
|
||||||
[Form]
|
[Form]
|
||||||
Control=WebView
|
Control=WebView
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
[Component]
|
[Component]
|
||||||
Key=gb.vb
|
Key=gb.vb
|
||||||
Name=Visual Basic compatibility
|
Name=Visual Basic compatibility
|
||||||
Name[fr]=Compatibilité avec Visual Basic
|
|
||||||
Name[pl]=Komponent zgodności z Visual Basic
|
|
||||||
Name[es]=Compatibilidad con Visual Basic
|
|
||||||
Name[tr]=Visual Basic uyumluluğu
|
|
||||||
Author=Benoît Minisini,Daniel Campos Fernández,Nigel Gerrard
|
Author=Benoît Minisini,Daniel Campos Fernández,Nigel Gerrard
|
||||||
Alpha=1
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user