1 # Copyright (C) 2004-2008, The Perl Foundation.
6 libpcre.pir - NCI interface to Perl-Compatible Regular Expression library
10 See 'library/pcre.pir' for details on the user interface.
15 .namespace ['PCRE::NCI']
23 .local pmc PCRE_NCI_compile
32 ## error message string size
35 ## allocate space in string for error message
36 repeat error, " ", error_size
38 PCRE_NCI_compile= find_global 'PCRE::NCI', 'PCRE_compile'
42 code= PCRE_NCI_compile( pat, options, error, errptr, NULL )
44 .local int is_code_defined
45 is_code_defined = defined code
46 unless is_code_defined goto RETURN
51 .return( code, error, errptr )
67 ## osize -- 1/(2/3) * 4 * 2
71 ## number of result pairs
72 .local int num_result_pairs
75 .local int ovector_length
76 ovector_length= osize * num_result_pairs
79 ovector= new 'ManagedStruct'
80 ovector= ovector_length
83 .local pmc PCRE_NCI_exec
84 PCRE_NCI_exec = find_global 'PCRE::NCI', 'PCRE_exec'
88 ok= PCRE_NCI_exec( regex, NULL, s, len, start, options, ovector, 10 )
90 .return( ok, ovector )
102 if ok <= 0 goto NOMATCH
111 .include "datatypes.pasm"
113 struct[0] = .DATATYPE_INT
117 assign ovector, struct
119 ovecs = ovector[0;$I0]
121 ovece = ovector[0;$I0]
123 if ovecs >= 0 goto M1
127 substr match, s, ovecs, $I0
134 # or use convinience function
135 print "copy_substring\n"
137 repeat match, " ", 500
146 .nci_call COPY_SUBSTRING
166 pcre.pir, libpcre.pir
174 Original code by Leo Toetsch, updated by Jerry Gay
175 E<lt>jerry dot gay at gmail dot com<gt>
184 # vim: expandtab shiftwidth=4 ft=pir: