Skip to content

Commit

Permalink
regcomp.c - decompose into smaller files
Browse files Browse the repository at this point in the history
This splits a bunch of the subcomponents of the regex engine into
smaller files.

       regcomp_debug.c
       regcomp_internal.h
       regcomp_invlist.c
       regcomp_study.c
       regcomp_trie.c

The only real change besides to the build machine to achieve the split
is to also adds some new defines which can be used in embed.fnc to control
exports without having to enumerate /every/ regex engine file. For
instance all of regcomp*.c defines PERL_IN_REGCOMP_ANY, and this is used
in embed.fnc to manage exports.
  • Loading branch information
demerphq committed Dec 9, 2022
1 parent 6a6e5d0 commit 85900e2
Show file tree
Hide file tree
Showing 26 changed files with 13,372 additions and 13,089 deletions.
5 changes: 5 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -5513,6 +5513,11 @@ regcharclass.h Generated by regen/regcharclass.pl
regcomp.c Regular expression compiler
regcomp.h Private declarations for above
regcomp.sym Data for regnodes.h
regcomp_debug.c Regular expression compiler debug code
regcomp_internal.h Internal stuff for regex compiler
regcomp_invlist.c Invlist logic for regular expresion engine
regcomp_study.c Optimizer for regular expresion compiler
regcomp_trie.c Trie logic for regular expresion compiler
regen.pl Run all scripts that (re)generate files
regen/charset_translations.pl Character set utilities
regen/ebcdic.pl Generates ebcdic_tables.h
Expand Down
29 changes: 19 additions & 10 deletions Makefile.SH
Original file line number Diff line number Diff line change
Expand Up @@ -530,17 +530,19 @@ unidatadirs = lib/unicore/To lib/unicore/lib
h1 = EXTERN.h INTERN.h XSUB.h av.h $(CONFIGH) cop.h cv.h dosish.h
h2 = embed.h form.h gv.h handy.h hv.h hv_func.h keywords.h mg.h op.h opcode.h
h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h regcomp_internal.h
h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
h5 = utf8.h warnings.h mydtrace.h op_reg_common.h l1_char_class_tab.h
h6 = charclass_invlists.h
h = $(h1) $(h2) $(h3) $(h4) $(h5) $(h6)
c1 = av.c scope.c op.c peep.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro_core.c perl.c
c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c
c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c utf8.c sv.c
c3 = taint.c toke.c util.c deb.c run.c builtin.c universal.c pad.c globals.c keywords.c
c4 = perlio.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c dquote.c time64.c
c5 = $(mallocsrc)
c5 = regcomp.c regcomp_debug.c regcomp_invlist.c regcomp_study.c regcomp_trie.c regexec.c
c6 = $(mallocsrc)
c_base = $(c1) $(c2) $(c3) $(c4) $(c5) $(c6)
!NO!SUBS!

Expand All @@ -552,17 +554,24 @@ main_only_objs =$main_only_objs

$spitshell >>$Makefile <<'!NO!SUBS!'
c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c $(mini_only_src)
c = $(c_base) miniperlmain.c $(mini_only_src)
obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro_core$(OBJ_EXT) keywords$(OBJ_EXT) builtin$(OBJ_EXT)
obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT) scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT) peep$(OBJ_EXT)
obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT) caretx$(OBJ_EXT) dquote$(OBJ_EXT) time64$(OBJ_EXT)
obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT)
obj2 = regcomp$(OBJ_EXT) regcomp_debug$(OBJ_EXT) regcomp_invlist$(OBJ_EXT) regcomp_study$(OBJ_EXT) regcomp_trie$(OBJ_EXT)
obj3 = regexec$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro_core$(OBJ_EXT)
obj4 = keywords$(OBJ_EXT) builtin$(OBJ_EXT)
obj5 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT)
obj6 = scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT) peep$(OBJ_EXT)
obj7 = doop$(OBJ_EXT) doio$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT)
obj8 = deb$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT)
obj9 = locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT) caretx$(OBJ_EXT) dquote$(OBJ_EXT)
obj10 = time64$(OBJ_EXT)
# split the objects into 3 exclusive sets: those used by both miniperl and
# perl, and those used by just one or the other. Doesn't include the
# actual perl(mini)main.o, nor any dtrace objects.
common_objs = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
common_objs = $(obj1) $(obj2) $(obj3) $(obj4) $(obj5) $(obj6) $(obj7) $(obj8) $(obj9) $(obj10) $(ARCHOBJS)
miniperl_objs_nodt = $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
perllib_objs_nodt = $(main_only_objs) $(common_objs)
Expand Down Expand Up @@ -1722,8 +1731,8 @@ distcheck: FORCE
.PHONY: ctags
TAGS: $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
etags $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
TAGS: $(c_base) $(h)
etags $(c_base) $(h)
!NO!SUBS!

$spitshell >>$Makefile <<!GROK!THIS!
Expand Down
17 changes: 15 additions & 2 deletions Makefile.micro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ O = uav$(_O) udeb$(_O) udoio$(_O) udoop$(_O) udquote$(_O) udump$(_O) \
umg$(_O) uperlmain$(_O) uop$(_O) ureentr$(_O) \
upad$(_O) uperl$(_O) uperlio$(_O) uperly$(_O) upp$(_O) \
upp_ctl$(_O) upp_hot$(_O) upp_sys$(_O) upp_pack$(_O) upp_sort$(_O) \
uregcomp$(_O) uregexec$(_O) urun$(_O) \
uregcomp$(_O) uregcomp_debug$(_O) uregcomp_invlist$(_O) \
uregcomp_study$(_O) uregcomp_trie$(_O) uregexec$(_O) urun$(_O) \
uscope$(_O) usv$(_O) utaint$(_O) utime64$(_O) utoke$(_O) \
unumeric$(_O) ulocale$(_O) umathoms$(_O) \
uuniversal$(_O) uutf8$(_O) uutil$(_O) ukeywords$(_O)
Expand Down Expand Up @@ -138,7 +139,19 @@ upp_pack$(_O): $(HE) pp_pack.c
upp_sort$(_O): $(HE) pp_sort.c
$(CC) $(CCFLAGS) -o $@ $(CFLAGS) pp_sort.c

uregcomp$(_O): $(HE) regcomp.c regcomp.h regnodes.h INTERN.h
uregcomp$(_O): $(HE) regcomp.c regcomp_internal.h regcomp.h regnodes.h INTERN.h
$(CC) $(CCFLAGS) -o $@ $(CFLAGS) regcomp.c

uregcomp_debug$(_O): $(HE) regcomp_debug.c regcomp_internal.h regcomp.h regnodes.h INTERN.h
$(CC) $(CCFLAGS) -o $@ $(CFLAGS) regcomp.c

uregcomp_invlist$(_O): $(HE) regcomp_invlist.c regcomp_internal.h regcomp.h regnodes.h INTERN.h
$(CC) $(CCFLAGS) -o $@ $(CFLAGS) regcomp.c

uregcomp_study$(_O): $(HE) regcomp_study.c regcomp_internal.h regcomp.h regnodes.h INTERN.h
$(CC) $(CCFLAGS) -o $@ $(CFLAGS) regcomp.c

uregcomp_trie$(_O): $(HE) regcomp_trie.c regcomp_internal.h regcomp.h regnodes.h INTERN.h
$(CC) $(CCFLAGS) -o $@ $(CFLAGS) regcomp.c

uregexec$(_O): $(HE) regexec.c regcomp.h regnodes.h
Expand Down
Loading

0 comments on commit 85900e2

Please sign in to comment.